2013-09-10 19:34:09 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2013-09-10 19:34:09 +04:00
|
|
|
* Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2013-09-10 19:34:09 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
|
|
|
|
#include "oshmem/constants.h"
|
|
|
|
#include "oshmem/include/shmem.h"
|
|
|
|
|
|
|
|
#include "oshmem/runtime/runtime.h"
|
|
|
|
|
|
|
|
#include "oshmem/mca/spml/spml.h"
|
|
|
|
|
|
|
|
/*
|
2015-06-24 06:59:57 +03:00
|
|
|
* These routines retrieve data from a contiguous data object on a remote PE.
|
2013-09-10 19:34:09 +04:00
|
|
|
* The shmem_get() routines transfer nelems elements of the data object at address source
|
|
|
|
* on the remote PE (pe), to the data object at address target on the local PE. These routines
|
|
|
|
* return after the data has been copied to address target on the local pe.
|
|
|
|
*/
|
|
|
|
#define SHMEM_TYPE_GET(type_name, type) \
|
|
|
|
void shmem##type_name##_get(type *target, const type *source, size_t nelems, int pe) \
|
|
|
|
{ \
|
|
|
|
int rc = OSHMEM_SUCCESS; \
|
|
|
|
size_t size = 0; \
|
|
|
|
\
|
|
|
|
RUNTIME_CHECK_INIT(); \
|
|
|
|
RUNTIME_CHECK_PE(pe); \
|
|
|
|
RUNTIME_CHECK_ADDR(source); \
|
|
|
|
\
|
|
|
|
size = nelems * sizeof(type); \
|
|
|
|
rc = MCA_SPML_CALL(get( \
|
|
|
|
(void*)source, \
|
|
|
|
size, \
|
|
|
|
(void*)target, \
|
|
|
|
pe)); \
|
|
|
|
RUNTIME_CHECK_RC(rc); \
|
|
|
|
\
|
|
|
|
return ; \
|
|
|
|
}
|
|
|
|
|
2014-04-08 02:55:21 +04:00
|
|
|
#if OSHMEM_PROFILING
|
2014-04-22 20:49:20 +04:00
|
|
|
#include "oshmem/include/pshmem.h"
|
2014-04-08 02:55:21 +04:00
|
|
|
#pragma weak shmem_char_get = pshmem_char_get
|
|
|
|
#pragma weak shmem_short_get = pshmem_short_get
|
|
|
|
#pragma weak shmem_int_get = pshmem_int_get
|
|
|
|
#pragma weak shmem_long_get = pshmem_long_get
|
|
|
|
#pragma weak shmem_longlong_get = pshmem_longlong_get
|
|
|
|
#pragma weak shmem_float_get = pshmem_float_get
|
|
|
|
#pragma weak shmem_double_get = pshmem_double_get
|
|
|
|
#pragma weak shmem_longdouble_get = pshmem_longdouble_get
|
2014-04-19 09:09:07 +04:00
|
|
|
#pragma weak shmem_getmem = pshmem_getmem
|
2014-04-30 16:03:23 +04:00
|
|
|
#pragma weak shmem_get16 = pshmem_get16
|
2014-04-19 09:09:07 +04:00
|
|
|
#pragma weak shmem_get32 = pshmem_get32
|
|
|
|
#pragma weak shmem_get64 = pshmem_get64
|
|
|
|
#pragma weak shmem_get128 = pshmem_get128
|
2014-04-17 00:00:34 +04:00
|
|
|
#include "oshmem/shmem/c/profile/defines.h"
|
2014-04-08 02:55:21 +04:00
|
|
|
#endif
|
|
|
|
|
2013-09-10 19:34:09 +04:00
|
|
|
SHMEM_TYPE_GET(_char, char)
|
|
|
|
SHMEM_TYPE_GET(_short, short)
|
|
|
|
SHMEM_TYPE_GET(_int, int)
|
|
|
|
SHMEM_TYPE_GET(_long, long)
|
|
|
|
SHMEM_TYPE_GET(_longlong, long long)
|
|
|
|
SHMEM_TYPE_GET(_float, float)
|
|
|
|
SHMEM_TYPE_GET(_double, double)
|
|
|
|
SHMEM_TYPE_GET(_longdouble, long double)
|
|
|
|
|
|
|
|
#define SHMEM_TYPE_GETMEM(name, element_size) \
|
|
|
|
void shmem##name(void *target, const void *source, size_t nelems, int pe) \
|
|
|
|
{ \
|
|
|
|
int rc = OSHMEM_SUCCESS; \
|
|
|
|
size_t size = 0; \
|
|
|
|
\
|
|
|
|
RUNTIME_CHECK_INIT(); \
|
|
|
|
RUNTIME_CHECK_PE(pe); \
|
|
|
|
RUNTIME_CHECK_ADDR(source); \
|
|
|
|
\
|
|
|
|
size = nelems * element_size; \
|
|
|
|
rc = MCA_SPML_CALL(get( \
|
|
|
|
(void*)source, \
|
|
|
|
size, \
|
|
|
|
(void*)target, \
|
|
|
|
pe)); \
|
|
|
|
RUNTIME_CHECK_RC(rc); \
|
|
|
|
\
|
|
|
|
return ; \
|
|
|
|
}
|
|
|
|
|
|
|
|
SHMEM_TYPE_GETMEM(_getmem, 1)
|
2014-04-30 16:03:23 +04:00
|
|
|
SHMEM_TYPE_GETMEM(_get16, 2)
|
2013-09-10 19:34:09 +04:00
|
|
|
SHMEM_TYPE_GETMEM(_get32, 4)
|
|
|
|
SHMEM_TYPE_GETMEM(_get64, 8)
|
|
|
|
SHMEM_TYPE_GETMEM(_get128, 16)
|
|
|
|
|
|
|
|
SHMEM_TYPE_GETMEM(_get, sizeof(long))
|