Skip to content

Commit ee139f5

Browse files
authored
Merge pull request #2095 from igor-ivanov/pr/v2.x/pr1455
v2.x: oshmem: Align OSHMEM API with spec v1.3
2 parents b59ca84 + d4fbe6d commit ee139f5

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

+1505
-10
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
@@ -193,6 +193,24 @@ OSHMEM_DECLSPEC void shmem_iput32(void* target, const void* source, ptrdiff_t ts
193193
OSHMEM_DECLSPEC void shmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
194194
OSHMEM_DECLSPEC void shmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
195195

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

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

oshmem/mca/spml/base/base.h

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

7474
OSHMEM_DECLSPEC void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, int pe);
7575
OSHMEM_DECLSPEC void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey);
76+
OSHMEM_DECLSPEC int mca_spml_base_put_nb(void *dst_addr,
77+
size_t size,
78+
void *src_addr,
79+
int dst,
80+
void **handle);
81+
OSHMEM_DECLSPEC int mca_spml_base_get_nb(void *dst_addr,
82+
size_t size,
83+
void *src_addr,
84+
int src,
85+
void **handle);
7686

7787
/*
7888
* 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
@@ -134,6 +134,11 @@ extern int mca_spml_ikrit_get(void* dst_addr,
134134
size_t size,
135135
void* src_addr,
136136
int src);
137+
extern int mca_spml_ikrit_get_nb(void* src_addr,
138+
size_t size,
139+
void* dst_addr,
140+
int src,
141+
void **handle);
137142
/* extension. used 4 fence implementation b4 fence was added to mxm */
138143
extern int mca_spml_ikrit_get_async(void *src_addr,
139144
size_t size,

oshmem/mca/spml/spml.h

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

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

262280
/**
263281
* SPML instance.
@@ -275,6 +293,7 @@ struct mca_spml_base_module_1_0_0_t {
275293
mca_spml_base_module_put_fn_t spml_put;
276294
mca_spml_base_module_put_nb_fn_t spml_put_nb;
277295
mca_spml_base_module_get_fn_t spml_get;
296+
mca_spml_base_module_get_nb_fn_t spml_get_nb;
278297

279298
mca_spml_base_module_recv_fn_t spml_recv;
280299
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
@@ -72,6 +72,11 @@ extern int mca_spml_ucx_get(void* dst_addr,
7272
size_t size,
7373
void* src_addr,
7474
int src);
75+
extern int mca_spml_ucx_get_nb(void* dst_addr,
76+
size_t size,
77+
void* src_addr,
78+
int src,
79+
void **handle);
7580

7681
extern int mca_spml_ucx_put(void* dst_addr,
7782
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,
@@ -906,6 +907,8 @@ int mca_spml_yoda_put_nb(void* dst_addr,
906907
{
907908
UNREFERENCED_PARAMETER(handle);
908909

910+
/* TODO: real nonblocking operation is needed
911+
*/
909912
return mca_spml_yoda_put_internal(dst_addr, size, src_addr, dst, 1);
910913
}
911914

@@ -979,6 +982,17 @@ int mca_spml_yoda_enable(bool enable)
979982
return OSHMEM_SUCCESS;
980983
}
981984

985+
int mca_spml_yoda_get_nb(void* src_addr,
986+
size_t size,
987+
void* dst_addr,
988+
int src,
989+
void **handle)
990+
{
991+
/* TODO: real nonblocking operation is needed
992+
*/
993+
return mca_spml_yoda_get(src_addr, size, dst_addr, src);
994+
}
995+
982996
/**
983997
* shmem_get reads data from a remote address
984998
* in the symmetric heap via RDMA READ.

oshmem/mca/spml/yoda/spml_yoda.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ extern int mca_spml_yoda_get(void* dst_addr,
104104
size_t size,
105105
void* src_addr,
106106
int src);
107+
extern int mca_spml_yoda_get_nb(void* dst_addr,
108+
size_t size,
109+
void* src_addr,
110+
int dst,
111+
void **handle);
107112
extern int mca_spml_yoda_put(void* dst_addr,
108113
size_t size,
109114
void* src_addr,

oshmem/shmem/c/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013-2015 Mellanox Technologies, Inc.
2+
# Copyright (c) 2013-2016 Mellanox Technologies, Inc.
33
# All rights reserved
44
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
55
# $COPYRIGHT$
@@ -41,6 +41,8 @@ OSHMEM_API_SOURCES = \
4141
shmem_wait.c \
4242
shmem_iget.c \
4343
shmem_iput.c \
44+
shmem_get_nb.c \
45+
shmem_put_nb.c \
4446
shmem_udcflush.c \
4547
shmem_udcflush_line.c \
4648
shmem_set_cache_inv.c \

oshmem/shmem/c/profile/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ OSHMEM_API_SOURCES = \
5353
pshmem_wait.c \
5454
pshmem_iget.c \
5555
pshmem_iput.c \
56+
pshmem_get_nb.c \
57+
pshmem_put_nb.c \
5658
pshmem_udcflush.c \
5759
pshmem_udcflush_line.c \
5860
pshmem_set_cache_inv.c \

0 commit comments

Comments
 (0)