1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #ifndef UCX_TYPES_H_INCLUDED
7 #define UCX_TYPES_H_INCLUDED
8 #include <ucp/api/ucp.h>
9 #include <ucp/api/ucp_def.h>
10 #include "mpiimpl.h"
11 
12 #define __SHORT_FILE__                          \
13   (strrchr(__FILE__,'/')                        \
14    ? strrchr(__FILE__,'/')+1                    \
15    : __FILE__                                   \
16 )
17 
18 #define UCP_PEER_NAME_MAX         HOST_NAME_MAX
19 
20 /* Active Message Stuff */
21 #define MPIDI_UCX_NUM_AM_BUFFERS       (64)
22 #define MPIDI_UCX_MAX_AM_EAGER_SZ      (16*1024)
23 #define MPIDI_UCX_AM_TAG               (1ULL << MPIR_Process.tag_bits)
24 
25 typedef struct {
26     ucp_worker_h worker;
27     ucp_address_t *if_address;
28     size_t addrname_len;
29 } MPIDI_UCX_context_t;
30 
31 typedef struct {
32     ucp_context_h context;
33     MPIDI_UCX_context_t ctx[MPIDI_CH4_MAX_VCIS];
34     int num_vnis;
35 } MPIDI_UCX_global_t;
36 
37 #define MPIDI_UCX_AV(av)     ((av)->netmod.ucx)
38 
39 extern MPIDI_UCX_global_t MPIDI_UCX_global;
40 extern ucp_generic_dt_ops_t MPIDI_UCX_datatype_ops;
41 
42 /* UCX TAG Layout */
43 
44 /* 01234567 01234567 01234567 01234567 01234567 01234567 01234567 01234567
45  *  context_id (16) |source rank (16) | Message Tag (32)+ERROR BITS
46  */
47 
48 #define MPIDI_UCX_CONTEXT_TAG_BITS 16
49 #define MPIDI_UCX_CONTEXT_RANK_BITS 16
50 
51 #define MPIDI_UCX_TAG_MASK      (0x00000000FFFFFFFFULL)
52 #define MPIDI_UCX_SOURCE_MASK   (0x0000FFFF00000000ULL)
53 #define MPIDI_UCX_TAG_SHIFT     (32)
54 #define MPIDI_UCX_SOURCE_SHIFT  (16)
55 
56 #endif /* UCX_TYPES_H_INCLUDED */
57