-
Notifications
You must be signed in to change notification settings - Fork 434
/
Copy pathucp.h
3829 lines (3507 loc) · 161 KB
/
ucp.h
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
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
* Copyright (C) UT-Battelle, LLC. 2014-2017. ALL RIGHTS RESERVED.
* Copyright (C) ARM Ltd. 2016-2017. ALL RIGHTS RESERVED.
* Copyright (C) Los Alamos National Security, LLC. 2018 ALL RIGHTS RESERVED.
* See file LICENSE for terms.
*/
#ifndef UCP_H_
#define UCP_H_
#include <ucp/api/ucp_def.h>
#include <ucp/api/ucp_compat.h>
#include <ucp/api/ucp_version.h>
#include <ucs/type/thread_mode.h>
#include <ucs/type/cpu_set.h>
#include <ucs/config/types.h>
#include <ucs/sys/compiler_def.h>
#include <ucs/memory/memory_type.h>
#include <stdio.h>
#include <sys/types.h>
BEGIN_C_DECLS
/**
* @defgroup UCP_API Unified Communication Protocol (UCP) API
* @{
* This section describes UCP API.
* @}
*/
/**
* @defgroup UCP_CONTEXT UCP Application Context
* @ingroup UCP_API
* @{
* Application context is a primary concept of UCP design which
* provides an isolation mechanism, allowing resources associated
* with the context to separate or share network communication context
* across multiple instances of applications.
*
* This section provides a detailed description of this concept and
* routines associated with it.
*
* @}
*/
/**
* @defgroup UCP_WORKER UCP Worker
* @ingroup UCP_API
* @{
* UCP Worker routines
* @}
*/
/**
* @defgroup UCP_MEM UCP Memory routines
* @ingroup UCP_API
* @{
* UCP Memory routines
* @}
*/
/**
* @defgroup UCP_WAKEUP UCP Wake-up routines
* @ingroup UCP_API
* @{
* UCP Wake-up routines
* @}
*/
/**
* @defgroup UCP_ENDPOINT UCP Endpoint
* @ingroup UCP_API
* @{
* UCP Endpoint routines
* @}
*/
/**
* @defgroup UCP_COMM UCP Communication routines
* @ingroup UCP_API
* @{
* UCP Communication routines
* @}
*/
/**
* @defgroup UCP_CONFIG UCP Configuration
* @ingroup UCP_API
* @{
* This section describes routines for configuration
* of the UCP network layer
* @}
*/
/**
* @defgroup UCP_DATATYPE UCP Data type routines
* @ingroup UCP_API
* @{
* UCP Data type routines
* @}
*/
/**
* @ingroup UCP_CONTEXT
* @brief UCP context parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_params_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_params_field {
UCP_PARAM_FIELD_FEATURES = UCS_BIT(0), /**< features */
UCP_PARAM_FIELD_REQUEST_SIZE = UCS_BIT(1), /**< request_size */
UCP_PARAM_FIELD_REQUEST_INIT = UCS_BIT(2), /**< request_init */
UCP_PARAM_FIELD_REQUEST_CLEANUP = UCS_BIT(3), /**< request_cleanup */
UCP_PARAM_FIELD_TAG_SENDER_MASK = UCS_BIT(4), /**< tag_sender_mask */
UCP_PARAM_FIELD_MT_WORKERS_SHARED = UCS_BIT(5), /**< mt_workers_shared */
UCP_PARAM_FIELD_ESTIMATED_NUM_EPS = UCS_BIT(6), /**< estimated_num_eps */
UCP_PARAM_FIELD_ESTIMATED_NUM_PPN = UCS_BIT(7) /**< estimated_num_ppn */
};
/**
* @ingroup UCP_CONTEXT
* @brief UCP configuration features
*
* The enumeration list describes the features supported by UCP. An
* application can request the features using @ref ucp_params_t "UCP parameters"
* during @ref ucp_init "UCP initialization" process.
*/
enum ucp_feature {
UCP_FEATURE_TAG = UCS_BIT(0), /**< Request tag matching
support */
UCP_FEATURE_RMA = UCS_BIT(1), /**< Request remote memory
access support */
UCP_FEATURE_AMO32 = UCS_BIT(2), /**< Request 32-bit atomic
operations support */
UCP_FEATURE_AMO64 = UCS_BIT(3), /**< Request 64-bit atomic
operations support */
UCP_FEATURE_WAKEUP = UCS_BIT(4), /**< Request interrupt
notification support */
UCP_FEATURE_STREAM = UCS_BIT(5), /**< Request stream support */
UCP_FEATURE_AM = UCS_BIT(6) /**< Request Active Message
support */
};
/**
* @ingroup UCP_WORKER
* @brief UCP worker parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_worker_params_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_worker_params_field {
UCP_WORKER_PARAM_FIELD_THREAD_MODE = UCS_BIT(0), /**< UCP thread mode */
UCP_WORKER_PARAM_FIELD_CPU_MASK = UCS_BIT(1), /**< Worker's CPU bitmap */
UCP_WORKER_PARAM_FIELD_EVENTS = UCS_BIT(2), /**< Worker's events bitmap */
UCP_WORKER_PARAM_FIELD_USER_DATA = UCS_BIT(3), /**< User data */
UCP_WORKER_PARAM_FIELD_EVENT_FD = UCS_BIT(4) /**< External event file
descriptor */
};
/**
* @ingroup UCP_WORKER
* @brief UCP listener parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_listener_params_t
* are present. It is used to enable backward compatibility support.
*/
enum ucp_listener_params_field {
/**
* Sock address and length.
*/
UCP_LISTENER_PARAM_FIELD_SOCK_ADDR = UCS_BIT(0),
/**
* User's callback and argument for handling the creation of an endpoint.
* */
UCP_LISTENER_PARAM_FIELD_ACCEPT_HANDLER = UCS_BIT(1),
/**< User's callback and argument for handling the incoming connection
* request. */
UCP_LISTENER_PARAM_FIELD_CONN_HANDLER = UCS_BIT(2)
};
/**
* @ingroup UCP_WORKER
* @brief UCP worker address flags.
*
* The enumeration list describes possible UCP worker address flags, indicating
* what needs to be included to the worker address returned by
* @ref ucp_worker_query "ucp_worker_query()" routine.
*/
typedef enum {
/**< Pack addresses of network devices only. Using such shortened addresses
* for the remote node peers will reduce the amount of wireup data being
* exchanged during connection establishment phase. */
UCP_WORKER_ADDRESS_FLAG_NET_ONLY = UCS_BIT(0)
} ucp_worker_address_flags_t;
/**
* @ingroup UCP_ENDPOINT
* @brief UCP endpoint parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_ep_params_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_ep_params_field {
UCP_EP_PARAM_FIELD_REMOTE_ADDRESS = UCS_BIT(0), /**< Address of remote
peer */
UCP_EP_PARAM_FIELD_ERR_HANDLING_MODE = UCS_BIT(1), /**< Error handling mode.
@ref ucp_err_handling_mode_t */
UCP_EP_PARAM_FIELD_ERR_HANDLER = UCS_BIT(2), /**< Handler to process
transport level errors */
UCP_EP_PARAM_FIELD_USER_DATA = UCS_BIT(3), /**< User data pointer */
UCP_EP_PARAM_FIELD_SOCK_ADDR = UCS_BIT(4), /**< Socket address field */
UCP_EP_PARAM_FIELD_FLAGS = UCS_BIT(5), /**< Endpoint flags */
UCP_EP_PARAM_FIELD_CONN_REQUEST = UCS_BIT(6) /**< Connection request field */
};
/**
* @ingroup UCP_ENDPOINT
* @brief UCP endpoint parameters flags.
*
* The enumeration list describes the endpoint's parameters flags supported by
* @ref ucp_ep_create() function.
*/
enum ucp_ep_params_flags_field {
UCP_EP_PARAMS_FLAGS_CLIENT_SERVER = UCS_BIT(0), /**< Using a client-server
connection establishment
mechanism.
@ref ucs_sock_addr_t
sockaddr field
must be provided and
contain the address
of the remote peer */
UCP_EP_PARAMS_FLAGS_NO_LOOPBACK = UCS_BIT(1) /**< Avoid connecting the
endpoint to itself when
connecting the endpoint
to the same worker it
was created on.
Affects protocols which
send to a particular
remote endpoint, for
example stream */
};
/**
* @ingroup UCP_ENDPOINT
* @brief Close UCP endpoint modes.
*
* The enumeration is used to specify the behavior of @ref ucp_ep_close_nbx.
*/
typedef enum {
UCP_EP_CLOSE_FLAG_FORCE = UCS_BIT(0) /**< @ref ucp_ep_close_nbx releases
the endpoint without any
confirmation from the peer. All
outstanding requests will be
completed with
@ref UCS_ERR_CANCELED error.
@note This mode may cause
transport level errors on remote
side, so it requires set
@ref UCP_ERR_HANDLING_MODE_PEER
for all endpoints created on
both (local and remote) sides to
avoid undefined behavior. If this
flag is not set then
@ref ucp_ep_close_nbx schedules
flushes on all outstanding
operations. */
} ucp_ep_close_flags_t;
/**
* @ingroup UCP_ENDPOINT
* @brief Close UCP endpoint modes.
*
* The enumeration is used to specify the behavior of @ref ucp_ep_close_nb.
*/
enum ucp_ep_close_mode {
UCP_EP_CLOSE_MODE_FORCE = 0, /**< @ref ucp_ep_close_nb releases
the endpoint without any
confirmation from the peer. All
outstanding requests will be
completed with
@ref UCS_ERR_CANCELED error.
@note This mode may cause
transport level errors on remote
side, so it requires set
@ref UCP_ERR_HANDLING_MODE_PEER
for all endpoints created on
both (local and remote) sides to
avoid undefined behavior. */
UCP_EP_CLOSE_MODE_FLUSH = 1 /**< @ref ucp_ep_close_nb schedules
flushes on all outstanding
operations. */
};
/**
* @ingroup UCP_MEM
* @brief UCP memory mapping parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_mem_map_params_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_mem_map_params_field {
UCP_MEM_MAP_PARAM_FIELD_ADDRESS = UCS_BIT(0), /**< Address of the memory that
will be used in the
@ref ucp_mem_map routine. */
UCP_MEM_MAP_PARAM_FIELD_LENGTH = UCS_BIT(1), /**< The size of memory that
will be allocated or
registered in the
@ref ucp_mem_map routine.*/
UCP_MEM_MAP_PARAM_FIELD_FLAGS = UCS_BIT(2) /**< Allocation flags. */
};
/**
* @ingroup UCP_MEM
* @brief UCP memory advice parameters field mask.
*
* The enumeration allows specifying which fields in @ref ucp_mem_advise_params_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_mem_advise_params_field {
UCP_MEM_ADVISE_PARAM_FIELD_ADDRESS = UCS_BIT(0), /**< Address of the memory */
UCP_MEM_ADVISE_PARAM_FIELD_LENGTH = UCS_BIT(1), /**< The size of memory */
UCP_MEM_ADVISE_PARAM_FIELD_ADVICE = UCS_BIT(2) /**< Advice on memory usage */
};
/**
* @ingroup UCP_CONTEXT
* @brief UCP context attributes field mask.
*
* The enumeration allows specifying which fields in @ref ucp_context_attr_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_context_attr_field {
UCP_ATTR_FIELD_REQUEST_SIZE = UCS_BIT(0), /**< UCP request size */
UCP_ATTR_FIELD_THREAD_MODE = UCS_BIT(1), /**< UCP context thread flag */
UCP_ATTR_FIELD_MEMORY_TYPES = UCS_BIT(2) /**< UCP supported memory types */
};
/**
* @ingroup UCP_WORKER
* @brief UCP worker attributes field mask.
*
* The enumeration allows specifying which fields in @ref ucp_worker_attr_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_worker_attr_field {
UCP_WORKER_ATTR_FIELD_THREAD_MODE = UCS_BIT(0), /**< UCP thread mode */
UCP_WORKER_ATTR_FIELD_ADDRESS = UCS_BIT(1), /**< UCP address */
UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS = UCS_BIT(2) /**< UCP address flags */
};
/**
* @ingroup UCP_WORKER
* @brief UCP listener attributes field mask.
*
* The enumeration allows specifying which fields in @ref ucp_listener_attr_t are
* present. It is used to enable backward compatibility support.
*/
enum ucp_listener_attr_field {
UCP_LISTENER_ATTR_FIELD_SOCKADDR = UCS_BIT(0) /**< Sockaddr used for listening */
};
/**
* @ingroup UCP_WORKER
* @brief UCP listener's connection request attributes field mask.
*
* The enumeration allows specifying which fields in @ref ucp_conn_request_attr_t
* are present. It is used to enable backward compatibility support.
*/
enum ucp_conn_request_attr_field {
UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ADDR = UCS_BIT(0) /**< Client's address */
};
/**
* @ingroup UCP_DATATYPE
* @brief UCP data type classification
*
* The enumeration list describes the datatypes supported by UCP.
*/
enum ucp_dt_type {
UCP_DATATYPE_CONTIG = 0, /**< Contiguous datatype */
UCP_DATATYPE_STRIDED = 1, /**< Strided datatype */
UCP_DATATYPE_IOV = 2, /**< Scatter-gather list with multiple pointers */
UCP_DATATYPE_GENERIC = 7, /**< Generic datatype with
user-defined pack/unpack routines */
UCP_DATATYPE_SHIFT = 3, /**< Number of bits defining
the datatype classification */
UCP_DATATYPE_CLASS_MASK = UCS_MASK(UCP_DATATYPE_SHIFT) /**< Data-type class
mask */
};
/**
* @ingroup UCP_MEM
* @brief UCP memory mapping flags.
*
* The enumeration list describes the memory mapping flags supported by @ref
* ucp_mem_map() function.
*/
enum {
UCP_MEM_MAP_NONBLOCK = UCS_BIT(0), /**< Complete the mapping faster, possibly by
not populating the pages in the mapping
up-front, and mapping them later when
they are accessed by communication
routines. */
UCP_MEM_MAP_ALLOCATE = UCS_BIT(1), /**< Identify requirement for allocation,
if passed address is not a null-pointer
then it will be used as a hint or direct
address for allocation. */
UCP_MEM_MAP_FIXED = UCS_BIT(2) /**< Don't interpret address as a hint:
place the mapping at exactly that
address. The address must be a multiple
of the page size. */
};
/**
* @ingroup UCP_WORKER
* @brief Flags for a UCP Active Message callback.
*
* Flags that indicate how to handle UCP Active Messages
* Currently only UCP_AM_FLAG_WHOLE_MSG is supported,
* which indicates the entire message is handled in one
* callback.
*/
enum ucp_am_cb_flags {
UCP_AM_FLAG_WHOLE_MSG = UCS_BIT(0)
};
/**
* @ingroup UCP_WORKER
* @brief Flags for sending a UCP Active Message.
*
* Flags dictate the behavior of ucp_am_send_nb
* currently the only flag tells UCP to pass in
* the sending endpoint to the call
* back so a reply can be defined.
*/
enum ucp_send_am_flags {
UCP_AM_SEND_REPLY = UCS_BIT(0)
};
/**
* @ingroup UCP_ENDPOINT
* @brief Descriptor flags for Active Message callback.
*
* In a callback, if flags is set to UCP_CB_PARAM_FLAG_DATA in
* a callback then data was allocated, so if UCS_INPROGRESS is
* returned from the callback, the data parameter will persist
* and the user has to call @ref ucp_am_data_release when data is
* no longer needed.
*/
enum ucp_cb_param_flags {
UCP_CB_PARAM_FLAG_DATA = UCS_BIT(0)
};
/**
* @ingroup UCP_COMM
* @brief Atomic operation requested for ucp_atomic_post
*
* This enumeration defines which atomic memory operation should be
* performed by the ucp_atomic_post family of fuctions. All of these are
* non-fetching atomics and will not result in a request handle.
*/
typedef enum {
UCP_ATOMIC_POST_OP_ADD, /**< Atomic add */
UCP_ATOMIC_POST_OP_AND, /**< Atomic and */
UCP_ATOMIC_POST_OP_OR, /**< Atomic or */
UCP_ATOMIC_POST_OP_XOR, /**< Atomic xor */
UCP_ATOMIC_POST_OP_LAST
} ucp_atomic_post_op_t;
/**
* @ingroup UCP_COMM
* @brief Atomic operation requested for ucp_atomic_fetch
*
* This enumeration defines which atomic memory operation should be performed
* by the ucp_atomic_fetch family of functions. All of these functions
* will fetch data from the remote node.
*/
typedef enum {
UCP_ATOMIC_FETCH_OP_FADD, /**< Atomic Fetch and add */
UCP_ATOMIC_FETCH_OP_SWAP, /**< Atomic swap */
UCP_ATOMIC_FETCH_OP_CSWAP, /**< Atomic conditional swap */
UCP_ATOMIC_FETCH_OP_FAND, /**< Atomic Fetch and and */
UCP_ATOMIC_FETCH_OP_FOR, /**< Atomic Fetch and or */
UCP_ATOMIC_FETCH_OP_FXOR, /**< Atomic Fetch and xor */
UCP_ATOMIC_FETCH_OP_LAST
} ucp_atomic_fetch_op_t;
/**
* @ingroup UCP_COMM
* @brief Atomic operation requested for ucp_atomic_op_nbx
*
* This enumeration defines which atomic memory operation should be
* performed by the @ref ucp_atomic_op_nbx routine.
*/
typedef enum {
UCP_ATOMIC_OP_ADD, /**< Atomic add */
UCP_ATOMIC_OP_SWAP, /**< Atomic swap */
UCP_ATOMIC_OP_CSWAP, /**< Atomic conditional swap */
UCP_ATOMIC_OP_AND, /**< Atomic and */
UCP_ATOMIC_OP_OR, /**< Atomic or */
UCP_ATOMIC_OP_XOR, /**< Atomic xor */
UCP_ATOMIC_OP_LAST
} ucp_atomic_op_t;
/**
* @ingroup UCP_COMM
* @brief Flags to define behavior of @ref ucp_stream_recv_nb function
*
* This enumeration defines behavior of @ref ucp_stream_recv_nb function.
*/
typedef enum {
UCP_STREAM_RECV_FLAG_WAITALL = UCS_BIT(0) /**< This flag requests that
the operation will not be
completed until all
requested data is received
and placed in the user
buffer. */
} ucp_stream_recv_flags_t;
/**
* @ingroup UCP_COMM
* @brief UCP operation fields and flags
*
* The enumeration allows specifying which fields in @ref ucp_request_param_t are
* present and operation flags are used. It is used to enable backward
* compatibility support.
*/
typedef enum {
UCP_OP_ATTR_FIELD_REQUEST = UCS_BIT(0), /**< request field */
UCP_OP_ATTR_FIELD_CALLBACK = UCS_BIT(1), /**< cb field */
UCP_OP_ATTR_FIELD_USER_DATA = UCS_BIT(2), /**< user_data field */
UCP_OP_ATTR_FIELD_DATATYPE = UCS_BIT(3), /**< datatype field */
UCP_OP_ATTR_FIELD_FLAGS = UCS_BIT(4), /**< operation-specific flags */
UCP_OP_ATTR_FIELD_REPLY_BUFFER = UCS_BIT(5), /**< reply_buffer field */
UCP_OP_ATTR_FLAG_NO_IMM_CMPL = UCS_BIT(16), /**< deny immediate completion */
UCP_OP_ATTR_FLAG_FAST_CMPL = UCS_BIT(17), /**< expedite local completion,
even if it delays remote
data delivery. Note for
implementer: this option
can disable zero copy
and/or rendezvous protocols
which require
synchronization with the
remote peer before releasing
the local send buffer */
UCP_OP_ATTR_FLAG_FORCE_IMM_CMPL = UCS_BIT(18) /**< force immediate complete
operation, fail if the
operation cannot be
completed immediately */
} ucp_op_attr_t;
/**
* @ingroup UCP_DATATYPE
* @brief Generate an identifier for contiguous data type.
*
* This macro creates an identifier for contiguous datatype that is defined by
* the size of the basic element.
*
* @param [in] _elem_size Size of the basic element of the type.
*
* @return Data-type identifier.
*
* @note In case of partial receive, the buffer will be filled with integral
* count of elements.
*/
#define ucp_dt_make_contig(_elem_size) \
(((ucp_datatype_t)(_elem_size) << UCP_DATATYPE_SHIFT) | UCP_DATATYPE_CONTIG)
/**
* @ingroup UCP_DATATYPE
* @brief Generate an identifier for Scatter-gather IOV data type.
*
* This macro creates an identifier for datatype of scatter-gather list
* with multiple pointers
*
* @return Data-type identifier.
*
* @note In case of partial receive, @ref ucp_dt_iov_t::buffer can be filled
* with any number of bytes according to its @ref ucp_dt_iov_t::length.
*/
#define ucp_dt_make_iov() (UCP_DATATYPE_IOV)
/**
* @ingroup UCP_DATATYPE
* @brief Structure for scatter-gather I/O.
*
* This structure is used to specify a list of buffers which can be used
* within a single data transfer function call.
*
* @note If @a length is zero, the memory pointed to by @a buffer
* will not be accessed. Otherwise, @a buffer must point to valid memory.
*/
typedef struct ucp_dt_iov {
void *buffer; /**< Pointer to a data buffer */
size_t length; /**< Length of the @a buffer in bytes */
} ucp_dt_iov_t;
/**
* @ingroup UCP_DATATYPE
* @brief UCP generic data type descriptor
*
* This structure provides a generic datatype descriptor that
* is used for definition of application defined datatypes.
* Typically, the descriptor is used for an integration with datatype
* engines implemented within MPI and SHMEM implementations.
*
* @note In case of partial receive, any amount of received data is acceptable
* which matches buffer size.
*/
typedef struct ucp_generic_dt_ops {
/**
* @ingroup UCP_DATATYPE
* @brief Start a packing request.
*
* The pointer refers to application defined start-to-pack routine. It will
* be called from the @ref ucp_tag_send_nb routine.
*
* @param [in] context User-defined context.
* @param [in] buffer Buffer to pack.
* @param [in] count Number of elements to pack into the buffer.
*
* @return A custom state that is passed to the following
* @ref ucp_generic_dt_ops::pack "pack()" routine.
*/
void* (*start_pack)(void *context, const void *buffer, size_t count);
/**
* @ingroup UCP_DATATYPE
* @brief Start an unpacking request.
*
* The pointer refers to application defined start-to-unpack routine. It will
* be called from the @ref ucp_tag_recv_nb routine.
*
* @param [in] context User-defined context.
* @param [in] buffer Buffer to unpack to.
* @param [in] count Number of elements to unpack in the buffer.
*
* @return A custom state that is passed later to the following
* @ref ucp_generic_dt_ops::unpack "unpack()" routine.
*/
void* (*start_unpack)(void *context, void *buffer, size_t count);
/**
* @ingroup UCP_DATATYPE
* @brief Get the total size of packed data.
*
* The pointer refers to user defined routine that returns the size of data
* in a packed format.
*
* @param [in] state State as returned by
* @ref ucp_generic_dt_ops::start_pack
* "start_pack()" routine.
*
* @return The size of the data in a packed form.
*/
size_t (*packed_size)(void *state);
/**
* @ingroup UCP_DATATYPE
* @brief Pack data.
*
* The pointer refers to application defined pack routine.
*
* @param [in] state State as returned by
* @ref ucp_generic_dt_ops::start_pack
* "start_pack()" routine.
* @param [in] offset Virtual offset in the output stream.
* @param [in] dest Destination to pack the data to.
* @param [in] max_length Maximal length to pack.
*
* @return The size of the data that was written to the destination buffer.
* Must be less than or equal to @e max_length.
*/
size_t (*pack) (void *state, size_t offset, void *dest, size_t max_length);
/**
* @ingroup UCP_DATATYPE
* @brief Unpack data.
*
* The pointer refers to application defined unpack routine.
*
* @param [in] state State as returned by
* @ref ucp_generic_dt_ops::start_unpack
* "start_unpack()" routine.
* @param [in] offset Virtual offset in the input stream.
* @param [in] src Source to unpack the data from.
* @param [in] length Length to unpack.
*
* @return UCS_OK or an error if unpacking failed.
*/
ucs_status_t (*unpack)(void *state, size_t offset, const void *src, size_t length);
/**
* @ingroup UCP_DATATYPE
* @brief Finish packing/unpacking.
*
* The pointer refers to application defined finish routine.
*
* @param [in] state State as returned by
* @ref ucp_generic_dt_ops::start_pack
* "start_pack()"
* and
* @ref ucp_generic_dt_ops::start_unpack
* "start_unpack()"
* routines.
*/
void (*finish)(void *state);
} ucp_generic_dt_ops_t;
/**
* @ingroup UCP_CONFIG
* @brief Tuning parameters for UCP library.
*
* The structure defines the parameters that are used for
* UCP library tuning during UCP library @ref ucp_init "initialization".
*
* @note UCP library implementation uses the @ref ucp_feature "features"
* parameter to optimize the library functionality that minimize memory
* footprint. For example, if the application does not require send/receive
* semantics UCP library may avoid allocation of expensive resources associated with
* send/receive queues.
*/
typedef struct ucp_params {
/**
* Mask of valid fields in this structure, using bits from @ref ucp_params_field.
* Fields not specified in this mask will be ignored.
* Provides ABI compatibility with respect to adding new fields.
*/
uint64_t field_mask;
/**
* UCP @ref ucp_feature "features" that are used for library
* initialization. It is recommended for applications only to request
* the features that are required for an optimal functionality
* This field must be specified.
*/
uint64_t features;
/**
* The size of a reserved space in a non-blocking requests. Typically
* applications use this space for caching own structures in order to avoid
* costly memory allocations, pointer dereferences, and cache misses.
* For example, MPI implementation can use this memory for caching MPI
* descriptors
* This field defaults to 0 if not specified.
*/
size_t request_size;
/**
* Pointer to a routine that is used for the request initialization.
* This function will be called only on the very first time a request memory
* is initialized, and may not be called again if a request is reused.
* If a request should be reset before the next reuse, it can be done before
* calling @ref ucp_request_free.
*
* @e NULL can be used if no such is function required, which is also the
* default if this field is not specified by @ref field_mask.
*/
ucp_request_init_callback_t request_init;
/**
* Pointer to a routine that is responsible for final cleanup of the memory
* associated with the request. This routine may not be called every time a
* request is released. For some implementations, the cleanup call may be
* delayed and only invoked at @ref ucp_worker_destroy.
*
* @e NULL can be used if no such function is required, which is also the
* default if this field is not specified by @ref field_mask.
*/
ucp_request_cleanup_callback_t request_cleanup;
/**
* Mask which specifies particular bits of the tag which can uniquely
* identify the sender (UCP endpoint) in tagged operations.
* This field defaults to 0 if not specified.
*/
uint64_t tag_sender_mask;
/**
* This flag indicates if this context is shared by multiple workers
* from different threads. If so, this context needs thread safety
* support; otherwise, the context does not need to provide thread
* safety.
* For example, if the context is used by single worker, and that
* worker is shared by multiple threads, this context does not need
* thread safety; if the context is used by worker 1 and worker 2,
* and worker 1 is used by thread 1 and worker 2 is used by thread 2,
* then this context needs thread safety.
* Note that actual thread mode may be different from mode passed
* to @ref ucp_init. To get actual thread mode use
* @ref ucp_context_query.
*/
int mt_workers_shared;
/**
* An optimization hint of how many endpoints will be created on this context.
* For example, when used from MPI or SHMEM libraries, this number will specify
* the number of ranks (or processing elements) in the job.
* Does not affect semantics, but only transport selection criteria and the
* resulting performance.
* The value can be also set by UCX_NUM_EPS environment variable. In such case
* it will override the number of endpoints set by @e estimated_num_eps
*/
size_t estimated_num_eps;
/**
* An optimization hint for a single node. For example, when used from MPI or
* OpenSHMEM libraries, this number will specify the number of Processes Per
* Node (PPN) in the job. Does not affect semantics, only transport selection
* criteria and the resulting performance.
* The value can be also set by the UCX_NUM_PPN environment variable, which
* will override the number of endpoints set by @e estimated_num_ppn
*/
size_t estimated_num_ppn;
} ucp_params_t;
/**
* @ingroup UCP_CONTEXT
* @brief Context attributes.
*
* The structure defines the attributes which characterize
* the particular context.
*/
typedef struct ucp_context_attr {
/**
* Mask of valid fields in this structure, using bits from
* @ref ucp_context_attr_field.
* Fields not specified in this mask will be ignored.
* Provides ABI compatibility with respect to adding new fields.
*/
uint64_t field_mask;
/**
* Size of UCP non-blocking request. When pre-allocated request is used
* (e.g. in @ref ucp_tag_recv_nbr) it should have enough space to fit
* UCP request data, which is defined by this value.
*/
size_t request_size;
/**
* Thread safe level of the context. For supported thread levels please
* see @ref ucs_thread_mode_t.
*/
ucs_thread_mode_t thread_mode;
/**
* Mask of which memory types are supported, for supported memory types
* please see @ref ucs_memory_type_t.
*/
uint64_t memory_types;
} ucp_context_attr_t;
/**
* @ingroup UCP_WORKER
* @brief UCP worker attributes.
*
* The structure defines the attributes which characterize
* the particular worker.
*/
typedef struct ucp_worker_attr {
/**
* Mask of valid fields in this structure, using bits from
* @ref ucp_worker_attr_field.
* Fields not specified in this mask will be ignored.
* Provides ABI compatibility with respect to adding new fields.
*/
uint64_t field_mask;
/**
* Thread safe level of the worker.
*/
ucs_thread_mode_t thread_mode;
/**
* Flags indicating requested details of the worker address.
* If @ref UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS bit is set in the field_mask,
* this value should be set as well. Possible flags are specified
* in @ref ucp_worker_address_flags_t. @note This is an input attribute.
*/
uint32_t address_flags;
/**
* Worker address, which can be passed to remote instances of the UCP library
* in order to connect to this worker. The memory for the address handle is
* allocated by @ref ucp_worker_query "ucp_worker_query()" routine, and
* must be released by using @ref ucp_worker_release_address
* "ucp_worker_release_address()" routine.
*/
ucp_address_t *address;
/**
* Size of worker address in bytes.
*/
size_t address_length;
} ucp_worker_attr_t;
/**
* @ingroup UCP_WORKER
* @brief Tuning parameters for the UCP worker.
*
* The structure defines the parameters that are used for the
* UCP worker tuning during the UCP worker @ref ucp_worker_create "creation".
*/
typedef struct ucp_worker_params {
/**
* Mask of valid fields in this structure, using bits from @ref ucp_worker_params_field.
* Fields not specified in this mask will be ignored.
* Provides ABI compatibility with respect to adding new fields.
*/
uint64_t field_mask;
/**
* The parameter thread_mode suggests the thread safety mode which worker
* and the associated resources should be created with. This is an
* optional parameter. The default value is UCS_THREAD_MODE_SINGLE and
* it is used when the value of the parameter is not set. When this
* parameter along with its corresponding bit in the
* field_mask - UCP_WORKER_PARAM_FIELD_THREAD_MODE is set, the
* @ref ucp_worker_create attempts to create worker with this thread mode.
* The thread mode with which worker is created can differ from the
* suggested mode. The actual thread mode of the worker should be obtained
* using the query interface @ref ucp_worker_query.
*/
ucs_thread_mode_t thread_mode;
/**
* Mask of which CPUs worker resources should preferably be allocated on.
* This value is optional.
* If it's not set (along with its corresponding bit in the field_mask -
* UCP_WORKER_PARAM_FIELD_CPU_MASK), resources are allocated according to
* system's default policy.
*/
ucs_cpu_set_t cpu_mask;
/**
* Mask of events (@ref ucp_wakeup_event_t) which are expected on wakeup.
* This value is optional.
* If it's not set (along with its corresponding bit in the field_mask -
* UCP_WORKER_PARAM_FIELD_EVENTS), all types of events will trigger on
* wakeup.
*/
unsigned events;
/**
* User data associated with the current worker.
* This value is optional.
* If it's not set (along with its corresponding bit in the field_mask -
* UCP_WORKER_PARAM_FIELD_USER_DATA), it will default to NULL.
*/
void *user_data;
/**
* External event file descriptor.