File: comex.h

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (715 lines) | stat: -rw-r--r-- 22,342 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
/* comex header file */
#ifndef _COMEX_H
#define _COMEX_H

#include <mpi.h>

#include <stdlib.h>

#if defined(__cplusplus) || defined(c_plusplus)
extern "c" {
#endif

typedef struct {
    void **src; /**< array of source starting addresses */
    void **dst; /**< array of destination starting addresses */
    int count; /**< size of address arrays (src[count],dst[count]) */
    int bytes; /**< length in bytes for each src[i]/dst[i] pair */
} comex_giov_t;

typedef int comex_request_t;

typedef int comex_group_t;

#define COMEX_GROUP_WORLD 0
#define COMEX_GROUP_NULL -1

#define COMEX_SUCCESS 0
#define COMEX_FAILURE 1

#define COMEX_SWAP 10
#define COMEX_SWAP_LONG 11
#define COMEX_FETCH_AND_ADD 12
#define COMEX_FETCH_AND_ADD_LONG 13

#define COMEX_ACC_OFF 36
#define COMEX_ACC_INT (COMEX_ACC_OFF + 1)
#define COMEX_ACC_DBL (COMEX_ACC_OFF + 2)
#define COMEX_ACC_FLT (COMEX_ACC_OFF + 3)
#define COMEX_ACC_CPL (COMEX_ACC_OFF + 4)
#define COMEX_ACC_DCP (COMEX_ACC_OFF + 5)
#define COMEX_ACC_LNG (COMEX_ACC_OFF + 6)

#define COMEX_MAX_STRIDE_LEVEL 8

/**
 * Initialize comex.
 *
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_init();

/**
 * Initialize comex with command line arguments.
 *
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_init_args(int *argc, char ***argv);

/**
 * Initialize comex with an externally supplied communicator.
 *
 * @param[in] comm external communicator.
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_init_comm(MPI_Comm);

/**
 * Test whether comex has been initialized.
 *
 * @return COMEX_SUCCESS if comex has been initialized
 *         COMEX_FAILURE if comex has not
 */
extern int comex_initialized();

/**
 * Terminate comex and clean up resources.
 *
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_finalize();

/**
 * Abort comex, printing the msg, and exiting with code.
 *
 * @param[in] msg the message to print
 * @param[in] code the code to exit with
 */
extern void comex_error(const char *msg, int code);

/**
 * Create a new group from the given group and process ID list.
 *
 * The rank list selects the ranks from the given group to become members of
 * the new group. The ranks should be nonnegative and range from zero to the
 * size of the given group.
 *
 * This functions is collective only over the ranks within the rank list and
 * not over the entire original group.
 *
 * @param[in] n the number of ranks to select for the new group
 * @param[in] rank_list the list of ranks to select for the new group
 * @param[in] group the group to subset for the new group
 * @param[out] new_group the newly created group
 * @return COMEX_SUCCESS on success
 *         COMEX_FAILURE if a rank in the rank list is out of bounds
 */
extern int comex_group_create(
        int n, int *pid_list, comex_group_t group, comex_group_t *new_group);

/**
 * Marks the group for deallocation.
 *
 * @param[in] group group to be destroyed
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_free(comex_group_t group);

/**
 * Determines the rank of the calling process in the given group.
 *
 * @param[in] group group handle
 * @param[out] rank rank of the calling process in the group
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_rank(comex_group_t group, int *rank);

/**
 * Determines the size of the given group.
 *
 * @param[in] group group handle
 * @param[out] size number of processes in the group
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_size(comex_group_t group, int *size);

/**
 * Returns the MPI_Comm object backing the given group.
 *
 * The actual MPI_Comm object is returned, therefore do not call
 * MPI_Comm_free() on the returned communicator. This function is for
 * convenience to be able to MPI_Comm_dup() the returned MPI_Comm instance.
 *
 * @param[in] group group handle
 * @param[out] comm the communicator handle
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_comm(comex_group_t group, MPI_Comm *comm);

/**
 * Translates the ranks of processes in one group to those in another group.
 *
 * @param[in] n the number of ranks in the ranks_from and ranks_to arrays
 * @param[in] group_from the group to translate ranks from 
 * @param[in] ranks_from array of zer or more valid ranks in group_from
 * @param[in] group_to the group to translate ranks to 
 * @param[out] ranks_to array of corresponding ranks in group_to
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_translate_ranks(int n,
        comex_group_t group_from, int *ranks_from,
        comex_group_t group_to, int *ranks_to);

/**
 * Translate the given rank from its group to its corresponding rank in the
 * world group.
 *
 * Shorthand notation for common case.
 *
 * @param[in] group the group to translate from
 * @param[in] group_rank the rank to translate from
 * @param[out] world_rank the corresponding world rank
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_group_translate_world(
        comex_group_t group, int group_rank, int *world_rank);

/**
 * A collective communication and operations barrier.
 *
 * Ensures all comex communication has completed prior to performing the
 * operations barrier.
 *
 * @param[in] group the group to perform the collective barrier over
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_barrier(comex_group_t group);

/**
 * Contiguous Put.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_put(
        void *src, void *dst, int bytes,
        int proc, comex_group_t group);

/**
 * Strided Put.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride array of strides at destination
 * @param[in] count number of units at each stride level count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_puts(
        void *src, int *src_stride,
        void *dst, int *dst_stride,
        int *count, int stride_levels,
        int proc, comex_group_t group);

/**
 * Vector Put.
 *
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_putv(
        comex_giov_t *darr, int len,
        int proc, comex_group_t group);

/**
 * Nonblocking Contiguous Put.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_nbput(
        void *src, void *dst, int bytes,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Nonblocking Strided Put.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride array of strides at destination
 * @param[in] count number of units at each stride level count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbputs(
        void *src, int *src_stride,
        void *dst, int *dst_stride,
        int *count, int stride_levels,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Nonblocking Vector Put.
 *
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbputv(
        comex_giov_t *darr, int len,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Contiguous Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_acc(
        int op, void *scale,
        void *src, void *dst, int bytes,
        int proc, comex_group_t group);

/**
 * Strided Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride [stride_levels] array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride [stride_levels] array of strides at destination
 * @param[in] count [stride_levels+1] number of units at each stride level
 *            count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_accs(
        int op, void *scale,
        void *src, int *src_stride,
        void *dst, int *dst_stride,
        int *count, int stride_levels,
        int proc, comex_group_t group);

/**
 * Vector Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_accv(
        int op, void *scale,
        comex_giov_t *darr, int len,
        int proc, comex_group_t group);

/**
 * Nonblocking Contiguous Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbacc(
        int op, void *scale,
        void *src, void *dst, int bytes,
        int proc, comex_group_t group,
        comex_request_t *nb_handle);

/**
 * Strided Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride array of strides at destination
 * @param[in] count number of units at each stride level count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbaccs(
        int  op, void *scale,
        void *src, int *src_stride,
		void *dst, int *dst_stride,
		int *count, int stride_levels,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Vector Atomic Accumulate.
 *
 * @param[in] op operation
 * @param[in] scale factor x += scale*y
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbaccv(
        int op, void *scale,
        comex_giov_t *darr, int len,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Contiguous Get.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_get(
        void *src, void *dst, int bytes,
        int proc, comex_group_t group);

/**
 * Strided Get.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride array of strides at destination
 * @param[in] count number of units at each stride level count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_gets(
        void *src, int *src_stride,
        void *dst, int *dst_stride,
        int *count, int stride_levels,
        int proc, comex_group_t group);

/**
 * Vector Get.
 *
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @return COMEX_SUCCESS on success
 */
extern int comex_getv(
        comex_giov_t *darr, int len,
        int proc, comex_group_t group);

/**
 * Nonblocking Contiguous Get.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] bytes number of bytes to transfer
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_nbget(
        void *src, void *dst, int bytes,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Nonblocking Strided Get.
 *
 * @param[in] src pointer to 1st segment at source
 * @param[in] src_stride array of strides at source
 * @param[in] dst pointer to 1st segment at destination
 * @param[in] dst_stride array of strides at destination
 * @param[in] count number of units at each stride level count[0]=bytes
 * @param[in] stride_levels number of stride levels
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbgets(
        void *src, int *src_stride,
		void *dst, int *dst_stride,
		int *count, int stride_levels,
        int proc, comex_group_t group,
        comex_request_t *nb_handler);

/**
 * Nonblocking Vector Get.
 *
 * @param[in] darr descriptor array
 * @param[in] len length of descriptor array
 * @param[in] proc remote process(or) id
 * @param[in] group the calling process and remote process must belong to the
 *            same group
 * @param[out] nb_handle nonblocking request object
 * @return COMEX_SUCCESS on success
 */
extern int comex_nbgetv(
        comex_giov_t *darr, int len,
        int proc, comex_group_t group,
        comex_request_t* nb_handle);

/**
 * Collective allocation of registered memory and exchange of addresses.
 *
 * @param[out] ptr_arr array of memory addresses
 *             w.r.t. each process's address space
 * @param[in] bytes how many bytes to allocate locally
 * @param[in] group the group to which the calling process belongs
 * @return COMEX_SUCCESS on success
 */
extern int comex_malloc(
        void **ptr_arr, size_t bytes, comex_group_t group);

/**
 * Collective allocation of registered memory and exchange of addresses on
 * a specified memory device.
 *
 * @param[out] ptr_arr array of memory addresses
 *             w.r.t. each process's address space
 * @param[in] bytes how many bytes to allocate locally
 * @param[in] group the group to which the calling process belongs
 * @param[in] device character string describing memory device
 * @return COMEX_SUCCESS on success
 */
extern int comex_malloc_mem_dev(
        void **ptr_arr, size_t bytes, comex_group_t group, const char *device);

/**
 * Collective free of memory given the original local pointer.
 *
 * @param[in] ptr the original local memory allocated using comex_malloc
 * @param[in] group the group to which the calling process belongs
 * @return COMEX_SUCCESS on success
 */
extern int comex_free(void *ptr, comex_group_t group);

/**
 * Collective free of memory on a specified device given the original local pointer.
 *
 * @param[in] ptr the original local memory allocated using comex_malloc
 * @param[in] group the group to which the calling process belongs
 * @return COMEX_SUCCESS on success
 */
extern int comex_free_dev(void *ptr, comex_group_t group);

/**
 * Local (noncollective) allocation of registered memory.
 *
 * Using memory allocated here may have performance benefits when used as a
 * communication buffer.
 *
 * @param[in] bytes how many bytes to allocate locally
 * @return COMEX_SUCCESS on success
 */
extern void* comex_malloc_local(size_t bytes);

/**
 * Local (noncollective) free of memory allocated by comex_malloc_local.
 *
 * @param[in] the original local memory allocated using comex_malloc_local
 * @return COMEX_SUCCESS on success
 */
extern int comex_free_local(void *ptr);

/**
 * Flush all outgoing messages from me to the given proc.
 *
 * @param[in] proc the proc with which to flush outgoing messages
 * @return COMEX_SUCCESS on success
 */
extern int comex_fence_proc(int proc, comex_group_t group);

/**
 * Flush all outgoing messages to all procs.
 *
 * @return COMEX_SUCCESS on success
 */
extern int comex_fence_all(comex_group_t group);

/**
 * Collectively create num locks locally.
 *
 * Remote procs may create a different number of locks, including zero.
 *
 * This function is always collective on the world group.
 *
 * @param[in] num number of locks to create locally
 * @return COMEX_SUCCESS on success
 */
extern int comex_create_mutexes(int num);

/**
 * Collectively destroy all previously created locks.
 *
 * This function is always collective on the world group.
 *
 * @param[in] num number of locks to create locally
 * @return COMEX_SUCCESS on success
 */
extern int comex_destroy_mutexes();

/**
 * Lock the given mutex on the given proc.
 *
 * This function is always on the world group.
 *
 * @param[in] mutex the ID of the mutex to lock on proc
 * @param[in] the ID of the proc which owns the mutex
 *
 * @return COMEX_SUCCESS on success
 *         COMEX_FAILURE if given mutex or proc is out of range
 */
extern int comex_lock(int mutex, int proc);

/**
 * Unlock the given mutex on the given proc.
 *
 * This function is always on the world group.
 *
 * @param[in] mutex the ID of the mutex to unlock on proc
 * @param[in] the ID of the proc which owns the mutex
 *
 * @return COMEX_SUCCESS on success
 *         COMEX_FAILURE if given mutex or proc is out of range
 */
extern int comex_unlock(int mutex, int proc);

/**
 * Read-modify-write atomic operation.
 *
 * The operations may be one of
 *  - COMEX_SWAP
 *  - COMEX_SWAP_LONG
 *  - COMEX_FETCH_AND_ADD
 *  - COMEX_FETCH_AND_ADD_LONG
 *
 * For the swap operations, the extra parameter is not used. The values of the
 * ploc and prem locations are swapped.
 *
 * For the fetch and add operations, the extra parameter is also used to
 * indicate how much to increment the remote value. The original remove value
 * is returned in the ploc parameter.
 *
 * @param[in] op the operation to perform (see list above)
 * @param[in] ploc the value to update locally
 * @param[in] prem the value to update remotely
 * @param[in] extra for COMEX_FETCH_AND_ADD and COMEX_FETCH_AND_ADD_LONG, the
 *            amount to increment the remote value by
 * @param[in] proc remote process(or) id
 * @param[in] group group handle
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_rmw(
        int op, void *ploc, void *prem, int extra,
        int proc, comex_group_t group);

/**
 * Waits for completion of non-blocking comex operations with explicit handles.
 *
 * @param[in] nb_handle the handle
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_wait(comex_request_t *nb_handle);

/**
 * Checks completion status of non-blocking comex operations with explicit
 * handles.
 *
 * @param[in] nb_handle the handle
 * @param[out] status 0-completed, 1-in progress
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_test(comex_request_t *nb_handle, int *status);

/**
 * Wait for all outstanding implicit non-blocking operations to finish.
 *
 * @param[in] group group handle
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_wait_all(comex_group_t group);

/**
 * Wait for all outstanding implicit non-blocking operations to a particular
 * process to finish.
 *
 * @param[in] proc proc for which all the outstanding non-blocking operations
 * have to be completed
 * @param[in] group group handle
 * @return COMEX_SUCCESS on sucess
 */
extern int comex_wait_proc(int proc, comex_group_t group);

#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

#endif /* _COMEX_H */