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 force the calling PE to wait until var is no longer equal to value.
|
2013-09-10 19:34:09 +04:00
|
|
|
* A call to any shmem_wait() routine does not return until some other processor makes the
|
|
|
|
* value at address var not equal to value.
|
|
|
|
*/
|
2015-11-27 15:17:38 +03:00
|
|
|
#define SHMEM_TYPE_WAIT(type_name, type, code, prefix) \
|
|
|
|
void prefix##type_name##_wait(type *addr, type value) \
|
2013-09-10 19:34:09 +04:00
|
|
|
{ \
|
|
|
|
int rc = OSHMEM_SUCCESS; \
|
|
|
|
\
|
|
|
|
RUNTIME_CHECK_INIT(); \
|
|
|
|
\
|
|
|
|
rc = MCA_SPML_CALL(wait( \
|
|
|
|
(void*)addr, \
|
|
|
|
SHMEM_CMP_NE, \
|
|
|
|
(void*)&value, \
|
|
|
|
code)); \
|
|
|
|
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_wait = pshmem_wait
|
|
|
|
#pragma weak shmem_short_wait = pshmem_short_wait
|
|
|
|
#pragma weak shmem_int_wait = pshmem_int_wait
|
|
|
|
#pragma weak shmem_long_wait = pshmem_long_wait
|
|
|
|
#pragma weak shmem_longlong_wait = pshmem_longlong_wait
|
2015-11-24 16:36:19 +03:00
|
|
|
#pragma weak shmemx_int32_wait = pshmemx_int32_wait
|
|
|
|
#pragma weak shmemx_int64_wait = pshmemx_int64_wait
|
2014-04-19 09:09:07 +04:00
|
|
|
#pragma weak shmem_wait_until = pshmem_wait_until
|
|
|
|
#pragma weak shmem_short_wait_until = pshmem_short_wait_until
|
|
|
|
#pragma weak shmem_int_wait_until = pshmem_int_wait_until
|
|
|
|
#pragma weak shmem_long_wait_until = pshmem_long_wait_until
|
|
|
|
#pragma weak shmem_longlong_wait_until = pshmem_longlong_wait_until
|
2015-11-24 16:36:19 +03:00
|
|
|
#pragma weak shmemx_int32_wait_until = pshmemx_int32_wait_until
|
|
|
|
#pragma weak shmemx_int64_wait_until = pshmemx_int64_wait_until
|
2014-04-08 02:55:21 +04:00
|
|
|
#include "oshmem/shmem/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2016-04-13 16:09:54 +03:00
|
|
|
SHMEM_TYPE_WAIT(, volatile long, SHMEM_LONG, shmem)
|
|
|
|
SHMEM_TYPE_WAIT(_short, volatile short, SHMEM_SHORT, shmem)
|
|
|
|
SHMEM_TYPE_WAIT(_int, volatile int, SHMEM_INT, shmem)
|
|
|
|
SHMEM_TYPE_WAIT(_long, volatile long, SHMEM_LONG, shmem)
|
|
|
|
SHMEM_TYPE_WAIT(_longlong, volatile long long, SHMEM_LLONG, shmem)
|
2015-11-27 15:17:38 +03:00
|
|
|
SHMEM_TYPE_WAIT(_int32, int32_t, SHMEM_INT32_T, shmemx)
|
|
|
|
SHMEM_TYPE_WAIT(_int64, int64_t, SHMEM_INT64_T, shmemx)
|
2013-09-10 19:34:09 +04:00
|
|
|
|
2015-11-27 15:17:38 +03:00
|
|
|
#define SHMEM_TYPE_WAIT_UNTIL(type_name, type, code, prefix) \
|
|
|
|
void prefix##type_name##_wait_until(type *addr, int cmp, type value) \
|
2013-09-10 19:34:09 +04:00
|
|
|
{ \
|
|
|
|
int rc = OSHMEM_SUCCESS; \
|
|
|
|
\
|
|
|
|
RUNTIME_CHECK_INIT(); \
|
|
|
|
\
|
|
|
|
rc = MCA_SPML_CALL(wait( \
|
|
|
|
(void*)addr, \
|
|
|
|
cmp, \
|
|
|
|
(void*)&value, \
|
|
|
|
code)); \
|
|
|
|
RUNTIME_CHECK_RC(rc); \
|
|
|
|
\
|
|
|
|
return ; \
|
|
|
|
}
|
|
|
|
|
2016-04-13 16:09:54 +03:00
|
|
|
SHMEM_TYPE_WAIT_UNTIL(, volatile long, SHMEM_LONG, shmem)
|
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_short, volatile short, SHMEM_SHORT, shmem)
|
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_int, volatile int, SHMEM_INT, shmem)
|
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_long, volatile long, SHMEM_LONG, shmem)
|
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_longlong, volatile long long, SHMEM_LLONG, shmem)
|
2015-11-27 15:17:38 +03:00
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_int32, int32_t, SHMEM_INT32_T, shmemx)
|
|
|
|
SHMEM_TYPE_WAIT_UNTIL(_int64, int64_t, SHMEM_INT64_T, shmemx)
|