Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into pr/optimized-put-…
Browse files Browse the repository at this point in the history
…signal
  • Loading branch information
wrrobin committed Dec 11, 2018
2 parents 48a774d + f9ab782 commit 352ba85
Show file tree
Hide file tree
Showing 64 changed files with 5,014 additions and 1,212 deletions.
15 changes: 14 additions & 1 deletion config/opal_check_pmi.m4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2011-2016 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2014 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
# Copyright (c) 2014 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -303,6 +303,19 @@ AC_DEFUN([OPAL_CHECK_PMIX],[
# if it does exist, then we need to parse it to find
# the actual release series
AS_IF([test "$opal_external_pmix_version_found" = "0"],
[AC_MSG_CHECKING([version 4x])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
#include <pmix_version.h>
#if (PMIX_VERSION_MAJOR < 4L)
#error "not version 4"
#endif
], [])],
[AC_MSG_RESULT([found])
opal_external_pmix_version=4x
opal_external_pmix_version_found=1],
[AC_MSG_RESULT([not found])])])
AS_IF([test "$opal_external_pmix_version_found" = "0"],
[AC_MSG_CHECKING([version 3x])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -789,16 +789,16 @@ AS_IF([test "$transport_portals4" != "yes" -a "$transport_ofi" != "yes"],
[AC_MSG_WARN([No transport found, resulting library will be unable to exchange messages])])

AS_IF([test "$shmem_cv_c11_works" != "yes"],
[AC_MSG_WARN([C compiler does not support _Generic, unabled to verify and test C11 bindings])])
[AC_MSG_WARN([C compiler does not support _Generic, unable to verify and test C11 bindings])])

AS_IF([test "$enable_c11_checks" == "no"],
[AC_MSG_WARN([C11 _Generic type checks disabled, not verifying type coverage of C11 bindings])])

AS_IF([test "$enable_cxx" == "no"],
[AC_MSG_WARN([No C++ compiler or C++ disabled, unabled to verify and test C++ bindings])])
[AC_MSG_WARN([No C++ compiler or C++ disabled, unable to verify and test C++ bindings])])

AS_IF([test "$enable_fortran" == "no"],
[AC_MSG_WARN([No Fortran compiler or Fortran disabled, unabled to test Fortran bindings])])
[AC_MSG_WARN([No Fortran compiler or Fortran disabled, unable to test Fortran bindings])])

AS_IF([test "$enable_fortran" != "no"],
[AC_MSG_WARN([Fortran bindings have been deprecated as of OpenSHMEM v1.4])])
Expand Down
80 changes: 79 additions & 1 deletion mpp/shmemx.h4.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,42 @@ include(shmemx_c_func.h4)dnl
#ifdef __cplusplus
} /* extern "C" */

define(`SHMEM_CXX_WAIT_UNTIL_ALL',
`static inline void shmemx_wait_until_all($2 *ivars, size_t nelems, int cmp, $2 cmp_value) {
shmemx_$1_wait_until_all(ivars, nelems, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_WAIT_UNTIL_ALL')

define(`SHMEM_CXX_WAIT_UNTIL_ANY',
`static inline size_t shmemx_wait_until_any($2 *ivars, size_t nelems, int *status, int cmp, $2 cmp_value) {
return shmemx_$1_wait_until_any(ivars, nelems, status, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_WAIT_UNTIL_ANY')

define(`SHMEM_CXX_WAIT_UNTIL_SOME',
`static inline size_t shmemx_wait_until_some($2 *ivars, size_t nelems, size_t *indices, int *status, int cmp, $2 cmp_value) {
return shmemx_$1_wait_until_some(ivars, nelems, indices, status, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_WAIT_UNTIL_SOME')

define(`SHMEM_CXX_TEST_ALL',
`static inline int shmemx_test_all($2 *ivars, size_t nelems, int cmp, $2 cmp_value) {
return shmemx_$1_test_all(ivars, nelems, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_TEST_ALL')

define(`SHMEM_CXX_TEST_ANY',
`static inline size_t shmemx_test_any($2 *ivars, size_t nelems, int *status, int cmp, $2 cmp_value) {
return shmemx_$1_test_any(ivars, nelems, status, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_TEST_ANY')

define(`SHMEM_CXX_TEST_SOME',
`static inline size_t shmemx_test_some($2 *ivars, size_t nelems, size_t *indices, int *status, int cmp, $2 cmp_value) {
return shmemx_$1_test_some(ivars, nelems, indices, status, cmp, cmp_value);
}')dnl
SHMEM_CXX_DEFINE_FOR_SYNC(`SHMEM_CXX_TEST_SOME')

define(`SHMEM_CXX_ATOMIC_SWAP',
`static inline void shmemx_atomic_swap_nbi($2 *fetch, $2 *target, $2 value, int pe) {
shmemx_$1_atomic_swap_nbi(fetch, target, value, pe);
Expand Down Expand Up @@ -154,8 +190,50 @@ SHMEM_CXX_DEFINE_FOR_RMA(`SHMEM_CXX_PUT_SIGNAL_NBI')
/* C11 Generic Macros */
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(SHMEM_INTERNAL_INCLUDE))

/* Nonblocking fetching AMOs */
/* Wait_until and test any/all/some point-to-point API */
define(`SHMEM_C11_GEN_WAIT_UNTIL_ALL', ` $2*: shmemx_$1_wait_until_all')dnl
#define shmemx_wait_until_all(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_WAIT_UNTIL_ALL', `, \') \
)(__VA_ARGS__)
define(`SHMEM_C11_GEN_WAIT_UNTIL_ANY', ` $2*: shmemx_$1_wait_until_any')dnl
#define shmemx_wait_until_any(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_WAIT_UNTIL_ANY', `, \') \
)(__VA_ARGS__)
define(`SHMEM_C11_GEN_WAIT_UNTIL_SOME', ` $2*: shmemx_$1_wait_until_some')dnl
#define shmemx_wait_until_some(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_WAIT_UNTIL_SOME', `, \') \
)(__VA_ARGS__)
define(`SHMEM_C11_GEN_TEST_ALL', ` $2*: shmemx_$1_test_all')dnl
#define shmemx_test_all(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_TEST_ALL', `, \') \
)(__VA_ARGS__)
define(`SHMEM_C11_GEN_TEST_ANY', ` $2*: shmemx_$1_test_any')dnl
#define shmemx_test_any(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_TEST_ANY', `, \') \
)(__VA_ARGS__)
define(`SHMEM_C11_GEN_TEST_SOME', ` $2*: shmemx_$1_test_some')dnl
#define shmemx_test_some(...) \
_Generic(SHMEM_C11_TYPE_EVAL_PTR(SHMEM_C11_ARG0(__VA_ARGS__)), \
default: shmem_ctx_c11_generic_selection_failed, \
SHMEM_BIND_C11_SYNC(`SHMEM_C11_GEN_TEST_SOME', `, \') \
)(__VA_ARGS__)
/* Nonblocking fetching AMOs */
define(`SHMEM_C11_GEN_ATOMIC_SWAP_NBI', ` $2*: shmemx_$1_atomic_swap_nbi')dnl
define(`SHMEM_CTX_C11_GEN_ATOMIC_SWAP_NBI', ` $2*: shmemx_ctx_$1_atomic_swap_nbi')dnl
#define shmemx_atomic_swap_nbi(...) \
Expand Down
25 changes: 25 additions & 0 deletions mpp/shmemx_c_func.h4.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_completed_read(shmem_ctx_
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_completed_target(uint64_t *cntr_value);
SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_pcntr_get_all(shmem_ctx_t ctx, shmemx_pcntr_t *pcntr);

/* Wait_until and test any/all/some point-to-point API, proposed for OpenSHMEM 1.5 */
define(`SHMEM_C_WAIT_UNTIL_ALL',
`SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_$1_wait_until_all($2 *vars, size_t nelems, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_WAIT_UNTIL_ALL')

define(`SHMEM_C_WAIT_UNTIL_ANY',
`SHMEM_FUNCTION_ATTRIBUTES size_t SHPRE()shmemx_$1_wait_until_any($2 *vars, size_t nelems, int *status, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_WAIT_UNTIL_ANY')

define(`SHMEM_C_WAIT_UNTIL_SOME',
`SHMEM_FUNCTION_ATTRIBUTES size_t SHPRE()shmemx_$1_wait_until_some($2 *vars, size_t nelems, size_t *indices, int *status, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_WAIT_UNTIL_SOME')

define(`SHMEM_C_TEST_ALL',
`SHMEM_FUNCTION_ATTRIBUTES int SHPRE()shmemx_$1_test_all($2 *vars, size_t nelems, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_TEST_ALL')

define(`SHMEM_C_TEST_ANY',
`SHMEM_FUNCTION_ATTRIBUTES size_t SHPRE()shmemx_$1_test_any($2 *vars, size_t nelems, int *status, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_TEST_ANY')

define(`SHMEM_C_TEST_SOME',
`SHMEM_FUNCTION_ATTRIBUTES size_t SHPRE()shmemx_$1_test_some($2 *vars, size_t nelems, size_t *indices, int *status, int cmp, $2 value);')dnl
SHMEM_BIND_C_SYNC(`SHMEM_C_TEST_SOME')

/* Nonblocking swap operations, proposed for OpenSHMEM 1.5 */
define(`SHMEM_C_ATOMIC_SWAP_NBI',
`SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmemx_$1_atomic_swap_nbi($2 *fetch, $2 *dest, $2 value, int pe)')dnl
Expand Down
2 changes: 1 addition & 1 deletion scripts/travis/cray_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#export CUSTOM_SHMEM_DIR="<SOS_INSTALL_DIRECTORY>"
#export CRAY_TESTS_DIR="<CRAY_TESTS_SRC_DIRECTORY"
export CC=oshcc
export CC="oshcc -std=c99"
export CXX=oshCC
export FTN=oshfort
export LAUNCHER=oshrun
Expand Down
41 changes: 41 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ int shmem_internal_global_exit_called = 0;

int shmem_internal_thread_level;

unsigned int shmem_internal_rand_seed;

#ifdef ENABLE_THREADS
shmem_internal_mutex_t shmem_internal_mutex_alloc;
#endif

#ifdef ENABLE_THREADS
shmem_internal_mutex_t shmem_internal_mutex_rand_r;
#endif

#ifdef USE_ON_NODE_COMMS
char *shmem_internal_location_array = NULL;
#endif
Expand All @@ -85,6 +91,30 @@ static char shmem_internal_my_hostname[HOST_NAME_MAX];
static char *shmem_internal_thread_level_str[4] = { "SINGLE", "FUNNELED",
"SERIALIZED", "MULTIPLE" };

static void
shmem_internal_randr_init(void)
{
shmem_internal_rand_seed = shmem_internal_my_pe;

#ifdef ENABLE_THREADS
SHMEM_MUTEX_INIT(shmem_internal_mutex_rand_r);
#endif

return;
}

static void
shmem_internal_randr_fini(void)
{

#ifdef ENABLE_THREADS
SHMEM_MUTEX_DESTROY(shmem_internal_mutex_rand_r);
#endif

return;
}


static void
shmem_internal_shutdown(void)
{
Expand All @@ -107,6 +137,8 @@ shmem_internal_shutdown(void)

SHMEM_MUTEX_DESTROY(shmem_internal_mutex_alloc);

shmem_internal_randr_fini();

shmem_internal_symmetric_fini();
shmem_runtime_fini();
}
Expand Down Expand Up @@ -149,6 +181,7 @@ shmem_internal_init(int tl_requested, int *tl_provided)
#ifdef USE_CMA
int cma_initialized = 0;
#endif
int randr_initialized = 0;

#ifdef HAVE_SCHED_GETAFFINITY
cpu_set_t my_set;
Expand Down Expand Up @@ -395,6 +428,9 @@ shmem_internal_init(int tl_requested, int *tl_provided)
goto cleanup;
}

shmem_internal_randr_init();
randr_initialized = 1;

atexit(shmem_internal_shutdown_atexit);
shmem_internal_initialized = 1;

Expand Down Expand Up @@ -428,6 +464,11 @@ shmem_internal_init(int tl_requested, int *tl_provided)
shmem_transport_cma_fini();
}
#endif

if (randr_initialized) {
shmem_internal_randr_fini();
}

if (NULL != shmem_internal_data_base) {
shmem_internal_symmetric_fini();
}
Expand Down
3 changes: 3 additions & 0 deletions src/shmem_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ extern long shmem_internal_heap_length;
extern void *shmem_internal_data_base;
extern long shmem_internal_data_length;

extern unsigned int shmem_internal_rand_seed;

#define SHMEM_INTERNAL_HEAP_OVERHEAD (1024*1024)
#define SHMEM_INTERNAL_DIAG_STRLEN 1024

Expand Down Expand Up @@ -394,6 +396,7 @@ typedef shmem_spinlock_t shmem_internal_mutex_t;
# endif /* ENABLE_PTHREAD_MUTEX */

extern shmem_internal_mutex_t shmem_internal_mutex_alloc;
extern shmem_internal_mutex_t shmem_internal_mutex_rand_r;

#else
# define SHMEM_MUTEX_INIT(_mutex)
Expand Down
35 changes: 11 additions & 24 deletions src/shmem_synchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "shmem_comm.h"
#include "transport.h"


static inline void
shmem_internal_quiet(shmem_ctx_t ctx)
{
Expand Down Expand Up @@ -53,7 +52,6 @@ shmem_internal_fence(shmem_ctx_t ctx)
* transport level memory flush is not required here. */
}


#define COMP(type, a, b, ret) \
do { \
ret = 0; \
Expand Down Expand Up @@ -130,38 +128,27 @@ shmem_internal_fence(shmem_ctx_t ctx)
} while(0)

#if defined(ENABLE_HARD_POLLING)
#define SHMEM_WAIT(var, value) do { \
SHMEM_WAIT_POLL(var, value); \
shmem_internal_membar_load(); \
shmem_transport_syncmem(); \
} while (0)

#define SHMEM_WAIT_UNTIL(var, cond, value) do { \
#define SHMEM_INTERNAL_WAIT_UNTIL(var, cond, value) \
SHMEM_WAIT_UNTIL_POLL(var, cond, value)
#else
#define SHMEM_INTERNAL_WAIT_UNTIL(var, cond, value) \
if (shmem_internal_thread_level == SHMEM_THREAD_SINGLE) { \
SHMEM_WAIT_UNTIL_BLOCK(var, cond, value); \
} else { \
SHMEM_WAIT_UNTIL_POLL(var, cond, value); \
shmem_internal_membar_load(); \
shmem_transport_syncmem(); \
} while (0)
}
#endif

#else
#define SHMEM_WAIT(var, value) do { \
if (shmem_internal_thread_level == SHMEM_THREAD_SINGLE) { \
SHMEM_WAIT_BLOCK(var, value); \
} else { \
SHMEM_WAIT_POLL(var, value); \
} \
SHMEM_INTERNAL_WAIT_UNTIL(var, SHMEM_CMP_NE, value); \
shmem_internal_membar_load(); \
shmem_transport_syncmem(); \
} while (0)

#define SHMEM_WAIT_UNTIL(var, cond, value) do { \
if (shmem_internal_thread_level == SHMEM_THREAD_SINGLE) { \
SHMEM_WAIT_UNTIL_BLOCK(var, cond, value); \
} else { \
SHMEM_WAIT_UNTIL_POLL(var, cond, value); \
} \
SHMEM_INTERNAL_WAIT_UNTIL(var, cond, value); \
shmem_internal_membar_load(); \
shmem_transport_syncmem(); \
} while (0)
#endif /* HARD_POLLING */

#endif
Loading

0 comments on commit 352ba85

Please sign in to comment.