Skip to content

Commit 7483a66

Browse files
committed
Merge pull request #1455 from igor-ivanov/pr/oshmem-v1.3
oshmem: Add Non-blocking Remote Memory Access Routines
2 parents 00bf598 + 36c29b3 commit 7483a66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1507
-12
lines changed

oshmem/include/pshmem.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ OSHMEM_DECLSPEC void pshmem_iput32(void* target, const void* source, ptrdiff_t t
128128
OSHMEM_DECLSPEC void pshmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
129129
OSHMEM_DECLSPEC void pshmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
130130

131+
/*
132+
* Nonblocking put routines
133+
*/
134+
OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe);
135+
OSHMEM_DECLSPEC void pshmem_char_put_nbi(char *target, const char *source, size_t len, int pe);
136+
OSHMEM_DECLSPEC void pshmem_short_put_nbi(short *target, const short *source, size_t len, int pe);
137+
OSHMEM_DECLSPEC void pshmem_int_put_nbi(int* target, const int* source, size_t len, int pe);
138+
OSHMEM_DECLSPEC void pshmem_long_put_nbi(long *target, const long *source, size_t len, int pe);
139+
OSHMEM_DECLSPEC void pshmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe);
140+
OSHMEM_DECLSPEC void pshmem_float_put_nbi(float *target, const float *source, size_t len, int pe);
141+
OSHMEM_DECLSPEC void pshmem_double_put_nbi(double *target, const double *source, size_t len, int pe);
142+
OSHMEM_DECLSPEC void pshmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe);
143+
OSHMEM_DECLSPEC void pshmem_put8_nbi(void *target, const void *source, size_t len, int pe);
144+
OSHMEM_DECLSPEC void pshmem_put16_nbi(void *target, const void *source, size_t len, int pe);
145+
OSHMEM_DECLSPEC void pshmem_put32_nbi(void *target, const void *source, size_t len, int pe);
146+
OSHMEM_DECLSPEC void pshmem_put64_nbi(void *target, const void *source, size_t len, int pe);
147+
OSHMEM_DECLSPEC void pshmem_put128_nbi(void *target, const void *source, size_t len, int pe);
148+
131149
/*
132150
* Elemental get routines
133151
*/
@@ -169,6 +187,24 @@ OSHMEM_DECLSPEC void pshmem_iget32(void* target, const void* source, ptrdiff_t t
169187
OSHMEM_DECLSPEC void pshmem_iget64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
170188
OSHMEM_DECLSPEC void pshmem_iget128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
171189

190+
/*
191+
* Nonblocking data get routines
192+
*/
193+
OSHMEM_DECLSPEC void pshmem_getmem_nbi(void *target, const void *source, size_t len, int pe);
194+
OSHMEM_DECLSPEC void pshmem_char_get_nbi(char *target, const char *source, size_t len, int pe);
195+
OSHMEM_DECLSPEC void pshmem_short_get_nbi(short *target, const short *source, size_t len, int pe);
196+
OSHMEM_DECLSPEC void pshmem_int_get_nbi(int *target, const int *source, size_t len, int pe);
197+
OSHMEM_DECLSPEC void pshmem_long_get_nbi(long *target, const long *source, size_t len, int pe);
198+
OSHMEM_DECLSPEC void pshmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe);
199+
OSHMEM_DECLSPEC void pshmem_float_get_nbi(float *target, const float *source, size_t len, int pe);
200+
OSHMEM_DECLSPEC void pshmem_double_get_nbi(double *target, const double *source, size_t len, int pe);
201+
OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe);
202+
OSHMEM_DECLSPEC void pshmem_get8_nbi(void *target, const void *source, size_t len, int pe);
203+
OSHMEM_DECLSPEC void pshmem_get16_nbi(void *target, const void *source, size_t len, int pe);
204+
OSHMEM_DECLSPEC void pshmem_get32_nbi(void *target, const void *source, size_t len, int pe);
205+
OSHMEM_DECLSPEC void pshmem_get64_nbi(void *target, const void *source, size_t len, int pe);
206+
OSHMEM_DECLSPEC void pshmem_get128_nbi(void *target, const void *source, size_t len, int pe);
207+
172208
/*
173209
* Atomic operations
174210
*/

oshmem/include/shmem.h.in

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ OSHMEM_DECLSPEC void shmem_iput32(void* target, const void* source, ptrdiff_t ts
191191
OSHMEM_DECLSPEC void shmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
192192
OSHMEM_DECLSPEC void shmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
193193

194+
/*
195+
* Nonblocking put routines
196+
*/
197+
OSHMEM_DECLSPEC void shmem_putmem_nbi(void *target, const void *source, size_t len, int pe);
198+
OSHMEM_DECLSPEC void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe);
199+
OSHMEM_DECLSPEC void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe);
200+
OSHMEM_DECLSPEC void shmem_int_put_nbi(int* target, const int* source, size_t len, int pe);
201+
OSHMEM_DECLSPEC void shmem_long_put_nbi(long *target, const long *source, size_t len, int pe);
202+
OSHMEM_DECLSPEC void shmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe);
203+
OSHMEM_DECLSPEC void shmem_float_put_nbi(float *target, const float *source, size_t len, int pe);
204+
OSHMEM_DECLSPEC void shmem_double_put_nbi(double *target, const double *source, size_t len, int pe);
205+
OSHMEM_DECLSPEC void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe);
206+
OSHMEM_DECLSPEC void shmem_put8_nbi(void *target, const void *source, size_t len, int pe);
207+
OSHMEM_DECLSPEC void shmem_put16_nbi(void *target, const void *source, size_t len, int pe);
208+
OSHMEM_DECLSPEC void shmem_put32_nbi(void *target, const void *source, size_t len, int pe);
209+
OSHMEM_DECLSPEC void shmem_put64_nbi(void *target, const void *source, size_t len, int pe);
210+
OSHMEM_DECLSPEC void shmem_put128_nbi(void *target, const void *source, size_t len, int pe);
211+
194212
/*
195213
* Elemental get routines
196214
*/
@@ -232,6 +250,24 @@ OSHMEM_DECLSPEC void shmem_iget32(void* target, const void* source, ptrdiff_t ts
232250
OSHMEM_DECLSPEC void shmem_iget64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
233251
OSHMEM_DECLSPEC void shmem_iget128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
234252

253+
/*
254+
* Nonblocking data get routines
255+
*/
256+
OSHMEM_DECLSPEC void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe);
257+
OSHMEM_DECLSPEC void shmem_char_get_nbi(char *target, const char *source, size_t len, int pe);
258+
OSHMEM_DECLSPEC void shmem_short_get_nbi(short *target, const short *source, size_t len, int pe);
259+
OSHMEM_DECLSPEC void shmem_int_get_nbi(int *target, const int *source, size_t len, int pe);
260+
OSHMEM_DECLSPEC void shmem_long_get_nbi(long *target, const long *source, size_t len, int pe);
261+
OSHMEM_DECLSPEC void shmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe);
262+
OSHMEM_DECLSPEC void shmem_float_get_nbi(float *target, const float *source, size_t len, int pe);
263+
OSHMEM_DECLSPEC void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe);
264+
OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe);
265+
OSHMEM_DECLSPEC void shmem_get8_nbi(void *target, const void *source, size_t len, int pe);
266+
OSHMEM_DECLSPEC void shmem_get16_nbi(void *target, const void *source, size_t len, int pe);
267+
OSHMEM_DECLSPEC void shmem_get32_nbi(void *target, const void *source, size_t len, int pe);
268+
OSHMEM_DECLSPEC void shmem_get64_nbi(void *target, const void *source, size_t len, int pe);
269+
OSHMEM_DECLSPEC void shmem_get128_nbi(void *target, const void *source, size_t len, int pe);
270+
235271
/*
236272
* Atomic operations
237273
*/

oshmem/mca/spml/base/base.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ OSHMEM_DECLSPEC int mca_spml_base_oob_get_mkeys(int pe,
7171

7272
OSHMEM_DECLSPEC void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, int pe);
7373
OSHMEM_DECLSPEC void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey);
74+
OSHMEM_DECLSPEC int mca_spml_base_put_nb(void *dst_addr,
75+
size_t size,
76+
void *src_addr,
77+
int dst,
78+
void **handle);
79+
OSHMEM_DECLSPEC int mca_spml_base_get_nb(void *dst_addr,
80+
size_t size,
81+
void *src_addr,
82+
int src,
83+
void **handle);
7484

7585
/*
7686
* MCA framework

oshmem/mca/spml/base/spml_base.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,15 @@ void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, int pe)
165165
void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey)
166166
{
167167
}
168+
169+
int mca_spml_base_put_nb(void *dst_addr, size_t size,
170+
void *src_addr, int dst, void **handle)
171+
{
172+
return OSHMEM_ERROR;
173+
}
174+
175+
int mca_spml_base_get_nb(void *dst_addr, size_t size,
176+
void *src_addr, int src, void **handle)
177+
{
178+
return OSHMEM_ERROR;
179+
}

oshmem/mca/spml/ikrit/spml_ikrit.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ mca_spml_ikrit_t mca_spml_ikrit = {
221221
mca_spml_ikrit_put,
222222
mca_spml_ikrit_put_nb,
223223
mca_spml_ikrit_get,
224+
mca_spml_ikrit_get_nb,
224225
mca_spml_ikrit_recv,
225226
mca_spml_ikrit_send,
226227
mca_spml_base_wait,
@@ -871,6 +872,15 @@ static inline int mca_spml_ikrit_get_shm(void *src_addr,
871872
return OSHMEM_SUCCESS;
872873
}
873874

875+
int mca_spml_ikrit_get_nb(void* src_addr,
876+
size_t size,
877+
void* dst_addr,
878+
int src,
879+
void **handle)
880+
{
881+
return mca_spml_ikrit_get_async(src_addr, size, dst_addr, src);
882+
}
883+
874884
int mca_spml_ikrit_get(void *src_addr, size_t size, void *dst_addr, int src)
875885
{
876886
mxm_send_req_t sreq;

oshmem/mca/spml/ikrit/spml_ikrit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ extern int mca_spml_ikrit_get(void* dst_addr,
130130
size_t size,
131131
void* src_addr,
132132
int src);
133+
extern int mca_spml_ikrit_get_nb(void* src_addr,
134+
size_t size,
135+
void* dst_addr,
136+
int src,
137+
void **handle);
133138
/* extension. used 4 fence implementation b4 fence was added to mxm */
134139
extern int mca_spml_ikrit_get_async(void *src_addr,
135140
size_t size,

oshmem/mca/spml/spml.h

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,35 @@ typedef int (*mca_spml_base_module_put_nb_fn_t)(void *dst_addr,
208208
* Blocking data transfer from remote PE.
209209
* Read data from remote PE.
210210
*
211-
* @param dst_addr - The address on the local PE, to write the result of the get operation to.
212-
* @param size - The number of bytes to be read.
213-
* @param src_addr - The address on the remote PE, to read from.
214-
* @param src - The ID of the remote PE.
215-
* @return - OSHMEM_SUCCESS or failure status.
211+
* @param dst_addr The address on the local PE, to write the result of the get operation to.
212+
* @param size The number of bytes to be read.
213+
* @param src_addr The address on the remote PE, to read from.
214+
* @param src The ID of the remote PE.
215+
* @return OSHMEM_SUCCESS or failure status.
216216
*/
217217
typedef int (*mca_spml_base_module_get_fn_t)(void *dst_addr,
218218
size_t size,
219219
void *src_addr,
220220
int src);
221221

222+
/**
223+
* Non-blocking data transfer from remote PE.
224+
* Read data from remote PE.
225+
*
226+
* @param dst_addr The address on the local PE, to write the result of the get operation to.
227+
* @param size The number of bytes to be read.
228+
* @param src_addr The address on the remote PE, to read from.
229+
* @param src The ID of the remote PE.
230+
* @param handle The address of a handle to be passed to shmem_wait_nb() or
231+
* shmem_test_nb() to wait or poll for the completion of the transfer.
232+
* @return - OSHMEM_SUCCESS or failure status.
233+
*/
234+
typedef int (*mca_spml_base_module_get_nb_fn_t)(void *dst_addr,
235+
size_t size,
236+
void *src_addr,
237+
int src,
238+
void **handle);
239+
222240
/**
223241
* Post a receive and wait for completion.
224242
*
@@ -255,7 +273,7 @@ typedef int (*mca_spml_base_module_fence_fn_t)(void);
255273
*
256274
* @return - OSHMEM_SUCCESS or failure status.
257275
*/
258-
typedef int (*mca_spml_base_module_wait_nb_fn_t)(void*);
276+
typedef int (*mca_spml_base_module_wait_nb_fn_t)(void *);
259277

260278
/**
261279
* SPML instance.
@@ -273,6 +291,7 @@ struct mca_spml_base_module_1_0_0_t {
273291
mca_spml_base_module_put_fn_t spml_put;
274292
mca_spml_base_module_put_nb_fn_t spml_put_nb;
275293
mca_spml_base_module_get_fn_t spml_get;
294+
mca_spml_base_module_get_nb_fn_t spml_get_nb;
276295

277296
mca_spml_base_module_recv_fn_t spml_recv;
278297
mca_spml_base_module_send_fn_t spml_send;

oshmem/mca/spml/ucx/spml_ucx.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ mca_spml_ucx_t mca_spml_ucx = {
5353
mca_spml_ucx_deregister,
5454
mca_spml_base_oob_get_mkeys,
5555
mca_spml_ucx_put,
56-
NULL, /* todo: mca_spml_ucx_put_nb, */
56+
mca_spml_ucx_put_nb,
5757
mca_spml_ucx_get,
58+
mca_spml_ucx_get_nb,
5859
mca_spml_ucx_recv,
5960
mca_spml_ucx_send,
6061
mca_spml_base_wait,
@@ -390,6 +391,19 @@ int mca_spml_ucx_get(void *src_addr, size_t size, void *dst_addr, int src)
390391
return ucx_status_to_oshmem(status);
391392
}
392393

394+
int mca_spml_ucx_get_nb(void *src_addr, size_t size, void *dst_addr, int src, void **handle)
395+
{
396+
void *rva;
397+
ucs_status_t status;
398+
spml_ucx_mkey_t *ucx_mkey;
399+
400+
ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva);
401+
status = ucp_get_nbi(mca_spml_ucx.ucp_peers[src].ucp_conn, dst_addr, size,
402+
(uint64_t)rva, ucx_mkey->rkey);
403+
404+
return ucx_status_to_oshmem(status);
405+
}
406+
393407
int mca_spml_ucx_put(void* dst_addr, size_t size, void* src_addr, int dst)
394408
{
395409
void *rva;
@@ -403,6 +417,19 @@ int mca_spml_ucx_put(void* dst_addr, size_t size, void* src_addr, int dst)
403417
return ucx_status_to_oshmem(status);
404418
}
405419

420+
int mca_spml_ucx_put_nb(void* dst_addr, size_t size, void* src_addr, int dst, void **handle)
421+
{
422+
void *rva;
423+
ucs_status_t status;
424+
spml_ucx_mkey_t *ucx_mkey;
425+
426+
ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva);
427+
status = ucp_put_nbi(mca_spml_ucx.ucp_peers[dst].ucp_conn, src_addr, size,
428+
(uint64_t)rva, ucx_mkey->rkey);
429+
430+
return ucx_status_to_oshmem(status);
431+
}
432+
406433
int mca_spml_ucx_fence(void)
407434
{
408435
ucs_status_t err;

oshmem/mca/spml/ucx/spml_ucx.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ extern int mca_spml_ucx_get(void* dst_addr,
7070
size_t size,
7171
void* src_addr,
7272
int src);
73+
extern int mca_spml_ucx_get_nb(void* dst_addr,
74+
size_t size,
75+
void* src_addr,
76+
int src,
77+
void **handle);
7378

7479
extern int mca_spml_ucx_put(void* dst_addr,
7580
size_t size,

oshmem/mca/spml/yoda/spml_yoda.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ mca_spml_yoda_module_t mca_spml_yoda = {
5757
mca_spml_yoda_put,
5858
mca_spml_yoda_put_nb,
5959
mca_spml_yoda_get,
60+
mca_spml_yoda_get_nb,
6061
mca_spml_yoda_recv,
6162
mca_spml_yoda_send,
6263
mca_spml_base_wait,
@@ -900,6 +901,8 @@ int mca_spml_yoda_put_nb(void* dst_addr,
900901
{
901902
UNREFERENCED_PARAMETER(handle);
902903

904+
/* TODO: real nonblocking operation is needed
905+
*/
903906
return mca_spml_yoda_put_internal(dst_addr, size, src_addr, dst, 1);
904907
}
905908

@@ -973,6 +976,17 @@ int mca_spml_yoda_enable(bool enable)
973976
return OSHMEM_SUCCESS;
974977
}
975978

979+
int mca_spml_yoda_get_nb(void* src_addr,
980+
size_t size,
981+
void* dst_addr,
982+
int src,
983+
void **handle)
984+
{
985+
/* TODO: real nonblocking operation is needed
986+
*/
987+
return mca_spml_yoda_get(src_addr, size, dst_addr, src);
988+
}
989+
976990
/**
977991
* shmem_get reads data from a remote address
978992
* in the symmetric heap via RDMA READ.

0 commit comments

Comments
 (0)