Skip to content

Commit 436adbc

Browse files
committed
oshmem: Add symmetric remote key environment variable
This is used to activate symmetric remote key registration and deduplication. Signed-off-by: Thomas Vegas <[email protected]>
1 parent 9f82d1c commit 436adbc

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

config/ompi_check_ucx.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ AC_DEFUN([OMPI_CHECK_UCX],[
107107
UCP_ATOMIC_FETCH_OP_FXOR,
108108
UCP_PARAM_FIELD_ESTIMATED_NUM_PPN,
109109
UCP_WORKER_FLAG_IGNORE_REQUEST_LEAK,
110-
UCP_OP_ATTR_FLAG_MULTI_SEND],
110+
UCP_OP_ATTR_FLAG_MULTI_SEND,
111+
UCP_MEM_MAP_SYMMETRIC_RKEY],
111112
[], [],
112113
[#include <ucp/api/ucp.h>])
113114
AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS],

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ static ucp_request_param_t mca_spml_ucx_request_param_b = {
126126
};
127127
#endif
128128

129+
unsigned
130+
mca_spml_ucx_mem_map_flags_symmetric_rkey(struct mca_spml_ucx *spml_ucx)
131+
{
132+
#if HAVE_DECL_UCP_MEM_MAP_SYMMETRIC_RKEY
133+
if (spml_ucx->symmetric_rkey_max_count > 0) {
134+
return UCP_MEM_MAP_SYMMETRIC_RKEY;
135+
}
136+
#endif
137+
138+
return 0;
139+
}
140+
129141
int mca_spml_ucx_enable(bool enable)
130142
{
131143
SPML_UCX_VERBOSE(50, "*** ucx ENABLED ****");
@@ -725,7 +737,8 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr,
725737
UCP_MEM_MAP_PARAM_FIELD_FLAGS;
726738
mem_map_params.address = addr;
727739
mem_map_params.length = size;
728-
mem_map_params.flags = flags;
740+
mem_map_params.flags = flags |
741+
mca_spml_ucx_mem_map_flags_symmetric_rkey(&mca_spml_ucx);
729742

730743
status = ucp_mem_map(mca_spml_ucx.ucp_context, &mem_map_params, &mem_h);
731744
if (UCS_OK != status) {

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct mca_spml_ucx {
128128
unsigned long nb_ucp_worker_progress;
129129
unsigned int ucp_workers;
130130
unsigned int ucp_worker_cnt;
131+
int symmetric_rkey_max_count;
131132
};
132133
typedef struct mca_spml_ucx mca_spml_ucx_t;
133134

@@ -280,6 +281,8 @@ extern int mca_spml_ucx_team_fcollect(shmem_team_t team, void
280281
extern int mca_spml_ucx_team_reduce(shmem_team_t team, void
281282
*dest, const void *source, size_t nreduce, int operation, int datatype);
282283

284+
extern unsigned
285+
mca_spml_ucx_mem_map_flags_symmetric_rkey(struct mca_spml_ucx *spml_ucx);
283286

284287
static inline int
285288
mca_spml_ucx_peer_mkey_get(ucp_peer_t *ucp_peer, int index, spml_ucx_cached_mkey_t **out_rmkey)

oshmem/mca/spml/ucx/spml_ucx_component.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ static int mca_spml_ucx_component_register(void)
153153
"Enable asynchronous progress thread",
154154
&mca_spml_ucx.async_progress);
155155

156+
mca_spml_ucx_param_register_int("symmetric_rkey_max_count", 0,
157+
"Size of the symmetric key store. Non-zero to enable, typical use 5000",
158+
&mca_spml_ucx.symmetric_rkey_max_count);
159+
156160
mca_spml_ucx_param_register_int("async_tick_usec", 3000,
157161
"Asynchronous progress tick granularity (in usec)",
158162
&mca_spml_ucx.async_tick);

oshmem/mca/sshmem/ucx/sshmem_ucx_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ segment_create_internal(map_segment_t *ds_buf, void *address, size_t size,
124124

125125
mem_map_params.address = address;
126126
mem_map_params.length = size;
127-
mem_map_params.flags = flags;
127+
mem_map_params.flags = flags |
128+
mca_spml_ucx_mem_map_flags_symmetric_rkey(spml);
128129

129130
status = ucp_mem_map(spml->ucp_context, &mem_map_params, &mem_h);
130131
if (UCS_OK != status) {

0 commit comments

Comments
 (0)