Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

v2.x: oshmem: Align OSHMEM API with spec v1.3 (nonblocking put/get) (this PR depends on #913) #1041

Closed
wants to merge 8 commits into from
Closed
36 changes: 36 additions & 0 deletions oshmem/include/pshmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@ OSHMEM_DECLSPEC void pshmem_iput32(void* target, const void* source, ptrdiff_t t
OSHMEM_DECLSPEC void pshmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
* Nonblocking put routines
*/
OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_char_put_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_short_put_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_int_put_nbi(int* target, const int* source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_long_put_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_float_put_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_double_put_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_put8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_put16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_put32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_put64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_put128_nbi(void *target, const void *source, size_t len, int pe);

/*
* Elemental get routines
*/
Expand Down Expand Up @@ -169,6 +187,24 @@ OSHMEM_DECLSPEC void pshmem_iget32(void* target, const void* source, ptrdiff_t t
OSHMEM_DECLSPEC void pshmem_iget64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_iget128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
* Nonblocking data get routines
*/
OSHMEM_DECLSPEC void pshmem_getmem_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_char_get_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_short_get_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_int_get_nbi(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_long_get_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_float_get_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_double_get_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_get8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_get16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_get32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_get64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void pshmem_get128_nbi(void *target, const void *source, size_t len, int pe);

/*
* Atomic operations
*/
Expand Down
36 changes: 36 additions & 0 deletions oshmem/include/shmem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ OSHMEM_DECLSPEC void shmem_iput32(void* target, const void* source, ptrdiff_t ts
OSHMEM_DECLSPEC void shmem_iput64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iput128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
* Nonblocking put routines
*/
OSHMEM_DECLSPEC void shmem_putmem_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int_put_nbi(int* target, const int* source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_long_put_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_float_put_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_double_put_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_put8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_put16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_put32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_put64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_put128_nbi(void *target, const void *source, size_t len, int pe);

/*
* Elemental get routines
*/
Expand Down Expand Up @@ -234,6 +252,24 @@ OSHMEM_DECLSPEC void shmem_iget32(void* target, const void* source, ptrdiff_t ts
OSHMEM_DECLSPEC void shmem_iget64(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);
OSHMEM_DECLSPEC void shmem_iget128(void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe);

/*
* Nonblocking data get routines
*/
OSHMEM_DECLSPEC void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_char_get_nbi(char *target, const char *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_short_get_nbi(short *target, const short *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_int_get_nbi(int *target, const int *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_long_get_nbi(long *target, const long *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_float_get_nbi(float *target, const float *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_get8_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_get16_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_get32_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_get64_nbi(void *target, const void *source, size_t len, int pe);
OSHMEM_DECLSPEC void shmem_get128_nbi(void *target, const void *source, size_t len, int pe);

/*
* Atomic operations
*/
Expand Down
10 changes: 10 additions & 0 deletions oshmem/mca/spml/base/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ OSHMEM_DECLSPEC int mca_spml_base_oob_get_mkeys(int pe,

OSHMEM_DECLSPEC void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, int pe);
OSHMEM_DECLSPEC void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey);
OSHMEM_DECLSPEC int mca_spml_base_put_nb(void *dst_addr,
size_t size,
void *src_addr,
int dst,
void **handle);
OSHMEM_DECLSPEC int mca_spml_base_get_nb(void *dst_addr,
size_t size,
void *src_addr,
int src,
void **handle);

/*
* MCA framework
Expand Down
12 changes: 12 additions & 0 deletions oshmem/mca/spml/base/spml_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,15 @@ void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, int pe)
void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey)
{
}

int mca_spml_base_put_nb(void *dst_addr, size_t size,
void *src_addr, int dst, void **handle)
{
return OSHMEM_ERROR;
}

int mca_spml_base_get_nb(void *dst_addr, size_t size,
void *src_addr, int src, void **handle)
{
return OSHMEM_ERROR;
}
10 changes: 10 additions & 0 deletions oshmem/mca/spml/ikrit/spml_ikrit.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ mca_spml_ikrit_t mca_spml_ikrit = {
mca_spml_ikrit_put,
mca_spml_ikrit_put_nb,
mca_spml_ikrit_get,
mca_spml_ikrit_get_nb,
mca_spml_ikrit_recv,
mca_spml_ikrit_send,
mca_spml_base_wait,
Expand Down Expand Up @@ -871,6 +872,15 @@ static inline int mca_spml_ikrit_get_shm(void *src_addr,
return OSHMEM_SUCCESS;
}

int mca_spml_ikrit_get_nb(void* src_addr,
size_t size,
void* dst_addr,
int src,
void **handle)
{
return mca_spml_ikrit_get_async(src_addr, size, dst_addr, src);
}

int mca_spml_ikrit_get(void *src_addr, size_t size, void *dst_addr, int src)
{
mxm_send_req_t sreq;
Expand Down
5 changes: 5 additions & 0 deletions oshmem/mca/spml/ikrit/spml_ikrit.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ extern int mca_spml_ikrit_get(void* dst_addr,
size_t size,
void* src_addr,
int src);
extern int mca_spml_ikrit_get_nb(void* src_addr,
size_t size,
void* dst_addr,
int src,
void **handle);
/* extension. used 4 fence implementation b4 fence was added to mxm */
extern int mca_spml_ikrit_get_async(void *src_addr,
size_t size,
Expand Down
31 changes: 25 additions & 6 deletions oshmem/mca/spml/spml.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,35 @@ typedef int (*mca_spml_base_module_put_nb_fn_t)(void *dst_addr,
* Blocking data transfer from remote PE.
* Read data from remote PE.
*
* @param dst_addr - The address on the local PE, to write the result of the get operation to.
* @param size - The number of bytes to be read.
* @param src_addr - The address on the remote PE, to read from.
* @param src - The ID of the remote PE.
* @return - OSHMEM_SUCCESS or failure status.
* @param dst_addr The address on the local PE, to write the result of the get operation to.
* @param size The number of bytes to be read.
* @param src_addr The address on the remote PE, to read from.
* @param src The ID of the remote PE.
* @return OSHMEM_SUCCESS or failure status.
*/
typedef int (*mca_spml_base_module_get_fn_t)(void *dst_addr,
size_t size,
void *src_addr,
int src);

/**
* Non-blocking data transfer from remote PE.
* Read data from remote PE.
*
* @param dst_addr The address on the local PE, to write the result of the get operation to.
* @param size The number of bytes to be read.
* @param src_addr The address on the remote PE, to read from.
* @param src The ID of the remote PE.
* @param handle The address of a handle to be passed to shmem_wait_nb() or
* shmem_test_nb() to wait or poll for the completion of the transfer.
* @return - OSHMEM_SUCCESS or failure status.
*/
typedef int (*mca_spml_base_module_get_nb_fn_t)(void *dst_addr,
size_t size,
void *src_addr,
int src,
void **handle);

/**
* Post a receive and wait for completion.
*
Expand Down Expand Up @@ -257,7 +275,7 @@ typedef int (*mca_spml_base_module_fence_fn_t)(void);
*
* @return - OSHMEM_SUCCESS or failure status.
*/
typedef int (*mca_spml_base_module_wait_nb_fn_t)(void*);
typedef int (*mca_spml_base_module_wait_nb_fn_t)(void *);

/**
* SPML instance.
Expand All @@ -275,6 +293,7 @@ struct mca_spml_base_module_1_0_0_t {
mca_spml_base_module_put_fn_t spml_put;
mca_spml_base_module_put_nb_fn_t spml_put_nb;
mca_spml_base_module_get_fn_t spml_get;
mca_spml_base_module_get_nb_fn_t spml_get_nb;

mca_spml_base_module_recv_fn_t spml_recv;
mca_spml_base_module_send_fn_t spml_send;
Expand Down
29 changes: 28 additions & 1 deletion oshmem/mca/spml/ucx/spml_ucx.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ mca_spml_ucx_t mca_spml_ucx = {
mca_spml_ucx_deregister,
mca_spml_base_oob_get_mkeys,
mca_spml_ucx_put,
NULL, /* todo: mca_spml_ucx_put_nb, */
mca_spml_ucx_put_nb,
mca_spml_ucx_get,
mca_spml_ucx_get_nb,
mca_spml_ucx_recv,
mca_spml_ucx_send,
mca_spml_base_wait,
Expand Down Expand Up @@ -390,6 +391,19 @@ int mca_spml_ucx_get(void *src_addr, size_t size, void *dst_addr, int src)
return ucx_status_to_oshmem(status);
}

int mca_spml_ucx_get_nb(void *src_addr, size_t size, void *dst_addr, int src, void **handle)
{
void *rva;
ucs_status_t status;
spml_ucx_mkey_t *ucx_mkey;

ucx_mkey = mca_spml_ucx_get_mkey(src, src_addr, &rva);
status = ucp_get_nbi(mca_spml_ucx.ucp_peers[src].ucp_conn, dst_addr, size,
(uint64_t)rva, ucx_mkey->rkey);

return ucx_status_to_oshmem(status);
}

int mca_spml_ucx_put(void* dst_addr, size_t size, void* src_addr, int dst)
{
void *rva;
Expand All @@ -403,6 +417,19 @@ int mca_spml_ucx_put(void* dst_addr, size_t size, void* src_addr, int dst)
return ucx_status_to_oshmem(status);
}

int mca_spml_ucx_put_nb(void* dst_addr, size_t size, void* src_addr, int dst, void **handle)
{
void *rva;
ucs_status_t status;
spml_ucx_mkey_t *ucx_mkey;

ucx_mkey = mca_spml_ucx_get_mkey(dst, dst_addr, &rva);
status = ucp_put_nbi(mca_spml_ucx.ucp_peers[dst].ucp_conn, src_addr, size,
(uint64_t)rva, ucx_mkey->rkey);

return ucx_status_to_oshmem(status);
}

int mca_spml_ucx_fence(void)
{
ucs_status_t err;
Expand Down
5 changes: 5 additions & 0 deletions oshmem/mca/spml/ucx/spml_ucx.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ extern int mca_spml_ucx_get(void* dst_addr,
size_t size,
void* src_addr,
int src);
extern int mca_spml_ucx_get_nb(void* dst_addr,
size_t size,
void* src_addr,
int src,
void **handle);

extern int mca_spml_ucx_put(void* dst_addr,
size_t size,
Expand Down
14 changes: 14 additions & 0 deletions oshmem/mca/spml/yoda/spml_yoda.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ mca_spml_yoda_module_t mca_spml_yoda = {
mca_spml_yoda_put,
mca_spml_yoda_put_nb,
mca_spml_yoda_get,
mca_spml_yoda_get_nb,
mca_spml_yoda_recv,
mca_spml_yoda_send,
mca_spml_base_wait,
Expand Down Expand Up @@ -906,6 +907,8 @@ int mca_spml_yoda_put_nb(void* dst_addr,
{
UNREFERENCED_PARAMETER(handle);

/* TODO: real nonblocking operation is needed
*/
return mca_spml_yoda_put_internal(dst_addr, size, src_addr, dst, 1);
}

Expand Down Expand Up @@ -979,6 +982,17 @@ int mca_spml_yoda_enable(bool enable)
return OSHMEM_SUCCESS;
}

int mca_spml_yoda_get_nb(void* src_addr,
size_t size,
void* dst_addr,
int src,
void **handle)
{
/* TODO: real nonblocking operation is needed
*/
return mca_spml_yoda_get(src_addr, size, dst_addr, src);
}

/**
* shmem_get reads data from a remote address
* in the symmetric heap via RDMA READ.
Expand Down
5 changes: 5 additions & 0 deletions oshmem/mca/spml/yoda/spml_yoda.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ extern int mca_spml_yoda_get(void* dst_addr,
size_t size,
void* src_addr,
int src);
extern int mca_spml_yoda_get_nb(void* dst_addr,
size_t size,
void* src_addr,
int dst,
void **handle);
extern int mca_spml_yoda_put(void* dst_addr,
size_t size,
void* src_addr,
Expand Down
4 changes: 3 additions & 1 deletion oshmem/shmem/c/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2015 Mellanox Technologies, Inc.
# Copyright (c) 2013-2016 Mellanox Technologies, Inc.
# All rights reserved
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -41,6 +41,8 @@ OSHMEM_API_SOURCES = \
shmem_wait.c \
shmem_iget.c \
shmem_iput.c \
shmem_get_nb.c \
shmem_put_nb.c \
shmem_udcflush.c \
shmem_udcflush_line.c \
shmem_set_cache_inv.c \
Expand Down
2 changes: 2 additions & 0 deletions oshmem/shmem/c/profile/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ OSHMEM_API_SOURCES = \
pshmem_wait.c \
pshmem_iget.c \
pshmem_iput.c \
pshmem_get_nb.c \
pshmem_put_nb.c \
pshmem_udcflush.c \
pshmem_udcflush_line.c \
pshmem_set_cache_inv.c \
Expand Down
Loading