1
/* begin_generated_IBM_copyright_prolog */
3
/* -------------------------------------------------------------- */
4
/* (C)Copyright IBM Corp. 2007, 2008 */
6
/* -------------------------------------------------------------- */
7
/* end_generated_IBM_copyright_prolog */
8
/********************************************************************/
10
/* $Id: bgml.h 6904 2010-09-16 18:55:57Z manoj $ */
14
* \brief Common external message layer interface.
29
* \brief Message layer operation types
34
BGML_UNDEFINED_OP = -1,
53
* \brief Message layer data types
58
/* Standard/Primative DT's */
59
BGML_UNDEFINED_DT = -1,
80
BGML_2DOUBLE_PRECISION,
85
/* ********************************************************************* */
87
/* Generic: messager object */
89
/* ********************************************************************* */
92
* \brief Common BlueGene quad datatype (4 words, 16 bytes)
97
unsigned w0; /**< Word[0] */
98
unsigned w1; /**< Word[1] */
99
unsigned w2; /**< Word[2] */
100
unsigned w3; /**< Word[3] */
102
BGQuad __attribute__ ((__aligned__ (16)));
105
* \brief completion callback information descriptor. Mostly used to
106
* signal completion of a particular operation to the world outside
107
* the messaging library.
110
typedef struct BGML_Callback_t
112
void (*function) (void *); /**< actual function to call */
113
void *clientdata; /**< argument to function */
118
* \brief Initialize messager singleton. Not thread safe. This
119
* function can be called multiple times.
120
* \return 1 when called the first time; 0 for every subsequent call.
123
unsigned BGML_Messager_Init ();
126
* \brief Finalize messager singleton. Not thread safe. This
127
* function can be called multiple times.
128
* \return 1 when called the first time; 0 for every subsequent call.
131
unsigned BGML_Messager_Finalize ();
134
* \brief Enter a critical section
137
inline void BGML_CriticalSection_enter ();
140
* \brief Exit a critical section
143
inline void BGML_CriticalSection_exit ();
145
/** \brief Messager advance loop. Thread safe. */
147
unsigned BGML_Messager_advance ();
149
/** \brief return linear rank of current node. Reentrant. */
151
unsigned BGML_Messager_rank ();
153
/** \brief return number of processors running current job. Reentrant. */
155
unsigned BGML_Messager_size ();
157
/*! \brief return the geometry of the block. */
158
void BGML_Messager_geometry (unsigned *x, unsigned *y, unsigned *z);
161
* \brief map a torus coordinate to a linear rank. Thread safe.
162
* \param x: torus x coordinate
163
* \param y: torus y coordinate
164
* \param z: torus z coordinate
165
* \param t: torus t coordinate
166
* \returns: linear rank or -1 if node (x,y,z,t) is not part of current job
169
int BGML_Messager_torus2rank (int x, int y, int z, int t);
172
* \brief find torus coordinates for a linear rank. Thread safe.
173
* \param rank: linear rank of a node
174
* \param x: returns torus x coordinate of node
175
* \param y: returns torus y coordinate of node
176
* \param z: returns torus z coordinate of node
177
* \param t: returns torus t coordinate of node
178
* \returns 0 if successful; -1 if rank parameter outside of acceptable
182
int BGML_Messager_rank2torus (int rank, int *x, int *y, int *z, int *t);
184
#define BGML_MESSAGER_VNMODE 0 /**< virtual node mode */
185
#define BGML_MESSAGER_SMMODE 1 /**< shared memory mode */
186
#define BGML_MESSAGER_CPMODE 2 /**< non-coherent coprocessor mode */
189
* \brief This should provide information about whether we
190
* are in shared memory/coprocessor mode or virtual node mode
191
* \todo incomplete!!!
194
int BGML_Messager_mode ();
196
#define BGML_MESSAGER_2S 1 /**< two-sided (MPI) communication */
197
#define BGML_MESSAGER_1S 2 /**< one-sided communication */
198
#define BGML_MESSAGER_TR 4 /**< torus collectives */
199
#define BGML_MESSAGER_TSC 8 /**< torus collectives */
200
#define BGML_MESSAGER_TSRC 16 /**< rectangular torus collectives */
201
#define BGML_MESSAGER_GI 32 /**< global interrupt barrier */
204
* \brief Provides list of available subsets in messaging library.
205
* \return a bit mask of available subsystems.
208
unsigned long long BGML_Messager_available ();
210
/* ********************************************************************* */
212
/* 2-sided point-to-point communication: callbacks & initialization */
214
/* ********************************************************************* */
217
* \brief Opaque data type that holds all 2-sided message requests
218
* (send & receive). We allocate 0.5 KBytes of space to hold the
219
* send/receive object's state. The external API does not reveal the
220
* internal structure of the object. Implementations should verify
221
* that send and receive objects need less space than sizeof(BG_2S_t).
224
typedef BGQuad BG2S_t[32];
227
* \brief Pointer to the 2-sided message opaque data type.
230
typedef BG2S_t *BG2S_p;
233
* \brief callback invoked when a long message arrives to destination.
237
BG2S_t *(*cb_BG2S_Recv) (const BGQuad * msginfo,
239
const unsigned sndlen,
241
char **rcvbuf, BGML_Callback_t * const cb_info);
244
* \brief callback invoked when a short message arrives to destination.
248
void (*cb_BG2S_RecvShort) (const BGQuad * msginfo,
250
const char *sndbuf, const unsigned sndlen);
253
* \brief callback invoked when a control message arrives to destination.
257
void (*cb_BG2S_Control) (unsigned senderrank,
258
const char *sndbuf, const unsigned sndlen);
262
* \brief Initialize 2-sided communication. Cannot send 2-sided messages
263
* before this function has been invoked. Not thread safe.
264
* \param cb_recvshort: callback invoked for short messages
265
* \param cb_recvlong: callback invoked for long messages
266
* \param cb_control: callback invoked for control messages
267
* !!! open question: should we allocate explicit space for the protocols?
270
void BG2S_Configure (cb_BG2S_RecvShort cb_recvshort,
271
cb_BG2S_Recv cb_recvlong, cb_BG2S_Control cb_control);
273
/* ********************************************************************* */
275
/* 2-sided point-to-point communication: message sending primitives */
277
/* ********************************************************************* */
280
* \brief Send a message. Thread safe if invoked on different
281
* messages. Until the send invokes the callback, it is illegal to
282
* send it again, reset it or touch the attached send buffer.
284
* \param request: place to keep per-message information, such as
285
* location in send queue, how many bytes have been sent etc.
286
* \param cb_info: function to call when send is *locally* complete
287
* \param msginfo: a "quad" of (to messager, opaque) MPI header information.
288
* \param sndbuf: send data buffer.
289
* \param sndlen: send data length (in bytes).
290
* \param destrank: destination rank.
293
void BG2S_Send (BG2S_t * request,
294
const BGML_Callback_t * cb_info,
295
const BGQuad * msginfo,
296
const char *sndbuf, unsigned sndlen, unsigned destrank);
299
* \brief Create a send request that can be sent later. Reentrant.
302
void BG2S_Create (BG2S_t * request,
303
const BGML_Callback_t * cb_info,
304
const BGQuad * msginfo,
305
const char *sndbuf, unsigned sndlen, unsigned destrank);
308
* \brief reset an existing send request. Set byte counters to zero.
309
* This allows a request to be sent multiple times. Reentrant.
312
void BG2S_Reset (BG2S_t * request);
315
* \brief post a request (i.e. start sending it).
316
* Until the send invokes its callback, it is illegal to reset it
317
* or touch the attached send buffer. Thread safe.
320
void BG2S_Start (BG2S_t * sender);
323
* \brief control message send. message length should be < 200 bytes.
326
void BG2S_Control (BG2S_t * request,
327
const BGML_Callback_t * cb_info,
328
const char *sndbuf, unsigned sndlen, unsigned destrank);
330
/* ********************************************************************* */
332
/* one-sided communication (torus) */
334
/* ********************************************************************* */
337
* \brief Opaque data type that holds all 1-sided message requests.
338
* The external API does not reveal the internal structure of the object.
341
typedef BGQuad BG1S_t[32];
344
* \brief Generalized I/O vector data type/
349
void **src_ptr_ar; /**< Source starting addresses of each data segment. */
350
void **dst_ptr_ar; /**< Destination starting addresses of each data segment. */
351
int ptr_ar_len; /**< Number of data segment. */
352
int bytes; /**< The length of each segment in bytes. */
356
* \brief execute a one-sided \b put to a destination node. Takes the
357
* combination of base and srcbuf processed by the translation function
358
* and returns the addressed buffer to the originator of request.
360
* \param[in] request Data structure holding state of the \b put
361
* \param[in] dstrank Data destination rank
362
* \param[in] srcbuf Send (source) buffer on the local node
363
* \param[in] base Base address of receive (destination) buffer on the remote node
364
* \param[in] dstbuf Receive (destination) buffer on the remote node
365
* \param[in] bytes Number of bytes to transfer
366
* \param[in] cb_done Callback to invoke when message has completed
367
* \param[in] isconsistent Nonzero if consistency is required
370
int BG1S_Memput (BG1S_t *request,
376
const BGML_Callback_t * cb_done,
377
unsigned isconsistent);
380
* \brief execute a one-sided \b vector \b put to a destination node. Takes the
381
* combination of srcbase and srcbuf processed by the translation function
382
* and returns the addressed buffer to the originator of request.
384
* \param[in] request Data structure holding state of the \b put
385
* \param[in] dstrank Data destination rank
386
* \param[in] giov_count Number of generalized IO vector elements describing data to put to the remote node
387
* \param[in] giov_array Array of generalized IO vectors
388
* \param[in] base Base address of receive (destination) buffers on the remote node
389
* \param[in] cb_done Callback to invoke when message has completed
390
* \param[in] isconsistent Nonzero if consistency is required
393
int BG1S_MemputV (BG1S_t *request,
396
BGML_giov_t *giov_array,
398
const BGML_Callback_t * cb_done,
399
unsigned isconsistent);
402
* \brief execute a one-sided \b strided \b put to a destination node. Takes the
403
* combination of srcbase and srcbuf processed by the translation function
404
* and returns the addressed buffer to the originator of request.
406
* \param[in] request Data structure holding state of the \b put
407
* \param[in] dstrank Data destination rank
408
* \param[in] src_ptr Pointer to 1st segment at source
409
* \param[in] src_stride_arr Array of strides at source
410
* \param[in] src_ptr Pointer to 1st segment at destination
411
* \param[in] src_stride_arr Array of strides at destination
412
* \param[in] seg_count Number of segments at each stride levels: count[0]=bytes
413
* \param[in] stride_levels Number of stride levels
414
* \param[in] base Base address of receive (destination) buffers on the remote node
415
* \param[in] cb_done Callback to invoke when message has completed
416
* \param[in] isconsistent Nonzero if consistency is required
419
int BG1S_MemputS (BG1S_t *request,
428
const BGML_Callback_t * cb_done,
429
unsigned isconsistent);
432
* \brief execute a one-sided \b get from a remote node.
434
* \param[in] request Data structure holding state of the \b get
435
* \param[in] srcrank Data source rank
436
* \param[in] dstbuf Receive (destination) buffer on the local node
437
* \param[in] base Base address of send (source) buffer on the remote node
438
* \param[in] srcbuf Send (source) buffer on the remote node
439
* \param[in] bytes Number of bytes to transfer
440
* \param[in] cb_done Callback to invoke when message has completed
441
* \param[in] isconsistent Nonzero if consistency is required
444
int BG1S_Memget (BG1S_t *request,
450
const BGML_Callback_t * cb_done,
451
unsigned isconsistent);
454
* \brief execute a one-sided \b vector \b get from a remote node.
456
* \param[in] request Data structure holding state of the \b get
457
* \param[in] srcrank Data source rank
458
* \param[in] giov_count Number of generalized IO vector elements describing data to get from the remote node
459
* \param[in] giov_array Array of generalized IO vectors
460
* \param[in] base Base address of send (source) buffer on the remote node
461
* \param[in] cb_done Callback to invoke when message has completed
462
* \param[in] isconsistent Nonzero if consistency is required
465
int BG1S_MemgetV (BG1S_t *request,
468
BGML_giov_t *giov_array,
470
const BGML_Callback_t * cb_done,
471
unsigned isconsistent);
474
* \brief execute a one-sided \b strided \b get from a remote node.
476
* \param[in] request Data structure holding state of the \b get
477
* \param[in] srcrank Data source rank
478
* \param[in] src_ptr Pointer to 1st segment at source
479
* \param[in] src_stride_arr Array of strides at source
480
* \param[in] src_ptr Pointer to 1st segment at destination
481
* \param[in] src_stride_arr Array of strides at destination
482
* \param[in] seg_count Number of segments at each stride levels: count[0]=bytes
483
* \param[in] stride_levels Number of stride levels
484
* \param[in] base Base address of send (source) buffer on the remote node
485
* \param[in] cb_done Callback to invoke when message has completed
486
* \param[in] isconsistent Nonzero if consistency is required
489
int BG1S_MemgetS (BG1S_t *request,
498
const BGML_Callback_t * cb_done,
499
unsigned isconsistent);
502
* \brief Register a callback function to be invoked when all outstanding operations
503
* on this node to the remote node have completed accessing local memory.
505
* \param[in] rank remote node
506
* \param[in] cb_done function to invoke when local memory access has completed
507
* \param[in] clientdata clientdata referenced when \b cb_done is invoked
511
* void wait_callback (void * clientdata)
513
* unsigned * done = (unsigned *) clientdata;
517
* void wait_proc (unsigned rank)
520
* BGML_Callback_t cb_wait_proc = {wait_callback, &done};
521
* if (BG1S_WaitProc (rank, &cb_wait_proc))
523
* BGML_CriticalSection_enter();
524
* while (!done) BGML_Messager_advance ();
525
* BGML_CriticalSection_exit();
531
int BG1S_WaitProc (unsigned rank, const BGML_Callback_t * cb_done);
535
* \brief Register a callback function to be invoked when all outstanding operations
536
* on this node have completed accessing local memory.
538
* \param[in] cb_done function to invoke when local memory access has completed
539
* \param[in] clientdata clientdata referenced when \b cb_done is invoked
544
* void wait_callback (void * clientdata)
546
* unsigned * done = (unsigned *) clientdata;
553
* BGML_Callback_t cb_wait_all = {wait_callback, &done};
554
* if (BG1S_WaitAll (&cb_wait_all))
556
* BGML_CriticalSection_enter();
557
* while (!done) BGML_Messager_advance ();
558
* BGML_CriticalSection_exit();
564
int BG1S_WaitAll (const BGML_Callback_t * cb_done);
568
* \brief Execute a \b read-modify-write operation.
570
* \param[in] request data structure holding state of the \b rmw
571
* \param[in] rank remote rank
572
* \param[in] base base address of destination buffer
573
* \param[in] dstbuf destination (remote) buffer
574
* \param[in] input input (local) buffer
575
* \param[in] output output (local) buffer
576
* \param[in] operation operation to perfrom on remote node
577
* \param[in] datatype data type of memory at the destination, input, and output buffers
578
* \param[in] cb_done function to invoke when reception of all data has been
579
* acknowledged by the remote node.
580
* \param[in] clientdata clientdata referenced when \b cb_done is invoked
581
* \param[in] isconsistent nonzero if consistency is required
584
int BG1S_rmw (BG1S_t *request,
592
const BGML_Callback_t * cb_done,
593
unsigned isconsistent);
597
* \brief Execute an \b accumulate operation.
599
* The accumulate function is dependent on the data type, operand and operations.
600
* <code>dst[i] = (src[i] op1 operand) op2 dst[i]</code>
602
* combination of sndbase and sndbuf processed by the translation function
603
* and returns the addressed buffer to the originator of request.
605
* \param[in] request Data structure holding state of the \b accumulate
606
* \param[in] rank Remote processor rank
607
* \param[in] srcbuf Source (local) buffer
608
* \param[in] operand Operand (local) buffer
609
* \param[in] base Base address of destination buffer
610
* \param[in] dstbuf Destination (remote) buffer
611
* \param[in] count Number of elements to accumulate
612
* \param[in] datatype Element data type
613
* \param[in] op1 Operation to transform data as it is sent from the local node
614
* \param[in] op2 Operation to transform data as it is received at the remote node
615
* \param[in] cb_done Callback to invoke when message has completed
616
* \param[in] isconsistent Nonzero if consistency is required
619
int BG1S_Accumulate (BG1S_t *request,
623
const unsigned dstbase,
629
const BGML_Callback_t * cb_done,
630
unsigned isconsistent);
633
* \brief Execute a \b vector \b accumulate operation.
635
* The accumulate function is dependent on the data type, operand and operations.
636
* <code>dst[i] = (src[i] op1 operand) op2 dst[i]</code>
638
* combination of sndbase and sndbuf processed by the translation function
639
* and returns the addressed buffer to the originator of request.
641
* \param[in] request Data structure holding state of the \b put
642
* \param[in] rank Remote processor rank
643
* \param[in] giov_count Number of generalized IO vector elements describing data to accumulate on the remote node
644
* \param[in] giov_array Array of generalized IO vectors
645
* \param[in] operand Operand (local) buffer
646
* \param[in] base Base address of receive (destination) buffers on the remote node
647
* \param[in] datatype Element data type
648
* \param[in] op1 Operation to transform data as it is sent from the local node
649
* \param[in] op2 Operation to transform data as it is received at the remote node
650
* \param[in] cb_done Callback to invoke when message has completed
651
* \param[in] isconsistent Nonzero if consistency is required
654
int BG1S_AccumulateV (BG1S_t *request,
657
BGML_giov_t *giov_array,
663
const BGML_Callback_t * cb_done,
664
unsigned isconsistent);
667
* \brief Execute a \b strided \b accumulate operation.
669
* The accumulate function is dependent on the data type, operand and operations.
670
* <code>dst[i] = (src[i] op1 operand) op2 dst[i]</code>
672
* combination of sndbase and sndbuf processed by the translation function
673
* and returns the addressed buffer to the originator of request.
675
* \param[in] request Data structure holding state of the \b put
676
* \param[in] rank Remote processor rank
677
* \param[in] src_ptr Pointer to 1st segment at source
678
* \param[in] src_stride_arr Array of strides at source
679
* \param[in] src_ptr Pointer to 1st segment at destination
680
* \param[in] src_stride_arr Array of strides at destination
681
* \param[in] seg_count Number of segments at each stride levels: count[0]=bytes
682
* \param[in] stride_levels Number of stride levels
683
* \param[in] operand Operand (local) buffer
684
* \param[in] base Base address of receive (destination) buffers on the remote node
685
* \param[in] datatype Element data type
686
* \param[in] op1 Operation to transform data as it is sent from the local node
687
* \param[in] op2 Operation to transform data as it is received at the remote node
688
* \param[in] cb_done Callback to invoke when message has completed
689
* \param[in] isconsistent Nonzero if consistency is required
692
int BG1S_AccumulateS (BG1S_t *request,
705
const BGML_Callback_t * cb_done,
706
unsigned isconsistent);
710
* \brief Acquire a lock resource.
712
* The lock request sends an opaque \c lockinfo data structure to the target
713
* node which returns an opaque \c keyinfo data structure to the origin node.
714
* This \c keyinfo information is used to unlock the resource.
716
* The implementation of the lock and unlock operations is dependent on the
717
* registered \c cb_lock and \c cb_unlock callback functions.
721
* \param[in] request Data structure holding state of the message
722
* \param[in] rank Remote processor rank
723
* \param[in] lockinfo Pointer to opaque lock information
724
* \param[out] keyinfo Pointer to opaque key information
725
* \param[in] cb_done Callback to invoke when message has completed
726
* \param[in] isconsistent Nonzero if consistency is required
729
int BG1S_Lock (BG1S_t *request,
731
const BGQuad * lockinfo,
732
const BGQuad * keyinfo,
733
const BGML_Callback_t * cb_done,
734
unsigned isconsistent);
737
* \brief Release a previously acquired lock resource.
739
* The unlock request sends an opaque \c keyinfo data structure to the target
740
* node which unlocks the resource and allows the next lock request to proceed.
742
* The implementation of the lock and unlock operations is dependent on the
743
* registered \c cb_lock and \c cb_unlock callback functions.
747
* \param[in] request Data structure holding state of the message
748
* \param[in] rank Remote processor rank
749
* \param[out] keyinfo Pointer to opaque key information
750
* \param[in] cb_done Callback to invoke when message has completed
751
* \param[in] isconsistent Nonzero if consistency is required
754
int BG1S_Unlock (BG1S_t *request,
756
const BGQuad * keyinfo,
757
const BGML_Callback_t * cb_done,
758
unsigned isconsistent);
762
* \brief One-sided communication consistency models.
767
BG1S_ConsistencyModel_Relaxed = 0, /*!< Message are immediately sent */
768
BG1S_ConsistencyModel_Weak = 1, /*!< Messages to the same node preserve order. */
769
BG1S_ConsistencyModel_Sequential = 2, /*!< Messages to all nodes preserve order. */
771
BG1S_ConsistencyModel;
774
* \brief One-sided communcation configuration.
779
/** Callback function that is invoked to allocate memory. The first parameter
780
* is the number of bytes to allocate and the second parameter is the
781
* \c cb_alloc clientdata. */
782
void *(*cb_alloc) (unsigned, void *);
784
/** Clientdata for the \c cb_alloc callback function */
785
void * cb_alloc_clientdata;
787
/** Callback function that is invoked to free memory previously allocated
788
* by the \c cb_alloc function. The first parameter is the address of the
789
* memory to free and the second parameter is the \c cb_free clientdata. */
790
void (*cb_free) (void *, void *);
792
/** Clientdata for the \c cb_free callback function */
793
void * cb_free_clientdata;
795
/** Callback function that is invoked to map a raw address and base
796
* value to a memory location. The first parameter is the raw address,
797
* the second parameter is the base value, and the third parameter is the
798
* \c cb_map clientdata. */
799
void *(*cb_map) (void *, unsigned, void *);
801
/** Clientdata for the \c cb_map callback function */
802
void * cb_map_clientdata;
804
/** Callback function that is invoked on the target node when a message
805
* is received and when the message completed.
811
* message complete flag
812
* \c cb_notify clientdata
814
void (*cb_notify) (void *, unsigned, unsigned, unsigned, unsigned, void *);
816
/** Clientdata for the \c cb_notify callback function */
817
void * cb_notify_clientdata;
819
/** Callback function that is invoked to acquire a lock resource.
821
* Lock request information [in]
822
* \c cb_lock clientdata [in]
823
* Lock identifier -OR- Lock key [out]
825
* \c 0 if the lock was not acquired
827
unsigned (*cb_lock) (BGQuad *, void *, BGQuad *);
829
/** Clientdata for the \c cb_lock callback function */
830
void * cb_lock_clientdata;
832
/** Callback function that is invoked to release a lock resource.
834
* Lock key information [in]
835
* \c cb_unlock clientdata [in]
837
* Lock identifier associated with this key information
839
BGQuad (*cb_unlock) (BGQuad *, void *);
841
/** Clientdata for the \c cb_lock callback function */
842
void * cb_unlock_clientdata;
845
/** One-sided communication consistency model */
846
BG1S_ConsistencyModel consistency;
848
BG1S_Configuration_t;
852
* \brief Configure one-sided communication.
854
* \param[in] configuration If \c NULL the configuration is not updated.
856
* \return The current configuration.
859
BG1S_Configuration_t BG1S_Configure (BG1S_Configuration_t * configuration);
863
* \brief Returns an elapsed time on the calling processor.
865
* \return Time in seconds since an arbitrary time in the past.
871
/* ********************************************************************* */
873
/* Collective communication on tree and GI network */
875
/* ********************************************************************* */
878
* \brief Opaque data type that holds GI message requests.
879
* The external API does not reveal the internal structure of the object.
882
typedef BGQuad BGGI_t[32];
885
* \brief global interrupt barrier
887
* \note Assert if global interrupts are not available.
889
* \note do we need a non-blocking version? probably yes.
892
void BGGI_Barrier ();
895
* \brief tree barrier
896
* \param pclass: class route used for operation
899
void BGTr_Barrier (int pclass);
902
* \brief start tree barrier operation
904
* \param pclass: class route used for operation
907
void BGTr_Barrier_start (const BGML_Callback_t * cb_info, int pclass);
911
* \brief tree broadcast
913
* \param buffer: broadcast data buffer
914
* \param nbytes: number of bytes broadcast
915
* \param pclass: class route used for operation
918
void BGTr_Bcast (int root, void *buffer, int nbytes, int pclass);
921
* \brief start tree broadcast operation
923
* \param buffer broadcast data buffer
924
* \param nbytes number of bytes broadcast
925
* \param pclass class route used for operation
928
void BGTr_Bcast_start (const BGML_Callback_t * cb_info,
929
void *buffer, int nbytes, int pclass);
932
* \brief tree allreduce
933
* \param sbuffer: send buffer holding non-reduced input data
934
* \param rbuffer: receive buffer, holds results
935
* \param count: number of entries in buffer
936
* \param dt: data type of operation
937
* \param op: reduce operation
938
* \param root: -1 if allreduce, root if reduction
939
* \param pclass: class route used for operation
942
void BGTr_Allreduce (const void *sbuffer,
945
BGML_Dt dt, BGML_Op op, int root, unsigned pclass);
948
* \brief start tree allreduce operation
950
* \param sbuffer: send buffer holding non-reduced input data
951
* \param rbuffer: receive buffer, holds results
952
* \param count: number of entries in buffer
953
* \param dt: data type of operation
954
* \param op: reduce operation
956
* \param pclass: class route used for operation
959
void BGTr_Allreduce_start (const BGML_Callback_t * cb_info,
964
BGML_Op op, int root, unsigned pclass);
967
* \brief Configure the tree network.
970
void BGTr_Configure (unsigned use_coprocessor,
971
unsigned protocolTreshold, unsigned highPrecision);
973
/* ********************************************************************* */
975
/* Collective communication on torus */
977
/* ********************************************************************* */
980
* \brief Opaque data type for torus collective barrier communication.
983
typedef BGQuad BGTsC_Barrier_t[64];
986
* \brief Opaque data type for torus collective alltoallv communication.
989
typedef BGQuad BGTsC_Alltoallv_t[1];
992
* \brief Initialize a general purpose barrier on the torus.
993
* \param commID: communicator ID, 0 <= ID < N (what is N?)
994
* \param numproc: number of processors participating in barrier
995
* \param ranks: [SORTED] list of all ranks participating in barrier.
996
* Every process initializing a barrier has to specify the same list.
997
* No checking is done to ensure the compatibility of the lists.
1000
void BGTsC_Barrier_Init (BGTsC_Barrier_t * request,
1002
unsigned numproc, unsigned *ranks);
1005
* \brief Start execution of a general purpose barrier.
1007
* Calling this function while a barrier is underway results in
1008
* undefined behavior.
1010
* \param commID: communicator ID, 0 <= ID < N (what is N?)
1014
void BGTsC_Barrier_Start (unsigned commID, const BGML_Callback_t * cb);
1017
* \brief Execute a general purpose barrier.
1019
* \param commID: communicator ID, 0 <= ID < N (what is N?)
1021
void BGTsC_Barrier (unsigned commID);
1024
* \brief Torus alltoallv
1036
* \param sndcounters
1037
* \param rcvcounters
1040
void BGTsC_Alltoallv_start (BGTsC_Alltoallv_t * request,
1041
const BGML_Callback_t * cb,
1043
const unsigned numproc,
1044
const unsigned *ranks,
1046
const unsigned *sndlens,
1047
const unsigned *sdispls,
1049
const unsigned *rcvlens,
1050
const unsigned *rdispls,
1051
unsigned *sndcounters,
1052
unsigned *rcvcounters);
1054
/* ********************************************************************* */
1056
/* Collectives on rectangular communicators on torus. */
1058
/* ********************************************************************* */
1061
* \brief Opaque data type for torus rectangular barrier communicator.
1064
typedef BGQuad BGTsRC_Barrier_t[1];
1067
* \brief Opaque data type for torus rectangular broadcast communicator.
1070
typedef BGQuad BGTsRC_Bcast_t[1];
1073
* \brief Opaque data type for torus rectangular allreduce communicator.
1076
typedef BGQuad BGTsRC_Allreduce_t[1];
1079
* \brief Torus rectangular communicator geometry
1082
typedef struct BGTsRC_Geometry_t
1084
unsigned x0; /**< lower left corner, x coordinate */
1085
unsigned y0; /**< lower left corner, y coordinate */
1086
unsigned z0; /**< lower left corner, z coordinate */
1087
unsigned t0; /**< lower left corner, t coordinate */
1088
unsigned xs; /**< x dimension */
1089
unsigned ys; /**< y dimension */
1090
unsigned zs; /**< z dimension */
1091
unsigned ts; /**< t dimension */
1092
unsigned xr; /**< x root (for bcast, reduce) */
1093
unsigned yr; /**< y root (for bcast, reduce) */
1094
unsigned zr; /**< z root (for bcast, reduce) */
1095
unsigned tr; /**< t root (for bcast, reduce) */
1100
* \brief Start execution of a torus rectangular communicator barrier.
1104
* \param commID: communicator ID, 0 <= ID < N (what is N?)
1108
void BGTsRC_Barrier_start (BGTsRC_Barrier_t * request,
1109
const BGML_Callback_t * cb_info,
1111
const BGTsRC_Geometry_t * geometry);
1114
* \brief Start execution of a torus rectangular communicator broadcast.
1118
* \param commID: communicator ID, 0 <= ID < N (what is N?)
1125
void BGTsRC_Bcast_start (BGTsRC_Bcast_t * request,
1126
const BGML_Callback_t * cb_info,
1128
const BGTsRC_Geometry_t * geometry,
1129
unsigned root, char *buffer, unsigned buflen);
1132
* \brief Start execution of a torus rectangular communicator alltoallv.
1136
* \param commID: communicator ID, 0 <= ID < N (what is N?)
1145
void BGTsRC_Allreduce_start (BGTsRC_Allreduce_t * request,
1146
const BGML_Callback_t * cb_info,
1148
const BGTsRC_Geometry_t * geometry,
1149
const void *sbuffer,
1151
unsigned count, BGML_Dt dt, BGML_Op op);
1156
/* ********************************************************************* */
1158
/* Data types and operation types */
1160
/* ********************************************************************* */
1163
* \brief Structure for the \b BGML_SINGLE_COMPLEX datatype
1166
typedef struct cmplx64_t
1168
float real; /**< Real part of the complex number */
1169
float imaginary; /**< Imaginary part of the complex number */
1173
* \brief Structure for the \b BGML_DOUBLE_COMPLEX datatype
1176
typedef struct cmplx128_t
1178
double real; /**< Real part of the complex number */
1179
double imaginary; /**< Imaginary part of the complex number */
1183
* \brief Structure for the \b BGML_2INT datatype
1186
typedef struct int32int32_t
1188
int32_t primary; /**< Primary part */
1189
int32_t secondary; /**< Secondary part */
1193
* \brief Structure for the \b BGML_SHORT_INT datatype
1196
typedef struct int16int32_t
1198
int16_t primary; /**< Primary part */
1199
int32_t secondary; /**< Secondary part */
1203
* \brief Structure for the \b BGML_FLOAT_INT datatype
1206
typedef struct fp32int32_t
1208
float primary; /**< Primary part */
1209
int32_t secondary; /**< Secondary part */
1213
* \brief Structure for the \b BGML_DOUBLE_INT datatype
1216
typedef struct fp64int32_t
1218
double primary; /**< Primary part */
1219
int32_t secondary; /**< Secondary part */
1223
* \brief Structure for the \b BGML_2REAL datatype
1226
typedef struct fp32fp32_t
1228
float primary; /**< Primary part */
1229
float secondary; /**< Secondary part */
1233
* \brief Structure for the \b BGML_2DOUBLE_PRECISION datatype
1236
typedef struct fp64fp64_t
1238
double primary; /**< Primary part */
1239
double secondary; /**< Secondary part */
1243
* \brief Array to quickly look up the data size of a data type.
1246
extern unsigned BGML_DatatypeSize[];