libsc  2.8.3.341-30a7-dirty
The SC library provides support for parallel scientific applications.
sc_notify.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
58 #ifndef SC_NOTIFY_H
59 #define SC_NOTIFY_H
60 
61 #include <sc_statistics.h>
62 
63 SC_EXTERN_C_BEGIN;
64 
67 
70 
73 
87 int sc_notify_allgather (int *receivers, int num_receivers,
88  int *senders, int *num_senders,
89  sc_MPI_Comm mpicomm);
90 
106 int sc_notify (int *receivers, int num_receivers,
107  int *senders, int *num_senders,
108  sc_MPI_Comm mpicomm);
109 
125 void sc_notify_nary (sc_array_t * receivers,
126  sc_array_t * senders,
127  sc_array_t * in_payload,
128  sc_array_t * out_payload,
129  sc_MPI_Comm mpicomm);
130 
146 void sc_notify_ext (sc_array_t * receivers,
147  sc_array_t * senders,
148  sc_array_t * in_payload,
149  sc_array_t * out_payload,
150  sc_MPI_Comm mpicomm);
151 
157 typedef struct sc_notify_s sc_notify_t;
158 
161  sc_array_t *, sc_notify_t *,
162  void *);
163 
165 typedef enum
166 {
171  SC_NOTIFY_PEX,
180 }
182 
183 #define SC_NOTIFY_STR_ALLGATHER "allgather"
184 #define SC_NOTIFY_STR_BINARY "binary"
185 #define SC_NOTIFY_STR_NARY "nary"
186 #define SC_NOTIFY_STR_PEX "pex"
187 #define SC_NOTIFY_STR_PCX "pcx"
188 #define SC_NOTIFY_STR_RSX "rsx"
189 #define SC_NOTIFY_STR_NBX "nbx"
190 #define SC_NOTIFY_STR_RANGES "ranges"
191 #define SC_NOTIFY_STR_SUPERSET "superset"
194 extern const char *sc_notify_type_strings[SC_NOTIFY_NUM_TYPES];
195 
199 
203 
214 
221 
229 
238  size_t thresh);
239 
247 
258  sc_statistics_t * stats);
259 
267 
273 
280 
291  sc_notify_type_t type);
292 
302  int *ntop, int *nint,
303  int *nbot);
304 
313 void sc_notify_nary_set_widths (sc_notify_t * notify, int ntop,
314  int nint, int nbot);
315 
321 
327  int num_ranges);
328 
334 int sc_notify_ranges_get_package_id (sc_notify_t * notify);
335 
340 void sc_notify_ranges_set_package_id (sc_notify_t * notify,
341  int package_id);
342 const int *sc_notify_ranges_get_procs (sc_notify_t * notify,
343  int *num_procs);
344 void sc_notify_ranges_set_procs (sc_notify_t * notify,
345  int num_procs,
346  const int *procs);
347 void sc_notify_ranges_get_peer_range (sc_notify_t * notify,
348  int *first_peer,
349  int *last_peer);
350 void sc_notify_ranges_set_peer_range (sc_notify_t * notify,
351  int first_peer,
352  int last_peer);
353 
362  (sc_notify_t * notify, sc_compute_superset_t * compute_superset, void *ctx);
363 
370  (sc_notify_t * notify, sc_compute_superset_t compute_superset, void *ctx);
371 
400 void sc_notify_payload (sc_array_t * receivers,
401  sc_array_t * senders,
402  sc_array_t * in_payload,
403  sc_array_t * out_payload,
404  int sorted, sc_notify_t * notify);
405 
451 void sc_notify_payloadv (sc_array_t * receivers,
452  sc_array_t * senders,
453  sc_array_t * out_payload,
454  sc_array_t * in_payload,
455  sc_array_t * out_offsets,
456  sc_array_t * in_offsets,
457  int sorted, sc_notify_t * notify);
458 
463 
464 SC_EXTERN_C_END;
465 
466 #endif /* !SC_NOTIFY_H */
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition: sc_mpi.h:392
void sc_notify_destroy(sc_notify_t *notify)
Destroy a notify controller constructed with sc_notify_new.
sc_notify_type_t sc_notify_get_type(sc_notify_t *notify)
Get the type of a notify controller.
void sc_notify_payload(sc_array_t *receivers, sc_array_t *senders, sc_array_t *in_payload, sc_array_t *out_payload, int sorted, sc_notify_t *notify)
Collective call to notify a set of receiver ranks of current rank.
void sc_notify_nary_set_widths(sc_notify_t *notify, int ntop, int nint, int nbot)
For a notify of type SC_NOTIFY_NARY, set the branching widths of the recursive algorithm.
void sc_notify_payloadv(sc_array_t *receivers, sc_array_t *senders, sc_array_t *out_payload, sc_array_t *in_payload, sc_array_t *out_offsets, sc_array_t *in_offsets, int sorted, sc_notify_t *notify)
Collective call to notify a set of receiver ranks of current rank and send a variable size message to...
int sc_notify(int *receivers, int num_receivers, int *senders, int *num_senders, sc_MPI_Comm mpicomm)
Collective call to notify a set of receiver ranks of current rank.
size_t sc_notify_get_eager_threshold(sc_notify_t *notify)
Get the payload size above which payloads are no longer transferred with notification packets in sc_n...
sc_notify_t * sc_notify_new(sc_MPI_Comm mpicomm)
Create a notify controller that can be used in sc_notify_payload and sc_notify_payloadv.
void sc_notify_ranges_set_num_ranges(sc_notify_t *notify, int num_ranges)
Set the number of ranges for the SC_NOTIFY_RANGES method.
sc_notify_type_t
Various equivalent implementations of the functionality.
Definition: sc_notify.h:166
@ SC_NOTIFY_ALLGATHER
Choose allgather algorithm.
Definition: sc_notify.h:168
@ SC_NOTIFY_SUPERSET
Use a computable superset of communicators, computed by a callback function.
Definition: sc_notify.h:177
@ SC_NOTIFY_RSX
Choose remote summation algorithm.
Definition: sc_notify.h:174
@ SC_NOTIFY_NUM_TYPES
End of list marker for notify algorithms.
Definition: sc_notify.h:179
@ SC_NOTIFY_DEFAULT
Choose whatever type is stored in sc_notify_type_default.
Definition: sc_notify.h:167
@ SC_NOTIFY_RANGES
Use the sc_ranges functionality.
Definition: sc_notify.h:176
@ SC_NOTIFY_PCX
Choose reduce_scatter algorithm (AKA personalized census).
Definition: sc_notify.h:173
@ SC_NOTIFY_NARY
Choose nary (k-way) recursion.
Definition: sc_notify.h:170
@ SC_NOTIFY_PEX
Choose alltoall algorithm (AKA personalized exchange).
Definition: sc_notify.h:171
@ SC_NOTIFY_NBX
Choose non-blocking consensus algorithm.
Definition: sc_notify.h:175
@ SC_NOTIFY_BINARY
Choose simple binary recursion.
Definition: sc_notify.h:169
int sc_notify_nary_ntop_default
Default number of children at root node of nary tree; initialized to 2.
const char * sc_notify_type_strings[SC_NOTIFY_NUM_TYPES]
Names for each notify method.
sc_MPI_Comm sc_notify_get_comm(sc_notify_t *notify)
Get the MPI communicator of a notify controller.
size_t sc_notify_eager_threshold_default
The default threshold for payload sizes (in bytes) that are communicated with the notification packet...
void(* sc_compute_superset_t)(sc_array_t *, sc_array_t *, sc_array_t *, sc_notify_t *, void *)
Type of callback function for the SC_NOTIFY_SUPERSET variant.
Definition: sc_notify.h:160
void sc_notify_ext(sc_array_t *receivers, sc_array_t *senders, sc_array_t *in_payload, sc_array_t *out_payload, sc_MPI_Comm mpicomm)
The default implementation of the notify functionality, currently PEX.
int sc_notify_ranges_num_ranges_default
For the SC_NOTIFY_RANGES method, the default is 25.
int sc_notify_allgather(int *receivers, int num_receivers, int *senders, int *num_senders, sc_MPI_Comm mpicomm)
Collective call to notify a set of receiver ranks of current rank.
int sc_notify_nary_nint_default
Default number of children at intermediate tree nodes; initialized to 2.
void sc_notify_set_eager_threshold(sc_notify_t *notify, size_t thresh)
Get the payload size above which payloads are no longer transferred with notification packets in sc_n...
sc_statistics_t * sc_notify_get_stats(sc_notify_t *notify)
Get the sc_statistics_t object for logging runtimes (added by function name).
void sc_notify_nary_get_widths(sc_notify_t *notify, int *ntop, int *nint, int *nbot)
For a notify of type SC_NOTIFY_NARY, get the branching widths of the recursive algorithm.
void sc_notify_nary(sc_array_t *receivers, sc_array_t *senders, sc_array_t *in_payload, sc_array_t *out_payload, sc_MPI_Comm mpicomm)
The n-ary tree implementation of the notify functionality.
void sc_notify_superset_get_callback(sc_notify_t *notify, sc_compute_superset_t *compute_superset, void *ctx)
Query the callback for the SC_NOTIFY_SUPERSET method.
int sc_notify_ranges_get_num_ranges(sc_notify_t *notify)
Query the number of ranges for the SC_NOTIFY_RANGES method.
int sc_notify_nary_nbot_default
Default number of children at deepest level of tree; initialized to 2.
int sc_notify_set_type(sc_notify_t *notify, sc_notify_type_t type)
Set the type of a notify controller.
void sc_notify_set_stats(sc_notify_t *notify, sc_statistics_t *stats)
Set a sc_statistics_t object for logging runtimes (added by function name).
int sc_notify_supports_type(sc_notify_type_t type)
Query whether sc_notify_set_type supports a given type.
void sc_notify_superset_set_callback(sc_notify_t *notify, sc_compute_superset_t compute_superset, void *ctx)
Set the callback for the SC_NOTIFY_SUPERSET method.
sc_notify_type_t sc_notify_type_default
The default type used when constructing a notify controller; initialized to SC_NOTIFY_PEX.
struct sc_notify_s sc_notify_t
Opaque object used for controlling notification (AKA dynamic sparse data exchange) operations.
Definition: sc_notify.h:157
Computation of average and mean values etc.
The sc_array object provides a dynamic array of equal-size elements.
Definition: sc_containers.h:91
The statistics container allows dynamically adding random variables.
Definition: sc_statistics.h:63