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
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED.
* Copyright (C) UT-Battelle, LLC. 2014-2015. ALL RIGHTS RESERVED.
* Copyright (C) IBM 2015. ALL RIGHTS RESERVED.
* Copyright (C) Los Alamos National Security, LLC. 2018. ALL RIGHTS RESERVED.
* Copyright (C) Arm, Ltd. 2021. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/**
* @ingroup UCP_CONTEXT
* @brief UCP receive information descriptor
*
* The UCP receive information descriptor is allocated by application and filled
* in with the information about the received message by @ref ucp_tag_probe_nb
* or @ref ucp_tag_recv_request_test routines or
* @ref ucp_tag_recv_callback_t callback argument.
*/
typedef struct ucp_tag_recv_info ucp_tag_recv_info_t;
/**
* @ingroup UCP_WORKER
* @brief Operation parameters provided in @ref ucp_am_recv_callback_t callback.
*/
typedef struct ucp_am_recv_param ucp_am_recv_param_t;
/**
* @ingroup UCP_CONTEXT
* @brief UCP Application Context
*
* UCP application context (or just a context) is an opaque handle that holds a
* UCP communication instance's global information. It represents a single UCP
* communication instance. The communication instance could be an OS process
* (an application) that uses UCP library. This global information includes
* communication resources, endpoints, memory, temporary file storage, and
* other communication information directly associated with a specific UCP
* instance. The context also acts as an isolation mechanism, allowing
* resources associated with the context to manage multiple concurrent
* communication instances. For example, users using both MPI and OpenSHMEM
* sessions simultaneously can isolate their communication by allocating and
* using separate contexts for each of them. Alternatively, users can share the
* communication resources (memory, network resource context, etc.) between
* them by using the same application context. A message sent or a RMA
* operation performed in one application context cannot be received in any
* other application context.
*/
typedef struct ucp_context *ucp_context_h;
/**
* @ingroup UCP_CONFIG
* @brief UCP configuration descriptor
*
* This descriptor defines the configuration for @ref ucp_context_h
* "UCP application context". The configuration is loaded from the run-time
* environment (using configuration files of environment variables)
* using @ref ucp_config_read "ucp_config_read" routine and can be printed
* using @ref ucp_config_print "ucp_config_print" routine. In addition,
* application is responsible to release the descriptor using
* @ref ucp_config_release "ucp_config_release" routine.
*
* @todo This structure will be modified through a dedicated function.
*/
typedef struct ucp_config ucp_config_t;
/**
* @ingroup UCP_ENDPOINT
* @brief UCP Endpoint
*
* The endpoint handle is an opaque object that is used to address a remote
* @ref ucp_worker_h "worker". It typically provides a description of source,
* destination, or both. All UCP communication routines address a destination
* with the endpoint handle. The endpoint handle is associated with only one
* @ref ucp_context_h "UCP context". UCP provides the @ref ucp_ep_create
* "endpoint create" routine to create the endpoint handle and the @ref
* ucp_ep_destroy "destroy" routine to destroy the endpoint handle.
*/
typedef struct ucp_ep *ucp_ep_h;
/**
* @ingroup UCP_ENDPOINT
* @brief UCP connection request
*
* A server-side handle to incoming connection request. Can be used to create an
* endpoint which connects back to the client.
*/
typedef struct ucp_conn_request *ucp_conn_request_h;
/**
* @ingroup UCP_WORKER
* @brief UCP worker address
*
* The address handle is an opaque object that is used as an identifier for a
* @ref ucp_worker_h "worker" instance.
*/
typedef struct ucp_address ucp_address_t;
/**
* @ingroup UCP_ENDPOINT
* @brief Error handling mode for the UCP endpoint.
*
* Specifies error handling mode for the UCP endpoint.
*/
typedef enum ucp_err_handling_mode_t;
/**
* @ingroup UCP_MEM
* @brief UCP Remote memory handle
*
* Remote memory handle is an opaque object representing remote memory access
* information. Typically, the handle includes a memory access key and other
* network hardware specific information, which are input to remote memory
* access operations, such as PUT, GET, and ATOMIC. The object is
* communicated to remote peers to enable an access to the memory region.
*/
typedef struct ucp_rkey *ucp_rkey_h;
/**
* @ingroup UCP_MEM
* @brief UCP Memory handle
*
* Memory handle is an opaque object representing a memory region allocated
* through UCP library, which is optimized for remote memory access
* operations (zero-copy operations). The memory handle is a self-contained
* object, which includes the information required to access the memory region
* locally, while @ref ucp_rkey_h "remote key" is used to access it
* remotely. The memory could be registered to one or multiple network resources
* that are supported by UCP, such as InfiniBand, Gemini, and others.
*/
typedef struct ucp_mem *ucp_mem_h;
/**
* @ingroup UCP_WORKER
* @brief UCP listen handle.
*
* The listener handle is an opaque object that is used for listening on a
* specific address and accepting connections from clients.
*/
typedef struct ucp_listener *ucp_listener_h;
/**
* @ingroup UCP_MEM
* @brief Attributes of the @ref ucp_mem_h "UCP Memory handle", filled by
* @ref ucp_mem_query function.
*/
typedef struct ucp_mem_attr ucp_mem_attr_t;
/**
* @ingroup UCP_MEM
* @brief UCP Memory handle attributes field mask.
*
* The enumeration allows specifying which fields in @ref ucp_mem_attr_t are
* present. It is used to enable backward compatibility support.
*/
;
/**
* @ingroup UCP_WORKER
* @brief UCP Worker
*
* UCP worker is an opaque object representing the communication context. The
* worker represents an instance of a local communication resource and the
* progress engine associated with it. The progress engine is a construct that
* is responsible for asynchronous and independent progress of communication
* directives. The progress engine could be implemented in hardware or software.
* The worker object abstracts an instance of network resources such as a host
* channel adapter port, network interface, or multiple resources such as
* multiple network interfaces or communication ports. It could also represent
* virtual communication resources that are defined across multiple devices.
* Although the worker can represent multiple network resources, it is
* associated with a single @ref ucp_context_h "UCX application context".
* All communication functions require a context to perform the operation on
* the dedicated hardware resource(s) and an @ref ucp_ep_h "endpoint" to address the
* destination.
*
* @note Worker are parallel "threading points" that an upper layer may use to
* optimize concurrent communications.
*/
typedef struct ucp_worker *ucp_worker_h;
/**
* @ingroup UCP_COMM
* @brief UCP Tag Identifier
*
* UCP tag identifier is a 64bit object used for message identification.
* UCP tag send and receive operations use the object for an implementation
* tag matching semantics (derivative of MPI tag matching semantics).
*/
typedef uint64_t ucp_tag_t;
/**
* @ingroup UCP_COMM
* @brief UCP Message descriptor.
*
* UCP Message descriptor is an opaque handle for a message returned by
* @ref ucp_tag_probe_nb. This handle can be passed to @ref ucp_tag_msg_recv_nb
* in order to receive the message data to a specific buffer.
*/
typedef struct ucp_recv_desc *ucp_tag_message_h;
/**
* @ingroup UCP_COMM
* @brief UCP Datatype Identifier
*
* UCP datatype identifier is a 64bit object used for datatype identification.
* Predefined UCP identifiers are defined by @ref ucp_dt_type.
*/
typedef uint64_t ucp_datatype_t;
/**
* @ingroup UCP_CONTEXT
* @brief Request initialization callback.
*
* This callback routine is responsible for the request initialization.
*
* @param [in] request Request handle to initialize.
*/
typedef void ;
/**
* @ingroup UCP_CONTEXT
* @brief Request cleanup callback.
*
* This callback routine is responsible for cleanup of the memory
* associated with the request.
*
* @param [in] request Request handle to cleanup.
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking sends.
*
* This callback routine is invoked whenever the @ref ucp_tag_send_nb
* "send operation" is completed. It is important to note that the call-back is
* only invoked in a case when the operation cannot be completed in place.
*
* @param [in] request The completed send request.
* @param [in] status Completion status. If the send operation was completed
* successfully UCS_OK is returned. If send operation was
* canceled UCS_ERR_CANCELED is returned.
* Otherwise, an @ref ucs_status_t "error status" is
* returned.
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking sends ucp_tag_send_nbx call.
*
* This callback routine is invoked whenever the @ref ucp_tag_send_nbx
* "send operation" is completed. It is important to note that the call-back is
* only invoked in a case when the operation cannot be completed in place.
*
* @param [in] request The completed send request.
* @param [in] status Completion status. If the send operation was completed
* successfully UCS_OK is returned. If send operation was
* canceled UCS_ERR_CANCELED is returned.
* Otherwise, an @ref ucs_status_t "error status" is
* returned.
* @param [in] user_data User data passed to "user_data" value,
* see @ref ucp_request_param_t
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Callback to process peer failure.
*
* This callback routine is invoked when transport level error detected.
*
* @param [in] arg User argument to be passed to the callback.
* @param [in] ep Endpoint to handle transport level error. Upon return
* from the callback, this @a ep is no longer usable and
* all subsequent operations on this @a ep will fail with
* the error code passed in @a status.
* @param [in] status @ref ucs_status_t "error status".
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief UCP endpoint error handling context.
*
* This structure should be initialized in @ref ucp_ep_params_t to handle peer failure
*/
typedef struct ucp_err_handler ucp_err_handler_t;
/**
* @ingroup UCP_WORKER
* @brief A callback for accepting client/server connections on a listener
* @ref ucp_listener_h.
*
* This callback routine is invoked on the server side upon creating a connection
* to a remote client. The user can pass an argument to this callback.
* The user is responsible for releasing the @a ep handle using the
* @ref ucp_ep_destroy "ucp_ep_destroy()" routine.
*
* @param [in] ep Handle to a newly created endpoint which is connected
* to the remote peer which has initiated the connection.
* @param [in] arg User's argument for the callback.
*/
typedef void ;
/**
* @ingroup UCP_WORKER
* @brief A callback for handling of incoming connection request @a conn_request
* from a client.
*
* This callback routine is invoked on the server side to handle incoming
* connections from remote clients. The user can pass an argument to this
* callback. The @a conn_request handle has to be released, either by @ref
* ucp_ep_create or @ref ucp_listener_reject routine.
*
* @param [in] conn_request Connection request handle.
* @param [in] arg User's argument for the callback.
*/
typedef void
;
/**
* @ingroup UCP_WORKER
* @brief UCP callback to handle the connection request in a client-server
* connection establishment flow.
*
* This structure is used for handling an incoming connection request on
* the listener. Setting this type of handler allows creating an endpoint on
* any other worker and not limited to the worker on which the listener was
* created.
* @note
* - Other than communication progress routines, it is allowed to call all
* other communication routines from the callback in the struct.
* - The callback is thread safe with respect to the worker it is invoked on.
* - It is the user's responsibility to avoid potential dead lock accessing
* different worker.
*/
typedef struct ucp_listener_conn_handler ucp_listener_conn_handler_t;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking stream oriented receives.
*
* This callback routine is invoked whenever the @ref ucp_stream_recv_nb
* "receive operation" is completed and the data is ready in the receive buffer.
*
* @param [in] request The completed receive request.
* @param [in] status Completion status. If the send operation was completed
* successfully UCS_OK is returned. Otherwise,
* an @ref ucs_status_t "error status" is returned.
* @param [in] length The size of the received data in bytes, always
* boundary of base datatype size. The value is valid
* only if the status is UCS_OK.
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking stream receives
* ucp_stream_recv_nbx call.
*
* This callback routine is invoked whenever the @ref ucp_stream_recv_nbx
* "receive operation" is completed and the data is ready in the receive buffer.
*
* @param [in] request The completed receive request.
* @param [in] status Completion status. If the send operation was completed
* successfully UCS_OK is returned. Otherwise,
* an @ref ucs_status_t "error status" is returned.
* @param [in] length The size of the received data in bytes, always on the
* boundary of base datatype size. The value is valid
* only if the status is UCS_OK.
* @param [in] user_data User data passed to "user_data" value,
* see @ref ucp_request_param_t.
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking tag receives.
*
* This callback routine is invoked whenever the @ref ucp_tag_recv_nb
* "receive operation" is completed and the data is ready in the receive buffer.
*
* @param [in] request The completed receive request.
* @param [in] status Completion status. If the send operation was completed
* successfully UCS_OK is returned. If send operation was
* canceled UCS_ERR_CANCELED is returned. If the data can
* not fit into the receive buffer the
* @ref UCS_ERR_MESSAGE_TRUNCATED error code is returned.
* Otherwise, an @ref ucs_status_t "error status" is
* returned.
* @param [in] info @ref ucp_tag_recv_info_t "Completion information"
* The @a info descriptor is Valid only if the status is
* UCS_OK.
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking tag receives ucp_tag_recv_nbx call.
*
* This callback routine is invoked whenever the @ref ucp_tag_recv_nbx
* "receive operation" is completed and the data is ready in the receive buffer.
*
* @param [in] request The completed receive request.
* @param [in] status Completion status. If the receive operation was completed
* successfully UCS_OK is returned. If send operation was
* canceled, UCS_ERR_CANCELED is returned. If the data can
* not fit into the receive buffer the
* @ref UCS_ERR_MESSAGE_TRUNCATED error code is returned.
* Otherwise, an @ref ucs_status_t "error status" is
* returned.
* @param [in] tag_info @ref ucp_tag_recv_info_t "Completion information"
* The @a info descriptor is Valid only if the status is
* UCS_OK.
* @param [in] user_data User data passed to "user_data" value,
* see @ref ucp_request_param_t
*/
typedef void ;
/**
* @ingroup UCP_COMM
* @brief Completion callback for non-blocking Active Message receives.
*
* This callback routine is invoked whenever the @ref ucp_am_recv_data_nbx
* "receive operation" is completed and the data is ready in the receive buffer.
*
* @param [in] request The completed receive request.
* @param [in] status Completion status. If the receive operation was
* completed successfully UCS_OK is returned. Otherwise,
* an @ref ucs_status_t "error status" is returned.
* @param [in] length The size of the received data in bytes, always
* boundary of base datatype size. The value is valid
* only if the status is UCS_OK.
* @param [in] user_data User data passed to "user_data" value,
* see @ref ucp_request_param_t
*/
typedef void ;
/**
* @ingroup UCP_WORKER
* @brief UCP worker wakeup events mask.
*
* The enumeration allows specifying which events are expected on wakeup. Empty
* events are possible for any type of event except for @ref UCP_WAKEUP_TX and
* @ref UCP_WAKEUP_RX.
*
* @note Send completions are reported by POLLIN-like events (see poll man
* page). Since outgoing operations can be initiated at any time, UCP does not
* generate POLLOUT-like events, although it must be noted that outgoing
* operations may be queued depending upon resource availability.
*/
typedef enum ucp_wakeup_event_types ucp_wakeup_event_t;
/**
* @ingroup UCP_ENDPOINT
* @brief Callback to process incoming Active Message.
*
* When the callback is called, @a flags indicates how @a data should be handled.
*
* @param [in] arg User-defined argument.
* @param [in] data Points to the received data. This data may
* persist after the callback returns and needs
* to be freed with @ref ucp_am_data_release.
* @param [in] length Length of data.
* @param [in] reply_ep If the Active Message is sent with the
* UCP_AM_SEND_REPLY flag, the sending ep
* will be passed in. If not, NULL will be passed.
* @param [in] flags If this flag is set to UCP_CB_PARAM_FLAG_DATA,
* the callback can return UCS_INPROGRESS and
* data will persist after the callback returns.
*
* @return UCS_OK @a data will not persist after the callback returns.
*
* @return UCS_INPROGRESS Can only be returned if flags is set to
* UCP_CB_PARAM_FLAG_DATA. If UCP_INPROGRESS
* is returned, data will persist after the
* callback has returned. To free the memory,
* a pointer to the data must be passed into
* @ref ucp_am_data_release.
*
* @note This callback should be set and released
* by @ref ucp_worker_set_am_handler function.
*
*/
typedef ;
/**
* @ingroup UCP_ENDPOINT
* @brief Callback to process incoming Active Message sent by
* @ref ucp_am_send_nbx routine.
*
* The callback is always called from the progress context, therefore calling
* @ref ucp_worker_progress() is not allowed. It is recommended to define
* callbacks with relatively short execution time to avoid blocking of
* communication progress.
*
* @param [in] arg User-defined argument.
* @param [in] header User defined active message header.
* If @a header_length is 0, this value is undefined
* and must not be accessed.
* @param [in] header_length Active message header length in bytes.
* @param [in] data Points to the received data if @a
* UCP_AM_RECV_ATTR_FLAG_RNDV flag is not set in
* @ref ucp_am_recv_param_t.recv_attr. Otherwise
* it points to the internal UCP descriptor which
* can further be used for initiating data receive
* by using @ref ucp_am_recv_data_nbx routine.
* @param [in] length Length of data. If @a UCP_AM_RECV_ATTR_FLAG_RNDV
* flag is set in @ref ucp_am_recv_param_t.recv_attr,
* it indicates the required receive buffer size for
* initiating rendezvous protocol.
* @param [in] param Data receive parameters.
*
* @return UCS_OK @a data will not persist after the callback returns.
* If UCP_AM_RECV_ATTR_FLAG_RNDV flag is set in
* @a param->recv_attr and @ref ucp_am_recv_data_nbx was
* not called for this data, the data descriptor will be
* dropped and the corresponding @ref ucp_am_send_nbx
* call will complete with UCS_OK status.
*
* @return UCS_INPROGRESS Can only be returned if @a param->recv_attr flags
* contains UCP_AM_RECV_ATTR_FLAG_DATA or
* UCP_AM_RECV_ATTR_FLAG_RNDV. The @a data will persist
* after the callback has returned. To free the memory,
* a pointer to the data must be passed into
* @ref ucp_am_data_release or data receive is initiated
* by @ref ucp_am_recv_data_nbx.
*
* @return otherwise Can only be returned if @a param->recv_attr contains
* UCP_AM_RECV_ATTR_FLAG_RNDV. In this case data
* descriptor @a data will be dropped and the
* corresponding @ref ucp_am_send_nbx call on the
* sender side will complete with the status returned
* from the callback.
*
* @note This callback should be set and released
* by @ref ucp_worker_set_am_recv_handler function.
*
*/
typedef ;
/**
* @ingroup UCP_ENDPOINT
* @brief Tuning parameters for the UCP endpoint.
*
* The structure defines the parameters that are used for the
* UCP endpoint tuning during the UCP ep @ref ucp_ep_create "creation".
*/
typedef struct ucp_ep_params ucp_ep_params_t;
/**
* @ingroup UCP_CONTEXT
* @brief Maximum size of the UCP entity name in structure of entity attributes
* provided by a query method.
*/