Skip to content

Commit 4ad6e0b

Browse files
committed
add data structures
1 parent ac2651a commit 4ad6e0b

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

opal/mca/common/ucx/common_ucx.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,74 @@
1919

2020
/***********************************************************************/
2121

22+
typedef struct {
23+
opal_mutex_t mutex;
24+
ucp_worker_h worker;
25+
ucp_ep_h *endpoints;
26+
int comm_size;
27+
} _worker_engine_t;
28+
29+
OBJ_CLASS_DECLARATION(_worker_engine_t);
30+
31+
typedef struct {
32+
int ctx_id;
33+
opal_common_ucx_ctx_t *gctx;
34+
_worker_engine_t *worker;
35+
} _tlocal_ctx_t;
36+
37+
OBJ_CLASS_DECLARATION(_tlocal_ctx_t);
38+
39+
typedef struct {
40+
_worker_engine_t *worker;
41+
ucp_rkey_h *rkeys;
42+
} _mem_info_t;
43+
44+
OBJ_CLASS_DECLARATION(_mem_info_t);
45+
46+
typedef struct {
47+
int mem_id;
48+
opal_common_ucx_mem_t *gmem;
49+
_mem_info_t *mem;
50+
} _tlocal_mem_t;
51+
52+
OBJ_CLASS_DECLARATION(_tlocal_mem_t);
53+
54+
typedef struct {
55+
opal_list_item_t super;
56+
_worker_engine_t *ptr;
57+
} _idle_list_item_t;
58+
59+
OBJ_CLASS_DECLARATION(_idle_list_item_t);
60+
OBJ_CLASS_INSTANCE(_idle_list_item_t, opal_list_item_t, NULL, NULL);
61+
62+
typedef struct {
63+
opal_list_item_t super;
64+
_worker_engine_t *ptr;
65+
} _worker_list_item_t;
66+
67+
OBJ_CLASS_DECLARATION(_worker_list_item_t);
68+
OBJ_CLASS_INSTANCE(_worker_list_item_t, opal_list_item_t, NULL, NULL);
69+
70+
typedef struct {
71+
opal_list_item_t super;
72+
_mem_info_t *ptr;
73+
} _mem_region_list_item_t;
74+
75+
OBJ_CLASS_DECLARATION(_mem_region_list_item_t);
76+
OBJ_CLASS_INSTANCE(_mem_region_list_item_t, opal_list_item_t, NULL, NULL);
77+
78+
/* thread-local table */
79+
typedef struct {
80+
_tlocal_ctx_t **ctx_tbl;
81+
size_t ctx_tbl_size;
82+
_tlocal_mem_t **mem_tbl;
83+
size_t mem_tbl_size;
84+
} _tlocal_table_t;
85+
86+
static pthread_key_t _tlocal_key = {0};
87+
88+
/***********************************************************************/
89+
2290
extern mca_base_framework_t opal_memory_base_framework;
2391

2492
opal_common_ucx_module_t opal_common_ucx = {

opal/mca/common/ucx/common_ucx.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,44 @@ typedef struct opal_common_ucx_del_proc {
9696

9797
extern opal_common_ucx_module_t opal_common_ucx;
9898

99+
typedef struct {
100+
ucp_context_h ucp_ctx;
101+
opal_mutex_t mutex;
102+
opal_list_t idle_workers;
103+
ucp_worker_h recv_worker;
104+
ucp_address_t *recv_waddr;
105+
size_t recv_waddr_len;
106+
int cur_ctxid, cur_memid;
107+
} opal_common_ucx_wpool_t;
108+
109+
typedef struct {
110+
int ctx_id;
111+
opal_mutex_t mutex;
112+
opal_common_ucx_wpool_t *wpool; /* which wpool this ctx belongs to */
113+
opal_list_t workers; /* active worker lists */
114+
char *recv_worker_addrs;
115+
int *recv_worker_displs;
116+
} opal_common_ucx_ctx_t;
117+
118+
typedef struct {
119+
int mem_id;
120+
opal_mutex_t mutex;
121+
opal_common_ucx_ctx_t *ctx; /* which ctx this mem_reg belongs to */
122+
opal_list_t mem_regions; /* mem region lists */
123+
char *mem_addrs;
124+
int *mem_displs;
125+
} opal_common_ucx_mem_t;
126+
127+
typedef enum {
128+
OPAL_COMMON_UCX_PUT,
129+
OPAL_COMMON_UCX_GET
130+
} opal_common_ucx_op_t;
131+
132+
typedef enum {
133+
OPAL_COMMON_UCX_SCOPE_EP,
134+
OPAL_COMMON_UCX_SCOPE_WORKER
135+
} opal_common_ucx_flush_scope_t;
136+
99137
OPAL_DECLSPEC void opal_common_ucx_mca_register(void);
100138
OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void);
101139
OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status);

0 commit comments

Comments
 (0)