diff --git a/.travis.yml b/.travis.yml index df666d1..a8b2e21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,11 @@ script: - mkdir build - cd build # Note: With gcc 4.8 in Ubuntu Trusty, pthreads configury doesn't seem to - # detect the need for -lpthread. - - ../configure CC=oshcc CXX=oshc++ FC=oshfort CFLAGS="-std=gnu99" FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread" + # detect the need for -lpthread or -lm. + - ../configure CC=oshcc CXX=oshc++ FC=oshfort CFLAGS="-std=gnu99" FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread -lm" --disable-c11-checks + - make $TRAVIS_PAR_MAKE + - make check + - make distclean + - ../configure CC=oshcc CXX=oshc++ FC=oshfort FCFLAGS="-fcray-pointer" LDFLAGS="-lpthread -lm" - make $TRAVIS_PAR_MAKE - make check diff --git a/configure.ac b/configure.ac index 5153649..65d9cbd 100755 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,10 @@ AC_ARG_ENABLE([cxx], [AC_HELP_STRING([--disable-cxx], [Disable C++ tests (default: enabled)])]) +AC_ARG_ENABLE([c11-checks], + [AC_HELP_STRING([--disable-c11-checks], + [Disable build-time type checks for C11 bindings (default: enabled)])]) + AC_ARG_ENABLE([profiling], [AC_HELP_STRING([--enable-profiling], [Enable profiling (pshmem) interface tests (default:disabled)])]) @@ -128,6 +132,33 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_MSG_ERROR([C compiler cannot compile SHMEM code])]) AC_LANG_POP([C]) +if test "$enable_c11_checks" != "no" ; then + ORIG_CFLAGS=$CFLAGS + AC_MSG_CHECKING([if -std=gnu11 works]) + + AC_LANG_PUSH([C]) + CFLAGS="-pedantic-errors -std=gnu11" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + void g(int i){} + #define f(X) _Generic((X), default: g)(X) + ]], [[ + f(1); + ]] + )], + [shmem_cv_c11_works="yes"], [shmem_cv_c11_works="no"]) + AS_IF([test "$shmem_cv_c11_works" = "no"], + [AC_MSG_RESULT([no]) + CFLAGS="$ORIG_CFLAGS" + AC_PROG_CC_C99 + ], + [AC_MSG_RESULT([yes]) + CFLAGS="-std=gnu11 $ORIG_CFLAGS"] + ) + AC_LANG_POP([C]) +fi +AM_CONDITIONAL([HAVE_C11], [test "$shmem_cv_c11_works" = "yes" -a "$enable_c11_checks" != "no"]) + + if test "$enable_cxx" != "no" ; then AC_MSG_CHECKING([C++ compiler can compile SHMEM code]) AC_LANG_PUSH([C++]) diff --git a/test/performance/shmem_perf_suite/Makefile.am b/test/performance/shmem_perf_suite/Makefile.am index 7e8c9e3..d99a751 100644 --- a/test/performance/shmem_perf_suite/Makefile.am +++ b/test/performance/shmem_perf_suite/Makefile.am @@ -21,7 +21,9 @@ check_PROGRAMS = \ shmem_bibw_get_perf \ shmem_bibw_get_perf_nb \ shmem_bw_atomics_perf \ - shmem_bibw_atomics_perf + shmem_bibw_atomics_perf \ + shmem_bw_nb_atomics_perf \ + shmem_bibw_nb_atomics_perf if HAVE_OPENMP check_PROGRAMS += \ @@ -35,12 +37,6 @@ check_PROGRAMS += \ shmem_latency_get_ctx_perf_nb endif -if SHMEMX_TESTS -check_PROGRAMS += \ - shmem_bw_nb_atomics_perf \ - shmem_bibw_nb_atomics_perf -endif - noinst_HEADERS = \ common.h \ latency_common.h \ diff --git a/test/performance/shmem_perf_suite/README b/test/performance/shmem_perf_suite/README index b760725..07abc6f 100644 --- a/test/performance/shmem_perf_suite/README +++ b/test/performance/shmem_perf_suite/README @@ -41,6 +41,7 @@ Notes for Users: -e : end length (power of two) DEFAULT: 8MB -s : start length (power of two) DEFAULT: 1B -n : number of trials (must be greater than 20 (warmup size)) DEFAULT: 100 + -m : scale the number of trials by a floating point multiplier DEFAULT: 1.0 -v : validate input stream used for performance data (off by default) BW only: -k : output in KB @@ -48,6 +49,10 @@ Notes for Users: -T : number of threads, DEFAULT: 1 -C : thread level (SINGLE, FUNNELED, SERIALIZED, MULTIPLE), DEFAULT: SINGLE + Environment Variables: + SHMEM_PERF_SUITE_TRIALS_MULTIPLIER : Scale the number of trials by a floating + point multiplier. + Notes for performance tests developers: overall model: development assumed that the initialization of data, calculating and printing of diff --git a/test/performance/shmem_perf_suite/bw_common.h b/test/performance/shmem_perf_suite/bw_common.h index 740fbe3..7d08dda 100644 --- a/test/performance/shmem_perf_suite/bw_common.h +++ b/test/performance/shmem_perf_suite/bw_common.h @@ -25,7 +25,6 @@ * SOFTWARE. */ -#include #include #ifdef ENABLE_OPENMP #include @@ -34,7 +33,7 @@ static const char * dt_names [] = { "uint", "ulong", "ulonglong" }; /*default settings if no input is provided */ -static +static void init_metrics(perf_metrics_t *metric_info) { metric_info->t_type = BW; set_metric_defaults(metric_info); @@ -45,7 +44,7 @@ void init_metrics(perf_metrics_t *metric_info) { metric_info->opstyle = STYLE_RMA; } -static +static void update_bw_type(perf_metrics_t *data, int b_type) { if (b_type == BI_DIR) { data->bw_type_str = "Bi-dir"; @@ -60,7 +59,7 @@ void update_bw_type(perf_metrics_t *data, int b_type) { /* Result Printing and Calc */ /**************************************************************/ -static +static void print_atomic_header(perf_metrics_t * const metric_info) { print_header(metric_info); printf("\n\nBandwidth test type: %10s\n", metric_info->bw_type_str); @@ -72,7 +71,7 @@ void print_atomic_header(perf_metrics_t * const metric_info) { printf("Communication style: PAIRWISE\n"); } - printf("\nOperation%15sBandwidth%15sMessage Rate%15sLatency\n", + printf("\nOperation%15sBandwidth%15sMessage Rate%15sLatency\n", " ", " ", " "); if (metric_info->unit == MB) { @@ -86,7 +85,7 @@ void print_atomic_header(perf_metrics_t * const metric_info) { printf("%15s in Mops/sec%15s in us\n", " ", " "); } -static +static void print_bw_header(perf_metrics_t * const metric_info) { print_header(metric_info); printf("\n\nBandwidth test type: %10s\n", metric_info->bw_type_str); @@ -105,7 +104,7 @@ void print_bw_header(perf_metrics_t * const metric_info) { printf("%16sin msgs/sec\n", " "); } -static +static void print_data_results(double bw, double mr, const perf_metrics_t * const data, int len, double total_t) { static int atomic_type_index = 0; @@ -123,7 +122,7 @@ void print_data_results(double bw, double mr, const perf_metrics_t * const data, } if (data->opstyle == STYLE_ATOMIC) { - printf("%13s%10.2f%15s%12.2f%12s%10.2f", " ", bw, " ", + printf("%13s%10.2f%15s%12.2f%12s%10.2f", " ", bw, " ", mr/1.0e6, " ", total_t/(data->trials * data->window_size)); } else printf("%14s%10.2f%15s%12.2f", " ", bw, " ", mr); @@ -139,15 +138,15 @@ void print_data_results(double bw, double mr, const perf_metrics_t * const data, printf("\n"); } -static inline -void calc_and_print_results(double end_t, double start_t, int len, +static inline +void calc_and_print_results(double end_t, double start_t, int len, perf_metrics_t * const metric_info) { int stride = 0, start_pe = 0, nPEs = 0; static double pe_bw_sum, bw = 0.0; /*must be symmetric for reduction*/ double pe_bw_avg = 0.0, pe_mr_avg = 0.0; int nred_elements = 1; static double pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE]; - static double pe_time_start, pe_time_end, + static double pe_time_start, pe_time_end, end_time_max = 0.0, start_time_min = 0.0; double total_t = 0.0, total_t_max = 0.0; int multiplier = 1; @@ -161,11 +160,11 @@ void calc_and_print_results(double end_t, double start_t, int len, if (end_t > 0 && start_t > 0 && (end_t - start_t) > 0) { total_t = end_t - start_t; #ifdef ENABLE_OPENMP - bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 * + bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 * metric_info->window_size * metric_info->trials * (double) metric_info->nthreads) / (total_t / 1.0e6); #else - bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 * + bw = ((double) len * (double) metric_info->num_partners * (double) multiplier / 1.0e6 * metric_info->window_size * metric_info->trials) / (total_t / 1.0e6); #endif @@ -179,24 +178,24 @@ void calc_and_print_results(double end_t, double start_t, int len, if (metric_info->individual_report == 1) { if (metric_info->my_node < metric_info->midpt) { - printf("Individual bandwith for PE %6d (initer) is %10.2f\n", + printf("Individual bandwith for PE %6d (initer) is %10.2f\n", metric_info->my_node, pe_bw_sum); } else { - printf("Individual bandwith for PE %6d (target) is %10.2f\n", + printf("Individual bandwith for PE %6d (target) is %10.2f\n", metric_info->my_node, pe_bw_sum); } } - + pe_time_start = start_t; pe_time_end = end_t; shmem_barrier(start_pe, stride, nPEs, bar_psync); - if (metric_info->cstyle != COMM_INCAST) { + if (metric_info->cstyle != COMM_INCAST) { if (nPEs >= 2) { shmem_double_min_to_all(&start_time_min, &pe_time_start, nred_elements, start_pe, stride, nPEs, pwrk, red_psync); shmem_barrier(start_pe, stride, nPEs, bar_psync); - shmem_double_max_to_all(&end_time_max, &pe_time_end, nred_elements, + shmem_double_max_to_all(&end_time_max, &pe_time_end, nred_elements, start_pe, stride, nPEs, pwrk, red_psync); } else if (nPEs == 1) { @@ -205,25 +204,25 @@ void calc_and_print_results(double end_t, double start_t, int len, } /* calculating bandwidth based on the highest time duration across all PEs */ - if (end_time_max > 0 && start_time_min > 0 && + if (end_time_max > 0 && start_time_min > 0 && (end_time_max - start_time_min) > 0) { total_t_max = (end_time_max - start_time_min); int total_transfers = MAX(metric_info->szinitiator, metric_info->sztarget); #ifdef ENABLE_OPENMP - bw = ((double) len * (double) multiplier * (double) total_transfers / - 1.0e6 * metric_info->window_size * metric_info->trials * + bw = ((double) len * (double) multiplier * (double) total_transfers / + 1.0e6 * metric_info->window_size * metric_info->trials * (double) metric_info->nthreads) / (total_t_max / 1.0e6); #else - bw = ((double) len * (double) multiplier * (double) total_transfers / - 1.0e6 * metric_info->window_size * metric_info->trials) / + bw = ((double) len * (double) multiplier * (double) total_transfers / + 1.0e6 * metric_info->window_size * metric_info->trials) / (total_t_max / 1.0e6); #endif } else { fprintf(stderr, "Incorrect time measured from bandwidth test: " - "start_min = %lf, end_max = %lf\n", + "start_min = %lf, end_max = %lf\n", start_time_min, end_time_max); - } + } pe_bw_sum = bw; } else { if (nPEs >= 2) { @@ -252,7 +251,7 @@ static int validate_atomics(perf_metrics_t * const m_info) { * ATOMICS_N_DTs * ATOMICS_N_OPs) + m_info->my_node; if (m_info->cstyle == COMM_INCAST) { - if (tbw == BI_DIR) + if (tbw == BI_DIR) printf("WARNING: This use-case is not currently well defined\n"); if (m_info->my_node == 0) { @@ -284,7 +283,7 @@ static int validate_atomics(perf_metrics_t * const m_info) { * NOTE: post function validation assumptions, data isn't flushed pre/post */ extern void bi_dir_bw(int len, perf_metrics_t *metric_info); -static inline +static inline void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) { int partner_pe = partner_node(metric_info); @@ -319,7 +318,7 @@ void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) { } else { errors = validate_atomics(metric_info); } - if (errors >= 0) + if (errors >= 0) printf("Validation complete (%d errors)\n", errors); } } @@ -333,7 +332,7 @@ void bi_dir_bw_test_and_output(perf_metrics_t * const metric_info) { * NOTE: post function validation assumptions, data isn't flushed pre/post */ extern void uni_dir_bw(int len, perf_metrics_t *metric_info); -static inline +static inline void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) { int partner_pe = partner_node(metric_info); @@ -369,7 +368,7 @@ void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) { } else if (metric_info->opstyle == STYLE_ATOMIC) { errors = validate_atomics(metric_info); } - if (errors >= 0) + if (errors >= 0) printf("Validation complete (%d errors)\n", errors); } } @@ -379,7 +378,7 @@ void uni_dir_bw_test_and_output(perf_metrics_t * const metric_info) { /**************************************************************/ /* create and init (with my_PE_num) two symmetric arrays on the heap */ -static inline +static inline int bw_init_data_stream(perf_metrics_t * const metric_info, int argc, char *argv[]) { @@ -438,7 +437,7 @@ int bw_init_data_stream(perf_metrics_t * const metric_info, } -static inline +static inline int bi_dir_init(perf_metrics_t * const metric_info, int argc, char *argv[], op_style opstyle) { int ret = bw_init_data_stream(metric_info, argc, argv); @@ -446,11 +445,11 @@ int bi_dir_init(perf_metrics_t * const metric_info, int argc, metric_info->opstyle = opstyle; update_bw_type(metric_info, BI_DIR); return 0; - } else + } else return ret; } -static inline +static inline int uni_dir_init(perf_metrics_t * const metric_info, int argc, char *argv[], op_style opstyle) { int ret = bw_init_data_stream(metric_info, argc, argv); @@ -459,11 +458,11 @@ int uni_dir_init(perf_metrics_t * const metric_info, int argc, metric_info->opstyle = opstyle; update_bw_type(metric_info, UNI_DIR); return 0; - } else + } else return ret; } -static inline +static inline void bw_data_free(const perf_metrics_t * const metric_info) { shmem_barrier_all(); @@ -471,14 +470,14 @@ void bw_data_free(const perf_metrics_t * const metric_info) { aligned_buffer_free(metric_info->dest); } -static inline +static inline void bw_finalize(void) { #ifndef VERSION_1_0 shmem_finalize(); #endif } -static inline +static inline void bi_dir_bw_main(int argc, char *argv[], op_style opstyle) { perf_metrics_t metric_info; @@ -490,10 +489,10 @@ void bi_dir_bw_main(int argc, char *argv[], op_style opstyle) { bw_data_free(&metric_info); } - bw_finalize(); -} + bw_finalize(); +} -static inline +static inline void uni_dir_bw_main(int argc, char *argv[], op_style opstyle) { perf_metrics_t metric_info; @@ -506,4 +505,4 @@ void uni_dir_bw_main(int argc, char *argv[], op_style opstyle) { } bw_finalize(); -} +} diff --git a/test/performance/shmem_perf_suite/common.h b/test/performance/shmem_perf_suite/common.h index cc66b69..c8186ec 100644 --- a/test/performance/shmem_perf_suite/common.h +++ b/test/performance/shmem_perf_suite/common.h @@ -131,7 +131,7 @@ typedef enum { #define FIRST_FETCH_OP OP_FETCH const char *atomic_op_name[] = { "set", "inc", "add", "and", - "or", "xor", + "or", "xor", "fetch", "cswap", "swap", "finc", "fadd", "fand", "for", "fxor" }; @@ -146,8 +146,7 @@ typedef struct perf_metrics { op_style opstyle; float trials_multiplier; /* adjust trials value through env var - * SOS_TRIALS_MULTIPLIER. Invalid for - * user inputs*/ + * SHMEM_PERF_SUITE_TRIALS_MULTIPLIER. */ /* parameters for threaded tests */ int nthreads; @@ -174,11 +173,12 @@ long red_psync[SHMEM_REDUCE_SYNC_SIZE]; long bar_psync[SHMEM_BARRIER_SYNC_SIZE]; /* default settings with no input provided */ -static inline +static inline void set_metric_defaults(perf_metrics_t *metric_info) { char *val = NULL; metric_info->trials_multiplier = 1.0; /* Default 1 */ - val = getenv("SOS_TRIALS_MULTIPLIER"); + val = getenv("SHMEM_PERF_SUITE_TRIALS_MULTIPLIER"); + if (val && strlen(val)) metric_info->trials_multiplier = atof(val); @@ -212,7 +212,7 @@ void set_metric_defaults(perf_metrics_t *metric_info) { } /* update metrics after shmem init */ -static inline +static inline void update_metrics(perf_metrics_t *metric_info) { metric_info->my_node = shmem_my_pe(); metric_info->num_pes = shmem_n_pes(); @@ -306,7 +306,7 @@ static void aligned_buffer_free(char * ptr_aligned) #endif } -static inline +static inline int is_divisible_by_4(int num) { if (num < 0) shmem_global_exit(1); @@ -314,7 +314,7 @@ int is_divisible_by_4(int num) { } /*to be a power of 2 must only have 1 set bit*/ -static inline +static inline int is_pow_of_2(unsigned int num) { /*move first set bit all the way to right*/ while(num && !((num >>=1 ) & 1)); @@ -323,7 +323,7 @@ int is_pow_of_2(unsigned int num) { return ((num == 1 || num == 0) ? true : false); } -static +static void init_array(const char *buf, int len, int my_pe_num) { int i = 0; int array_size = len / sizeof(int); @@ -335,7 +335,7 @@ void init_array(const char *buf, int len, int my_pe_num) { ibuf[i] = my_pe_num; } -static inline +static inline int validate_recv(char *buf, int len, int partner_pe) { int i = 0; int array_size = len / sizeof(int); @@ -350,7 +350,7 @@ int validate_recv(char *buf, int len, int partner_pe) { } } if (errors > 0) { - printf("Validation error: stored_value = %d, expected value = %d\n", + printf("Validation error: stored_value = %d, expected value = %d\n", ibuf[0], partner_pe); } return errors; @@ -366,7 +366,7 @@ int command_line_arg_check(int argc, char *argv[], perf_metrics_t * const metric extern char *optarg; /* check command line args */ - while ((ch = getopt(argc, argv, "e:s:n:w:p:r:l:kbivtC:T:")) != EOF) { + while ((ch = getopt(argc, argv, "e:s:n:m:w:p:r:l:kbivtC:T:")) != EOF) { switch (ch) { case 's': metric_info->start_len = strtoul(optarg, (char **)NULL, 0); @@ -405,6 +405,17 @@ int command_line_arg_check(int argc, char *argv[], perf_metrics_t * const metric errors++; } break; + case 'm': + metric_info->trials_multiplier = strtod(optarg, (char **)NULL); + if(metric_info->trials * metric_info->trials_multiplier < + (metric_info->warmup * 2)) { + fprintf(stderr, "Error: trials * trials_multiplier (%ld) must be >= 2*warmup (%ld)\n", + (unsigned long int)(metric_info->trials * metric_info->trials_multiplier), + metric_info->warmup * 2); + errors++; + } + metric_info->trials *= metric_info->trials_multiplier; + break; case 'p': metric_info->warmup = strtoul(optarg, (char **)NULL, 0); if(metric_info->warmup > (metric_info->trials/2)) { @@ -425,7 +436,7 @@ int command_line_arg_check(int argc, char *argv[], perf_metrics_t * const metric break; case 'v': metric_info->validate = true; - if(metric_info->t_type == BW && metric_info->target_data) + if(metric_info->t_type == BW && metric_info->target_data) errors++; break; case 'w': @@ -492,12 +503,14 @@ int command_line_arg_check(int argc, char *argv[], perf_metrics_t * const metric static inline void print_usage(int errors) { fprintf(stderr, "\nNumber of errors in the command line: %d\n", errors); - fprintf(stderr, "\nUsage: [OPTION]\n" + fprintf(stderr, "\nUsage: [OPTION]\n" " -s START_MSG_SIZE Smallest message size. Must be power of 2\n" " -e END_MSG_SIZE Largest message size. Must be power of 2\n" " -p WARMUP Number of warmup iterations\n" " -n TRIALS Number of trial iterations. Must be at\n" " least twice of WARMUP\n" + " -m TRIALS_MULTIPLIER Scale the TRIALS value by a floating\n" + " point multiplier. Must be greater than 0.\n" " -w WINDOW_SIZE Window size for streaming. Cannot be used\n" " in conjunction with -t. Specific to band-\n" " -width experiments\n" @@ -521,7 +534,7 @@ void print_usage(int errors) { #if defined(ENABLE_THREADS) -static +static const char *thread_safety_str(perf_metrics_t * const metric_info) { if (metric_info->thread_safety == SHMEM_THREAD_SINGLE) { return "SINGLE"; @@ -532,14 +545,14 @@ const char *thread_safety_str(perf_metrics_t * const metric_info) { } else if (metric_info->thread_safety == SHMEM_THREAD_MULTIPLE) { return "MULTIPLE"; } else { - fprintf(stderr, "Unexpected thread safety value: %d. " + fprintf(stderr, "Unexpected thread safety value: %d. " "Setting it to SINGLE\n", metric_info->thread_safety); metric_info->thread_safety = SHMEM_THREAD_SINGLE; return "SINGLE"; } } -static inline +static inline void thread_safety_validation_check(perf_metrics_t * const metric_info) { if (metric_info->nthreads == 1) return; @@ -548,7 +561,7 @@ void thread_safety_validation_check(perf_metrics_t * const metric_info) { if(metric_info->my_node == 0) { fprintf(stderr, "Warning: argument \"-T %d\" is ignored" " because of the thread level specified." - " Switching to single thread with thread" + " Switching to single thread with thread" " safety %s\n", metric_info->nthreads, thread_safety_str(metric_info)); } @@ -559,7 +572,7 @@ void thread_safety_validation_check(perf_metrics_t * const metric_info) { } #endif -static inline +static inline int only_even_PEs_check(int my_node, int num_pes) { if (num_pes % 2 != 0) { if (my_node == 0) { @@ -572,7 +585,7 @@ int only_even_PEs_check(int my_node, int num_pes) { /* Returns partner node; Assumes only one partner */ -static inline +static inline int partner_node(const perf_metrics_t * const my_info) { if (my_info->num_pes == 1) @@ -614,7 +627,7 @@ int target_node(const perf_metrics_t * const my_info) (my_info->my_node < (my_info->midpt + my_info->sztarget))); } -static inline +static inline int is_streaming_node(const perf_metrics_t * const my_info, int node) { if (my_info->cstyle == COMM_PAIRWISE) { @@ -641,7 +654,7 @@ int check_hostname_validation(const perf_metrics_t * const my_info) { pSync_collect[i] = SHMEM_SYNC_VALUE; char *hostname = (char *) shmem_malloc (hostname_size * sizeof(char)); - char *dest = (char *) shmem_malloc (my_info->num_pes * hostname_size * + char *dest = (char *) shmem_malloc (my_info->num_pes * hostname_size * sizeof(char)); if (hostname == NULL || dest == NULL) { @@ -657,7 +670,7 @@ int check_hostname_validation(const perf_metrics_t * const my_info) { shmem_barrier_all(); /* nelems needs to be updated based on 32-bit API */ - shmem_fcollect32(dest, hostname, hostname_size/4, 0, 0, my_info->num_pes, + shmem_fcollect32(dest, hostname, hostname_size/4, 0, 0, my_info->num_pes, pSync_collect); char *snode_name = NULL; @@ -672,7 +685,7 @@ int check_hostname_validation(const perf_metrics_t * const my_info) { if (strncmp(snode_name, curr_name, hostname_size) != 0) { fprintf(stderr, "PE %d on %s is a streaming node " - "but not placed on %s\n", i, curr_name, + "but not placed on %s\n", i, curr_name, snode_name); errors++; } @@ -683,7 +696,7 @@ int check_hostname_validation(const perf_metrics_t * const my_info) { if (strncmp(tnode_name, curr_name, hostname_size) != 0) { fprintf(stderr, "PE %d on %s is a target node " - "but not placed on %s\n", i, curr_name, + "but not placed on %s\n", i, curr_name, tnode_name); errors++; } @@ -797,11 +810,11 @@ static void print_header(perf_metrics_t * const metric_info) { printf("\n%20sSandia OpenSHMEM Performance Suite%20s\n", " ", " "); printf("%20s==================================%20s\n", " ", " "); - printf("Total Number of PEs: %10d%6sWindow size: %10lu\n", + printf("Total Number of PEs: %10d%6sWindow size: %10lu\n", metric_info->num_pes, " ", metric_info->window_size); - printf("Number of source PEs: %10d%6sMaximum message size: %10lu\n", + printf("Number of source PEs: %10d%6sMaximum message size: %10lu\n", metric_info->szinitiator, " ", metric_info->max_len); - printf("Number of target PEs: %10d%6sNumber of threads: %10d\n", + printf("Number of target PEs: %10d%6sNumber of threads: %10d\n", metric_info->sztarget, " ", metric_info->nthreads); printf("Iteration count: %10lu%6s", metric_info->trials, " "); #if defined(ENABLE_THREADS) diff --git a/test/performance/shmem_perf_suite/shmem_bibw_nb_atomics_perf.c b/test/performance/shmem_perf_suite/shmem_bibw_nb_atomics_perf.c index e296c32..05c46e6 100644 --- a/test/performance/shmem_perf_suite/shmem_bibw_nb_atomics_perf.c +++ b/test/performance/shmem_perf_suite/shmem_bibw_nb_atomics_perf.c @@ -56,7 +56,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -72,7 +72,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -88,7 +88,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -104,7 +104,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -120,7 +120,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -136,7 +136,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -152,7 +152,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), ONE, dest); \ shmem_quiet(); \ } \ @@ -168,7 +168,7 @@ } \ \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), dest, ONE, dest); \ shmem_quiet(); \ } \ @@ -190,7 +190,7 @@ static inline void bw_set_metric_info_len(perf_metrics_t * const metric_info) for (op_type = FIRST_FETCH_OP; op_type < LAST_OP; op_type++) { if(metric_info->my_node == 0) { - printf("\nshmemx_%s\n", atomic_op_name[op_type]); + printf("\nshmem_%s\n", atomic_op_name[op_type]); printf("-----------\n"); } diff --git a/test/performance/shmem_perf_suite/shmem_bw_nb_atomics_perf.c b/test/performance/shmem_perf_suite/shmem_bw_nb_atomics_perf.c index 20067c4..3a1f1d0 100644 --- a/test/performance/shmem_perf_suite/shmem_bw_nb_atomics_perf.c +++ b/test/performance/shmem_perf_suite/shmem_bw_nb_atomics_perf.c @@ -50,7 +50,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -60,7 +60,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -71,7 +71,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -81,7 +81,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_and_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -92,7 +92,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -102,7 +102,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_or_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -113,7 +113,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -123,7 +123,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_xor_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -134,7 +134,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -144,7 +144,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_add_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), ONE, dest); \ shmem_quiet(); \ } \ @@ -155,7 +155,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -165,7 +165,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_fetch_inc_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->dest), dest); \ shmem_quiet(); \ } \ @@ -176,7 +176,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), ONE, dest); \ shmem_quiet(); \ } \ @@ -186,7 +186,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), ONE, dest); \ shmem_quiet(); \ } \ @@ -197,7 +197,7 @@ if(snode) { \ for(i = 0; i < metric_info->warmup; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), dest, ONE, dest); \ shmem_quiet(); \ } \ @@ -207,7 +207,7 @@ start = perf_shmemx_wtime(); \ for(i = 0; i < metric_info->trials; i++) { \ for(j = 0; j < metric_info->window_size; j++) \ - shmemx_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ + shmem_##NAME##_atomic_compare_swap_nbi((TYPE *) &fetch, \ (TYPE *)(metric_info->src), dest, ONE, dest); \ shmem_quiet(); \ } \ @@ -230,7 +230,7 @@ static inline void bw_set_metric_info_len(perf_metrics_t * const metric_info) for (op_type = FIRST_FETCH_OP; op_type < LAST_OP; op_type++) { if(metric_info->my_node == 0) { - printf("\nshmemx_%s\n", atomic_op_name[op_type]); + printf("\nshmem_%s\n", atomic_op_name[op_type]); printf("-----------\n"); } diff --git a/test/shmemx/Makefile.am b/test/shmemx/Makefile.am index c2935b5..df57831 100644 --- a/test/shmemx/Makefile.am +++ b/test/shmemx/Makefile.am @@ -13,11 +13,6 @@ check_PROGRAMS = -if ENABLE_PROFILING -check_PROGRAMS += \ - pcontrol -endif - if USE_PORTALS4 check_PROGRAMS += \ shmem_ct @@ -25,25 +20,7 @@ endif if SHMEMX_TESTS check_PROGRAMS += \ - perf_counter \ - fadd_nbi \ - atomic_nbi \ - put_signal \ - put_signal_nbi \ - shmemx_test_all \ - c11_test_shmemx_wait_until \ - c11_test_shmemx_test \ - c11_test_shmemx_wait_until_vector\ - c11_test_shmemx_test_vector\ - shmemx_team_split_2d \ - shmemx_team_translate_2 \ - shmemx_team_reuse_teams \ - shmemx_team_collect_active_set \ - shmemx_team_shared \ - shmemx_team_b2b_collectives \ - c11_shmemx_team_collective_types \ - c11_shmemx_team_reduce \ - shmemx_team_max + perf_counter if HAVE_PTHREADS check_PROGRAMS += \ diff --git a/test/shmemx/cxx_test_shmem_atomic_add.cpp b/test/shmemx/cxx_test_shmem_atomic_add.cpp index 3c8f73d..cdc32f3 100644 --- a/test/shmemx/cxx_test_shmem_atomic_add.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_add.cpp @@ -52,9 +52,9 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, #endif #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_ADD_NBI: \ - shmemx_atomic_fetch_add_nbi(&old, &remote, (TYPE)(mype + 1), i); \ + shmem_atomic_fetch_add_nbi(&old, &remote, (TYPE)(mype + 1), i); \ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -63,7 +63,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, } \ break; \ case CTX_ATOMIC_FETCH_ADD_NBI: \ - shmemx_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(mype + 1), i); \ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ @@ -73,7 +73,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, } \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_ADD(OP, TYPE) \ @@ -119,7 +119,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_and.cpp b/test/shmemx/cxx_test_shmem_atomic_and.cpp index d84cce7..81e9b6f 100644 --- a/test/shmemx/cxx_test_shmem_atomic_and.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_and.cpp @@ -50,9 +50,9 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, */ #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_AND_NBI: \ - shmemx_atomic_fetch_and_nbi(&old, &remote, \ + shmem_atomic_fetch_and_nbi(&old, &remote, \ ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -62,7 +62,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, } \ break; \ case CTX_FETCH_AND_NBI: \ - shmemx_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -72,7 +72,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, } \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_AND(OP, TYPE) \ @@ -106,7 +106,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_cswap.cpp b/test/shmemx/cxx_test_shmem_atomic_cswap.cpp index d81c4d4..d70b840 100644 --- a/test/shmemx/cxx_test_shmem_atomic_cswap.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_cswap.cpp @@ -50,18 +50,18 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, #endif #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_atomic_compare_swap_nbi(&old, &remote, (TYPE)npes, \ + shmem_atomic_compare_swap_nbi(&old, &remote, (TYPE)npes, \ (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)npes, (TYPE)mype, \ (mype + 1) % npes); \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_CSWAP(OP, TYPE) \ @@ -86,7 +86,7 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, (TYPE)npes, (TYPE)mype, \ (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_fetch.cpp b/test/shmemx/cxx_test_shmem_atomic_fetch.cpp index 41c6700..5255772 100644 --- a/test/shmemx/cxx_test_shmem_atomic_fetch.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_fetch.cpp @@ -50,19 +50,19 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, #endif #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_NBI: \ - shmemx_atomic_fetch_nbi(&val, &remote, \ + shmem_atomic_fetch_nbi(&val, &remote, \ (mype + 1) % npes); \ shmem_quiet(); \ break; \ case CTX_ATOMIC_FETCH_NBI: \ - shmemx_atomic_fetch_nbi(SHMEM_CTX_DEFAULT, &val, \ + shmem_atomic_fetch_nbi(SHMEM_CTX_DEFAULT, &val, \ &remote, (mype + 1) % npes); \ shmem_quiet(); \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_FETCH(OP, TYPE) \ @@ -83,7 +83,7 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, case CTX_ATOMIC_FETCH: \ val = shmem_atomic_fetch(SHMEM_CTX_DEFAULT, &remote, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_inc.cpp b/test/shmemx/cxx_test_shmem_atomic_inc.cpp index ecd6422..31de80a 100644 --- a/test/shmemx/cxx_test_shmem_atomic_inc.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_inc.cpp @@ -53,9 +53,9 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, #endif #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_INC_NBI: \ - shmemx_atomic_fetch_inc_nbi(&old, &remote, i); \ + shmem_atomic_fetch_inc_nbi(&old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -64,7 +64,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, } \ break; \ case CTX_ATOMIC_FETCH_INC_NBI: \ - shmemx_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT, &old, &remote, i); \ + shmem_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT, &old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -73,7 +73,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, } \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_INC(OP, TYPE) \ @@ -119,7 +119,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_or.cpp b/test/shmemx/cxx_test_shmem_atomic_or.cpp index 5463f02..1920d1d 100644 --- a/test/shmemx/cxx_test_shmem_atomic_or.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_or.cpp @@ -50,9 +50,9 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, */ #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_OR_NBI: \ - shmemx_atomic_fetch_or_nbi(&old, &remote, \ + shmem_atomic_fetch_or_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -62,7 +62,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, } \ break; \ case CTX_FETCH_OR_NBI: \ - shmemx_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -72,7 +72,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, } \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_OR(OP, TYPE) \ @@ -108,7 +108,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_swap.cpp b/test/shmemx/cxx_test_shmem_atomic_swap.cpp index ef9e278..dbd132d 100644 --- a/test/shmemx/cxx_test_shmem_atomic_swap.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_swap.cpp @@ -50,17 +50,17 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, #endif #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_SWAP_NBI: \ - shmemx_atomic_swap_nbi(&old, &remote, \ + shmem_atomic_swap_nbi(&old, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_SWAP_NBI: \ - shmemx_atomic_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_SWAP(OP, TYPE) \ @@ -82,7 +82,7 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, old = shmem_atomic_swap(SHMEM_CTX_DEFAULT, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/cxx_test_shmem_atomic_xor.cpp b/test/shmemx/cxx_test_shmem_atomic_xor.cpp index 6d5144d..43efcc4 100644 --- a/test/shmemx/cxx_test_shmem_atomic_xor.cpp +++ b/test/shmemx/cxx_test_shmem_atomic_xor.cpp @@ -50,9 +50,9 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, */ #ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_XOR_NBI: \ - shmemx_atomic_fetch_xor_nbi(&old, &remote, \ + shmem_atomic_fetch_xor_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -62,7 +62,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, } \ break; \ case CTX_FETCH_XOR_NBI: \ - shmemx_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -72,7 +72,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, } \ break; #else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) +#define SHMEM_NBI_OPS_CASES(OP, TYPE) #endif #define TEST_SHMEM_XOR(OP, TYPE) \ @@ -106,7 +106,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ diff --git a/test/shmemx/shmemx_test_any.c b/test/shmemx/shmemx_test_any.c deleted file mode 100644 index d6fee17..0000000 --- a/test/shmemx/shmemx_test_any.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include -#include - -int main(void) -{ - shmem_init(); - int mype = shmem_my_pe(); - int npes = shmem_n_pes(); - - int *flags = shmem_calloc(npes, sizeof(int)); - int *status = calloc(npes, sizeof(int)); - - for (int i = 0; i < npes; i++) - shmem_int_p(&flags[mype], 1, i); - - int ncompleted = 0; - size_t completed_idx; - - while (ncompleted < npes) { - completed_idx = shmemx_int_test_any(flags, npes, status, SHMEM_CMP_EQ, 1); - if (completed_idx != SIZE_MAX) { - ncompleted++; - } else { - /* Overlap some computation here */ - } - } - - /* Check the flags array */ - for (int i = 0; i < npes; i++) { - if (flags[i] != 1) - shmem_global_exit(1); - } - - /* Sanity check of shmem_test_any's fairness */ - ncompleted = 0; - int *found = calloc(npes, sizeof(int)); - - while (ncompleted < npes) { - int idx = shmemx_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); - if (found[idx] == 0) { - found[idx] = 1; - ncompleted++; - } - } - - for (int i = 0; i < npes; i++) { - if (found[i] != 1) { - shmem_global_exit(2); - } - } - - /* Sanity check case with NULL status array */ - completed_idx = shmemx_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); - - if (completed_idx >= npes) - shmem_global_exit(3); - - - free(found); - free(status); - shmem_free(flags); - shmem_finalize(); - return 0; -} diff --git a/test/shmemx/shmemx_test_some.c b/test/shmemx/shmemx_test_some.c deleted file mode 100644 index 56f5d91..0000000 --- a/test/shmemx/shmemx_test_some.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include -#include - -#define N 100 - -int main(void) -{ - int total_sum = 0; - - shmem_init(); - int mype = shmem_my_pe(); - int npes = shmem_n_pes(); - - int *my_data = malloc(N * sizeof(int)); - int *all_data = shmem_malloc(N * npes * sizeof(int)); - - int *flags = shmem_calloc(npes, sizeof(int)); - size_t *indices = calloc(npes, sizeof(size_t)); - int *status = calloc(npes, sizeof(int)); - - for (int i = 0; i < N; i++) - my_data[i] = mype*N + i; - - for (int i = 0; i < npes; i++) - shmem_int_put_nbi(&all_data[mype*N], my_data, N, i); - - shmem_fence(); - - for (int i = 0; i < npes; i++) - shmem_int_p(&flags[mype], 1, i); - - int ncompleted = 0; - - while (ncompleted < npes) { - int ntested = shmemx_int_test_some(flags, npes, indices, status, SHMEM_CMP_NE, 0); - if (ntested > 0) { - for (int i = 0; i < ntested; i++) { - for (int j = 0; j < N; j++) - total_sum += all_data[indices[i]*N + j]; - } - ncompleted += ntested; - } else { - /* Overlap some computation here */ - } - } - - /* Check the flags array */ - for (int i = 0; i < npes; i++) { - if (flags[i] != 1) - shmem_global_exit(1); - } - - /* check result */ - int M = N * npes - 1; - if (total_sum != M * (M + 1) / 2) { - shmem_global_exit(2); - } - - /* Sanity check case with NULL status array */ - ncompleted = shmemx_int_test_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); - - if (ncompleted != npes) - shmem_global_exit(3); - - shmem_finalize(); - return 0; -} diff --git a/test/shmemx/shmemx_wait_until_all.c b/test/shmemx/shmemx_wait_until_all.c deleted file mode 100644 index f79a914..0000000 --- a/test/shmemx/shmemx_wait_until_all.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include - -int main(void) -{ - shmem_init(); - int mype = shmem_my_pe(); - int npes = shmem_n_pes(); - - int *flags = shmem_calloc(npes, sizeof(int)); - - for (int i = 0; i < npes; i++) - shmem_int_p(&flags[mype], 1, i); - - shmemx_int_wait_until_all(flags, npes, SHMEM_CMP_EQ, 1); - - /* Check the flags array */ - for (int i = 0; i < npes; i++) { - if (flags[i] != 1) - shmem_global_exit(1); - } - - shmem_free(flags); - shmem_finalize(); - return 0; -} diff --git a/test/shmemx/shmemx_wait_until_any.c b/test/shmemx/shmemx_wait_until_any.c deleted file mode 100644 index efa2968..0000000 --- a/test/shmemx/shmemx_wait_until_any.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include -#include - -#define N 100 - -int main(void) -{ - int total_sum = 0; - - shmem_init(); - int mype = shmem_my_pe(); - int npes = shmem_n_pes(); - - int *my_data = malloc(N * sizeof(int)); - int *all_data = shmem_malloc(N * npes * sizeof(int)); - - int *flags = shmem_calloc(npes, sizeof(int)); - int *status = calloc(npes, sizeof(int)); - - for (int i = 0; i < N; i++) - my_data[i] = mype*N + i; - - for (int i = 0; i < npes; i++) - shmem_int_put_nbi(&all_data[mype*N], my_data, N, i); - - shmem_fence(); - - for (int i = 0; i < npes; i++) - shmem_int_p(&flags[mype], 1, i); - - size_t completed_idx; - for (int i = 0; i < npes; i++) { - completed_idx = shmemx_int_wait_until_any(flags, npes, status, SHMEM_CMP_NE, 0); - for (int j = 0; j < N; j++) - total_sum += all_data[completed_idx * N + j]; - } - - /* Check the flags array */ - for (int i = 0; i < npes; i++) { - if (flags[i] != 1) - shmem_global_exit(1); - } - - /* check result */ - int M = N * npes - 1; - if (total_sum != M * (M + 1) / 2) { - shmem_global_exit(2); - } - - /* Sanity check the case with NULL status array */ - completed_idx = shmemx_int_wait_until_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); - - if (completed_idx >= npes) - shmem_global_exit(3); - - shmem_finalize(); - return 0; -} diff --git a/test/shmemx/shmemx_wait_until_some.c b/test/shmemx/shmemx_wait_until_some.c deleted file mode 100644 index c97f404..0000000 --- a/test/shmemx/shmemx_wait_until_some.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include - -#define N 100 - -int main(void) -{ - int total_sum = 0; - - shmem_init(); - int mype = shmem_my_pe(); - int npes = shmem_n_pes(); - - int *my_data = malloc(N * sizeof(int)); - int *all_data = shmem_malloc(N * npes * sizeof(int)); - - int *flags = shmem_calloc(npes, sizeof(int)); - size_t *indices = malloc(npes * sizeof(size_t)); - int *status = calloc(npes, sizeof(int)); - - for (int i = 0; i < N; i++) - my_data[i] = mype*N + i; - - for (int i = 0; i < npes; i++) - shmem_int_put_nbi(&all_data[mype*N], my_data, N, i); - - shmem_fence(); - - for (int i = 0; i < npes; i++) - shmem_int_p(&flags[mype], 1, i); - - size_t ncompleted; - while ((ncompleted = shmemx_int_wait_until_some(flags, npes, indices, - status, SHMEM_CMP_NE, 0))) { - for (size_t i = 0; i < ncompleted; i++) { - for (size_t j = 0; j < N; j++) - total_sum += all_data[indices[i]*N + j]; - } - } - - /* Check the flags array */ - for (int i = 0; i < npes; i++) { - if (flags[i] != 1) - shmem_global_exit(1); - } - - /* check result */ - int M = N * npes - 1; - if (total_sum != M * (M + 1) / 2) { - shmem_global_exit(2); - } - - /* Sanity check the case with NULL status array */ - ncompleted = shmemx_int_wait_until_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); - - if (ncompleted != npes) - shmem_global_exit(3); - - shmem_finalize(); - return 0; -} diff --git a/test/spec-example/Makefile.am b/test/spec-example/Makefile.am index a1906ff..d03529b 100644 --- a/test/spec-example/Makefile.am +++ b/test/spec-example/Makefile.am @@ -12,30 +12,32 @@ # distribution. check_PROGRAMS = \ - shmem_ctx_pipelined_reduce + shmem_ctx_pipelined_reduce \ + shmem_wait_until_all \ + shmem_wait_until_any \ + shmem_wait_until_some \ + shmem_wait_until_any_vector \ + shmem_test_any \ + shmem_test_some \ + shmem_team_split_strided \ + shmem_team_split_2D \ + shmem_team_translate \ + shmem_team_context \ + shmem_team_broadcast \ + shmem_team_collect \ + shmem_team_alltoall \ + shmem_team_alltoalls if HAVE_OPENMP check_PROGRAMS += \ shmem_ctx endif -if SHMEMX_TESTS +if HAVE_C11 check_PROGRAMS += \ - shmemx_wait_until_all \ - shmemx_wait_until_any \ - shmemx_wait_until_some \ - shmemx_wait_until_any_vector \ - shmemx_test_any \ - shmemx_test_some \ - shmemx_team_split_strided \ - shmemx_team_translate \ - shmemx_team_sync \ - shmemx_team_broadcast \ - shmemx_team_collect \ - shmemx_team_alltoall \ - shmemx_team_alltoalls - -endif SHMEMX_TESTS + shmem_team_sync \ + shmem_reduce_example +endif TESTS = $(check_PROGRAMS) @@ -59,8 +61,4 @@ if USE_PMI_SIMPLE LDADD += $(top_builddir)/pmi-simple/libpmi_simple.la endif -if SHMEMX_TESTS -AM_CPPFLAGS += -DENABLE_SHMEMX_TESTS -endif - shmem_ctx_CFLAGS = $(AM_OPENMP_CFLAGS) diff --git a/test/spec-example/shmem_reduce_example.c b/test/spec-example/shmem_reduce_example.c new file mode 100644 index 0000000..7efb038 --- /dev/null +++ b/test/spec-example/shmem_reduce_example.c @@ -0,0 +1,54 @@ +/* + * This test program is derived from an example program in the + * OpenSHMEM specification. + */ + +#include +#include +#include + +#define NELEMS 32 + +int main(void) { + shmem_init(); + int mype = shmem_my_pe(); + int npes = shmem_n_pes(); + + int *values = shmem_malloc(NELEMS * sizeof(int)); + + unsigned char *value_is_maximal = shmem_malloc(NELEMS * sizeof(unsigned char)); + unsigned char *value_is_maximal_all = shmem_malloc(NELEMS * sizeof(unsigned char)); + + static int maximal_values_count = 0; + static int maximal_values_total; + + srand((unsigned)mype); + + for (int i = 0; i < NELEMS; i++) { + values[i] = rand() % npes; + + /* Track and count instances of maximal values (i.e., values equal to (npes-1)) */ + value_is_maximal[i] = (values[i] == (npes - 1)) ? 1 : 0; + maximal_values_count += value_is_maximal[i]; + } + + /* Wait for all PEs to initialize reductions arrays */ + shmem_sync(SHMEM_TEAM_WORLD); + + shmem_or_reduce(SHMEM_TEAM_WORLD, value_is_maximal_all, value_is_maximal, NELEMS); + shmem_sum_reduce(SHMEM_TEAM_WORLD, &maximal_values_total, &maximal_values_count, 1); + + if (mype == 0) { + printf("Found %d maximal random numbers across all PEs.\n", maximal_values_total); + printf("A maximal number occured (at least once) at the following indices:\n"); + for (int i = 0; i < NELEMS; i++) { + if (value_is_maximal_all[i] == 1) { + printf("%d ", i); + } + } + printf("\n"); + } + + shmem_finalize(); + return 0; +} diff --git a/test/spec-example/shmemx_team_alltoall.c b/test/spec-example/shmem_team_alltoall.c similarity index 89% rename from test/spec-example/shmemx_team_alltoall.c rename to test/spec-example/shmem_team_alltoall.c index 516f5cc..7724ad8 100644 --- a/test/spec-example/shmemx_team_alltoall.c +++ b/test/spec-example/shmem_team_alltoall.c @@ -6,7 +6,6 @@ #include #include #include -#include int main(void) { @@ -26,10 +25,10 @@ int main(void) } } /* wait for all PEs to initialize source/dest */ - shmemx_team_sync(SHMEMX_TEAM_WORLD); + shmem_team_sync(SHMEM_TEAM_WORLD); /* alltoall on all PES */ - shmemx_int64_alltoall(SHMEMX_TEAM_WORLD, dest, source, count); + shmem_int64_alltoall(SHMEM_TEAM_WORLD, dest, source, count); /* verify results */ for (int pe = 0; pe < npes; pe++) { diff --git a/test/spec-example/shmemx_team_alltoalls.c b/test/spec-example/shmem_team_alltoalls.c similarity index 89% rename from test/spec-example/shmemx_team_alltoalls.c rename to test/spec-example/shmem_team_alltoalls.c index 64b591f..7aabe7d 100644 --- a/test/spec-example/shmemx_team_alltoalls.c +++ b/test/spec-example/shmem_team_alltoalls.c @@ -6,7 +6,6 @@ #include #include #include -#include int main(void) { @@ -28,10 +27,10 @@ int main(void) } } /* wait for all PEs to initialize source/dest */ - shmemx_team_sync(SHMEMX_TEAM_WORLD); + shmem_team_sync(SHMEM_TEAM_WORLD); /* alltoalls on all PES */ - shmemx_int64_alltoalls(SHMEMX_TEAM_WORLD, dest, source, dst, sst, count); + shmem_int64_alltoalls(SHMEM_TEAM_WORLD, dest, source, dst, sst, count); /* verify results */ for (int pe = 0; pe < npes; pe++) { diff --git a/test/spec-example/shmemx_team_broadcast.c b/test/spec-example/shmem_team_broadcast.c similarity index 86% rename from test/spec-example/shmemx_team_broadcast.c rename to test/spec-example/shmem_team_broadcast.c index 1a813b6..cb672ca 100644 --- a/test/spec-example/shmemx_team_broadcast.c +++ b/test/spec-example/shmem_team_broadcast.c @@ -6,7 +6,6 @@ #include #include #include -#include int main(void) { @@ -19,7 +18,7 @@ int main(void) for (int i = 0; i < 4; i++) source[i] = i; - shmemx_long_broadcast(SHMEMX_TEAM_WORLD, dest, source, 4, 0); + shmem_long_broadcast(SHMEM_TEAM_WORLD, dest, source, 4, 0); printf("%d: %ld, %ld, %ld, %ld\n", me, dest[0], dest[1], dest[2], dest[3]); diff --git a/test/spec-example/shmemx_team_collect.c b/test/spec-example/shmem_team_collect.c similarity index 89% rename from test/spec-example/shmemx_team_collect.c rename to test/spec-example/shmem_team_collect.c index cbd1ebd..51d34c7 100644 --- a/test/spec-example/shmemx_team_collect.c +++ b/test/spec-example/shmem_team_collect.c @@ -6,7 +6,6 @@ #include #include #include -#include int main(void) { @@ -27,9 +26,9 @@ int main(void) dest[i] = -9999; /* Wait for all PEs to initialize source/dest: */ - shmemx_team_sync(SHMEMX_TEAM_WORLD); + shmem_team_sync(SHMEM_TEAM_WORLD); - shmemx_int_collect(SHMEMX_TEAM_WORLD, dest, source, my_nelem); + shmem_int_collect(SHMEM_TEAM_WORLD, dest, source, my_nelem); shmem_set_lock(&lock); /* Lock prevents interleaving printfs */ printf("%d: %d", me, dest[0]); diff --git a/test/spec-example/shmem_team_context.c b/test/spec-example/shmem_team_context.c new file mode 100644 index 0000000..ea3710a --- /dev/null +++ b/test/spec-example/shmem_team_context.c @@ -0,0 +1,106 @@ +/* + * This test program is derived from an example program in the + * OpenSHMEM specification. + */ + +#include +#include + + +int main(void) +{ + static int sum = 0, val_2, val_3; + shmem_team_t team_2, team_3; + shmem_ctx_t ctx_2, ctx_3; + shmem_team_config_t conf; + + shmem_init(); + + int npes = shmem_n_pes(); + int mype = shmem_my_pe(); + conf.num_contexts = 1; + long cmask = SHMEM_TEAM_NUM_CONTEXTS; + + /* Create team_2 with PEs numbered 0, 2, 4, ... */ + int ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 2, (npes + 1) / 2, &conf, cmask, &team_2); + + if (ret != 0) { + printf("%d: Error creating team team_2 (%d)\n", mype, ret); + shmem_global_exit(ret); + } + + /* Create team_3 with PEs numbered 0, 3, 6, ... */ + ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 3, (npes + 2) / 3, &conf, cmask, &team_3); + + if (ret != 0) { + printf("%d: Error creating team team_3 (%d)\n", mype, ret); + shmem_global_exit(ret); + } + + /* Create a context on team_2. */ + ret = shmem_team_create_ctx(team_2, 0, &ctx_2); + + if (ret != 0 && team_2 != SHMEM_TEAM_INVALID) { + printf("%d: Error creating context ctx_2 (%d)\n", mype, ret); + shmem_global_exit(ret); + } + + /* Create a context on team_3. */ + ret = shmem_team_create_ctx(team_3, 0, &ctx_3); + + if (ret != 0 && team_3 != SHMEM_TEAM_INVALID) { + printf("%d: Error creating context ctx_3 (%d)\n", mype, ret); + shmem_global_exit(ret); + } + + /* Within each team, put my PE number to my neighbor in a ring-based manner. */ + if (ctx_2 != SHMEM_CTX_INVALID) { + int pe = shmem_team_my_pe(team_2); + shmem_ctx_int_put(ctx_2, &val_2, &pe, 1, (pe + 1) % shmem_team_n_pes(team_2)); + } + + if (ctx_3 != SHMEM_CTX_INVALID) { + int pe = shmem_team_my_pe(team_3); + shmem_ctx_int_put(ctx_3, &val_3, &pe, 1, (pe + 1) % shmem_team_n_pes(team_3)); + } + + /* Quiet both contexts and synchronize all PEs to complete the data transfers. */ + shmem_ctx_quiet(ctx_2); + shmem_ctx_quiet(ctx_3); + shmem_team_sync(SHMEM_TEAM_WORLD); + + /* Sum the values among PEs that are in both team_2 and team_3 on PE 0 with ctx_2. */ + if (team_3 != SHMEM_TEAM_INVALID && team_2 != SHMEM_TEAM_INVALID) + shmem_ctx_int_atomic_add(ctx_2, &sum, val_2 + val_3, 0); + + /* Quiet the context and synchronize PEs to complete the operation. */ + shmem_ctx_quiet(ctx_2); + shmem_team_sync(SHMEM_TEAM_WORLD); + + /* Validate the result. */ + if (mype == 0) { + int vsum = 0; + for (int i = 0; i < npes; i ++) { + if (i % 2 == 0 && i % 3 == 0) { + vsum += ((i - 2) < 0) ? shmem_team_n_pes(team_2) - 1 : + shmem_team_translate_pe(SHMEM_TEAM_WORLD, i - 2, team_2); + vsum += ((i - 3) < 0) ? shmem_team_n_pes(team_3) - 1 : + shmem_team_translate_pe(SHMEM_TEAM_WORLD, i - 3, team_3); + } + } + if (sum != vsum) { + fprintf(stderr, "Unexpected result, npes = %d, vsum = %d, sum = %d\n", shmem_n_pes(), vsum, sum); + shmem_global_exit(1); + } + } + + /* Destroy contexts before teams. */ + shmem_ctx_destroy(ctx_2); + shmem_team_destroy(team_2); + + shmem_ctx_destroy(ctx_3); + shmem_team_destroy(team_3); + + shmem_finalize(); + return 0; +} diff --git a/test/spec-example/shmem_team_split_2D.c b/test/spec-example/shmem_team_split_2D.c new file mode 100644 index 0000000..1565505 --- /dev/null +++ b/test/spec-example/shmem_team_split_2D.c @@ -0,0 +1,70 @@ +/* + * This test program is derived from an example program in the + * OpenSHMEM specification. + */ + +#include +#include +#include + +/* Find x and y such that x * y == npes and abs(x - y) is minimized. */ +static void find_xy_dims(int npes, int *x, int *y) { + for(int divider = ceil(sqrt(npes)); divider >= 1; divider--) + if (npes % divider == 0) { + *x = divider; + *y = npes / divider; + return; + } +} + +/* Find x, y, and z such that x * y * z == npes and + * abs(x - y) + abs(x - z) + abs(y - z) is minimized. */ +static void find_xyz_dims(int npes, int *x, int *y, int *z) { + for(int divider = ceil(cbrt(npes)); divider >= 1; divider--) + if (npes % divider == 0) { + *x = divider; + find_xy_dims(npes / divider, y, z); + return; + } +} + +int main(void) { + int xdim = 1; + int ydim = 1; + int zdim = 1; + + shmem_init(); + int mype = shmem_my_pe(); + int npes = shmem_n_pes(); + + find_xyz_dims(npes, &xdim, &ydim, &zdim); + + if (shmem_my_pe() == 0) printf("xdim = %d, ydim = %d, zdim = %d\n", xdim, ydim, zdim); + + shmem_team_t xteam, yzteam, yteam, zteam; + + shmem_team_split_2d(SHMEM_TEAM_WORLD, xdim, NULL, 0, &xteam, NULL, 0, &yzteam); + // yzteam is immediately ready to be used in collectives + shmem_team_split_2d(yzteam, ydim, NULL, 0, &yteam, NULL, 0, &zteam); + + // We don't need the yzteam anymore + shmem_team_destroy(yzteam); + + int my_x = shmem_team_my_pe(xteam); + int my_y = shmem_team_my_pe(yteam); + int my_z = shmem_team_my_pe(zteam); + + for (int zdx = 0; zdx < zdim; zdx++) { + for (int ydx = 0; ydx < ydim; ydx++) { + for (int xdx = 0; xdx < xdim; xdx++) { + if ((my_x == xdx) && (my_y == ydx) && (my_z == zdx)) { + printf("(%d, %d, %d) is mype = %d\n", my_x, my_y, my_z, mype); + } + shmem_team_sync(SHMEM_TEAM_WORLD); + } + } + } + + shmem_finalize(); + return 0; +} diff --git a/test/spec-example/shmemx_team_split_strided.c b/test/spec-example/shmem_team_split_strided.c similarity index 75% rename from test/spec-example/shmemx_team_split_strided.c rename to test/spec-example/shmem_team_split_strided.c index b462922..61b8e84 100644 --- a/test/spec-example/shmemx_team_split_strided.c +++ b/test/spec-example/shmem_team_split_strided.c @@ -4,7 +4,6 @@ */ #include -#include #include int main(int argc, char *argv[]) @@ -12,8 +11,8 @@ int main(int argc, char *argv[]) int rank, npes; int t_pe, t_size; int ret; - shmemx_team_t new_team; - shmemx_team_config_t *config; + shmem_team_t new_team; + shmem_team_config_t *config; shmem_init(); config = NULL; @@ -26,17 +25,17 @@ int main(int argc, char *argv[]) return 0; } - ret = shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 2, (npes + 1) / 2, + ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 2, (npes + 1) / 2, config, 0, &new_team); if (ret != 0) { shmem_global_exit(2); } - t_size = shmemx_team_n_pes(new_team); - t_pe = shmemx_team_my_pe(new_team); + t_size = shmem_team_n_pes(new_team); + t_pe = shmem_team_my_pe(new_team); - if (new_team != SHMEMX_TEAM_INVALID) { + if (new_team != SHMEM_TEAM_INVALID) { if ((rank % 2 != 0) || (rank / 2 != t_pe) || ((npes + 1) / 2 != t_size)) { shmem_global_exit(3); } diff --git a/test/spec-example/shmemx_team_sync.c b/test/spec-example/shmem_team_sync.c similarity index 51% rename from test/spec-example/shmemx_team_sync.c rename to test/spec-example/shmem_team_sync.c index d42c9af..fc10c95 100644 --- a/test/spec-example/shmemx_team_sync.c +++ b/test/spec-example/shmem_team_sync.c @@ -5,7 +5,6 @@ #include #include -#include #if !(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) #define shmem_p shmem_int_p @@ -15,9 +14,9 @@ int main(void) { static int x = 10101; - shmemx_team_t twos_team = SHMEMX_TEAM_INVALID; - shmemx_team_t threes_team = SHMEMX_TEAM_INVALID; - shmemx_team_config_t *config; + shmem_team_t twos_team = SHMEM_TEAM_INVALID; + shmem_team_t threes_team = SHMEM_TEAM_INVALID; + shmem_team_config_t *config; shmem_init(); config = NULL; @@ -25,34 +24,34 @@ int main(void) int npes = shmem_n_pes(); if (npes > 2) - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 2, 2, (npes-1) / 2, config, + shmem_team_split_strided(SHMEM_TEAM_WORLD, 2, 2, (npes-1) / 2, config, 0, &twos_team); if (npes > 3) - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 3, 3, (npes-1) / 3, config, + shmem_team_split_strided(SHMEM_TEAM_WORLD, 3, 3, (npes-1) / 3, config, 0, &threes_team); - int my_pe_twos = shmemx_team_my_pe(twos_team); - int my_pe_threes = shmemx_team_my_pe(threes_team); - int npes_twos = shmemx_team_n_pes(twos_team); - int npes_threes = shmemx_team_n_pes(threes_team); + int my_pe_twos = shmem_team_my_pe(twos_team); + int my_pe_threes = shmem_team_my_pe(threes_team); + int npes_twos = shmem_team_n_pes(twos_team); + int npes_threes = shmem_team_n_pes(threes_team); - if (twos_team != SHMEMX_TEAM_INVALID) { + if (twos_team != SHMEM_TEAM_INVALID) { /* put the value 2 to the next team member in a circular fashion */ - shmem_p(&x, 2, shmemx_team_translate_pe(twos_team, (my_pe_twos + 1) % - npes_twos, SHMEMX_TEAM_WORLD)); + shmem_p(&x, 2, shmem_team_translate_pe(twos_team, (my_pe_twos + 1) % + npes_twos, SHMEM_TEAM_WORLD)); shmem_quiet(); - shmemx_sync(twos_team); + shmem_sync(twos_team); } - shmemx_sync(SHMEMX_TEAM_WORLD); + shmem_sync(SHMEM_TEAM_WORLD); - if (threes_team != SHMEMX_TEAM_INVALID) { + if (threes_team != SHMEM_TEAM_INVALID) { /* put the value 3 to the next team member in a circular fashion */ - shmem_p(&x, 3, shmemx_team_translate_pe(threes_team, (my_pe_threes + 1) % - npes_threes, SHMEMX_TEAM_WORLD)); + shmem_p(&x, 3, shmem_team_translate_pe(threes_team, (my_pe_threes + 1) % + npes_threes, SHMEM_TEAM_WORLD)); shmem_quiet(); - shmemx_sync(threes_team); + shmem_sync(threes_team); } if (me && me % 3 == 0) { diff --git a/test/spec-example/shmemx_team_translate.c b/test/spec-example/shmem_team_translate.c similarity index 69% rename from test/spec-example/shmemx_team_translate.c rename to test/spec-example/shmem_team_translate.c index 9e462ec..add6af9 100644 --- a/test/spec-example/shmemx_team_translate.c +++ b/test/spec-example/shmem_team_translate.c @@ -4,7 +4,6 @@ */ #include -#include #include int main(int argc, char *argv[]) @@ -12,8 +11,8 @@ int main(int argc, char *argv[]) int rank, npes; int t_pe; int t_global; - shmemx_team_t new_team; - shmemx_team_config_t *config; + shmem_team_t new_team; + shmem_team_config_t *config; shmem_init(); config = NULL; @@ -26,13 +25,13 @@ int main(int argc, char *argv[]) return 0; } - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 2, npes / 2, config, 0, + shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 2, npes / 2, config, 0, &new_team); - t_pe = shmemx_team_my_pe(new_team); - t_global = shmemx_team_translate_pe(new_team, t_pe, SHMEMX_TEAM_WORLD); + t_pe = shmem_team_my_pe(new_team); + t_global = shmem_team_translate_pe(new_team, t_pe, SHMEM_TEAM_WORLD); - if (new_team != SHMEMX_TEAM_INVALID) { + if (new_team != SHMEM_TEAM_INVALID) { if (t_global != rank) { shmem_global_exit(2); } diff --git a/test/spec-example/shmemx_test_any.c b/test/spec-example/shmem_test_any.c similarity index 91% rename from test/spec-example/shmemx_test_any.c rename to test/spec-example/shmem_test_any.c index 1e7405b..b36a19d 100644 --- a/test/spec-example/shmemx_test_any.c +++ b/test/spec-example/shmem_test_any.c @@ -30,7 +30,6 @@ */ #include -#include #include int main(void) @@ -49,7 +48,7 @@ int main(void) size_t completed_idx; while (ncompleted < npes) { - completed_idx = shmemx_int_test_any(flags, npes, status, SHMEM_CMP_EQ, 1); + completed_idx = shmem_int_test_any(flags, npes, status, SHMEM_CMP_EQ, 1); if (completed_idx != SIZE_MAX) { ncompleted++; status[completed_idx] = 1; @@ -69,7 +68,7 @@ int main(void) int *found = calloc(npes, sizeof(int)); while (ncompleted < npes) { - int idx = shmemx_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); + int idx = shmem_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); if (found[idx] == 0) { found[idx] = 1; ncompleted++; @@ -83,7 +82,7 @@ int main(void) } /* Sanity check case with NULL status array */ - completed_idx = shmemx_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); + completed_idx = shmem_int_test_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); if (completed_idx >= (size_t)npes) shmem_global_exit(3); diff --git a/test/spec-example/shmemx_test_some.c b/test/spec-example/shmem_test_some.c similarity index 93% rename from test/spec-example/shmemx_test_some.c rename to test/spec-example/shmem_test_some.c index fc8a7de..3377198 100644 --- a/test/spec-example/shmemx_test_some.c +++ b/test/spec-example/shmem_test_some.c @@ -30,7 +30,6 @@ */ #include -#include #include #define N 100 @@ -64,7 +63,7 @@ int main(void) int ncompleted = 0; while (ncompleted < npes) { - int ntested = shmemx_int_test_some(flags, npes, indices, status, SHMEM_CMP_NE, 0); + int ntested = shmem_int_test_some(flags, npes, indices, status, SHMEM_CMP_NE, 0); if (ntested > 0) { for (int i = 0; i < ntested; i++) { for (int j = 0; j < N; j++) { @@ -91,7 +90,7 @@ int main(void) } /* Sanity check case with NULL status array */ - ncompleted = shmemx_int_test_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); + ncompleted = shmem_int_test_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); if (ncompleted != npes) shmem_global_exit(3); diff --git a/test/spec-example/shmemx_wait_until_all.c b/test/spec-example/shmem_wait_until_all.c similarity index 95% rename from test/spec-example/shmemx_wait_until_all.c rename to test/spec-example/shmem_wait_until_all.c index 52991ea..47ac6c8 100644 --- a/test/spec-example/shmemx_wait_until_all.c +++ b/test/spec-example/shmem_wait_until_all.c @@ -30,7 +30,6 @@ */ #include -#include int main(void) { @@ -44,7 +43,7 @@ int main(void) for (int i = 0; i < npes; i++) shmem_int_atomic_set(&flags[mype], 1, i); - shmemx_int_wait_until_all(flags, npes, status, SHMEM_CMP_EQ, 1); + shmem_int_wait_until_all(flags, npes, status, SHMEM_CMP_EQ, 1); /* Check the flags array */ for (int i = 0; i < npes; i++) { diff --git a/test/spec-example/shmemx_wait_until_any.c b/test/spec-example/shmem_wait_until_any.c similarity index 93% rename from test/spec-example/shmemx_wait_until_any.c rename to test/spec-example/shmem_wait_until_any.c index 9962156..02f93bd 100644 --- a/test/spec-example/shmemx_wait_until_any.c +++ b/test/spec-example/shmem_wait_until_any.c @@ -30,7 +30,6 @@ */ #include -#include #include #define N 100 @@ -62,7 +61,7 @@ int main(void) size_t completed_idx; for (int i = 0; i < npes; i++) { - completed_idx = shmemx_int_wait_until_any(flags, npes, status, SHMEM_CMP_NE, 0); + completed_idx = shmem_int_wait_until_any(flags, npes, status, SHMEM_CMP_NE, 0); for (int j = 0; j < N; j++) { total_sum += all_data[completed_idx * N + j]; } @@ -82,7 +81,7 @@ int main(void) } /* Sanity check the case with NULL status array */ - completed_idx = shmemx_int_wait_until_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); + completed_idx = shmem_int_wait_until_any(flags, npes, NULL, SHMEM_CMP_EQ, 1); if (completed_idx >= (size_t)npes) shmem_global_exit(3); diff --git a/test/spec-example/shmemx_wait_until_any_vector.c b/test/spec-example/shmem_wait_until_any_vector.c similarity index 94% rename from test/spec-example/shmemx_wait_until_any_vector.c rename to test/spec-example/shmem_wait_until_any_vector.c index 29cddfd..8860855 100644 --- a/test/spec-example/shmemx_wait_until_any_vector.c +++ b/test/spec-example/shmem_wait_until_any_vector.c @@ -30,7 +30,6 @@ */ #include -#include #include #define N 100 @@ -57,7 +56,7 @@ int main(void) size_t completed_idx; for (int i = 0; i < npes; i++) { - completed_idx = shmemx_int_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); + completed_idx = shmem_int_wait_until_any_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); status[completed_idx] = 1; total_sum += ivars[completed_idx]; } diff --git a/test/spec-example/shmemx_wait_until_some.c b/test/spec-example/shmem_wait_until_some.c similarity index 88% rename from test/spec-example/shmemx_wait_until_some.c rename to test/spec-example/shmem_wait_until_some.c index 340abe0..61df1ba 100644 --- a/test/spec-example/shmemx_wait_until_some.c +++ b/test/spec-example/shmem_wait_until_some.c @@ -1,5 +1,4 @@ #include -#include #include #define N 100 @@ -31,7 +30,7 @@ int main(void) shmem_int_atomic_set(&flags[mype], 1, i); size_t ncompleted; - while ((ncompleted = shmemx_int_wait_until_some(flags, npes, indices, + while ((ncompleted = shmem_int_wait_until_some(flags, npes, indices, status, SHMEM_CMP_NE, 0))) { for (size_t i = 0; i < ncompleted; i++) { for (size_t j = 0; j < N; j++) { @@ -54,7 +53,7 @@ int main(void) } /* Sanity check the case with NULL status array */ - ncompleted = shmemx_int_wait_until_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); + ncompleted = shmem_int_wait_until_some(flags, npes, indices, NULL, SHMEM_CMP_EQ, 1); if (ncompleted != (size_t)npes) shmem_global_exit(3); diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index 1114a08..9fbd4ad 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -79,7 +79,13 @@ check_PROGRAMS = \ c11_test_shmem_atomic_swap \ c11_test_shmem_atomic_cswap \ c11_test_shmem_wait_until \ + c11_test_shmem_wait_until_vector \ + c11_shmem_wait_until_all_any_some \ c11_test_shmem_test \ + c11_shmem_test_vector \ + c11_shmem_test_all_any_some \ + c11_shmem_team_collective_types \ + c11_shmem_team_reduce \ get_nbi \ put_nbi \ rma_coverage \ @@ -97,7 +103,20 @@ check_PROGRAMS = \ sync-size \ many-ctx \ shmem_test \ - shmem_ptr + shmem_ptr \ + shmem_malloc_with_hints \ + put_signal \ + put_signal_nbi \ + signal_fetch \ + shmem_team_b2b_collectives \ + shmem_team_collect_active_set \ + shmem_team_max \ + shmem_team_reuse_teams \ + shmem_team_shared \ + shmem_team_split_2d \ + shmem_team_translate \ + atomic_nbi \ + fadd_nbi # Temporarily disabled: Global exit test tends to fail with MPI-PMI if !USE_PMI_MPI @@ -107,7 +126,8 @@ endif if ENABLE_PROFILING check_PROGRAMS += \ - rma_coverage_pshmem + rma_coverage_pshmem \ + pcontrol endif if HAVE_CXX @@ -127,7 +147,8 @@ check_PROGRAMS += \ cxx_test_shmem_atomic_swap \ cxx_test_shmem_atomic_cswap \ cxx_test_shmem_wait_until \ - cxx_test_shmem_test + cxx_test_shmem_test \ + cxx_shmem_test_all endif if HAVE_FORTRAN diff --git a/test/shmemx/atomic_nbi.c b/test/unit/atomic_nbi.c similarity index 94% rename from test/shmemx/atomic_nbi.c rename to test/unit/atomic_nbi.c index 982a54a..dc11517 100644 --- a/test/shmemx/atomic_nbi.c +++ b/test/unit/atomic_nbi.c @@ -28,7 +28,6 @@ #include #include #include -#include #define N 2 @@ -55,7 +54,7 @@ int main(void) { /* Loop until we observe 'npes' values that are congruent to 'me' mod N */ for (int ncompleted = 0; ncompleted < npes; ) { for (i = 0; i < npes; i++) - shmemx_long_atomic_swap_nbi(&result[i], &target, me, i); + shmem_long_atomic_swap_nbi(&result[i], &target, me, i); shmem_quiet(); for (i = 0; i < npes; i++) if (me % N == result[i] % N) ++ncompleted; @@ -90,7 +89,7 @@ int main(void) { /* Attempt to increment each PE not already incremented by me */ for (i = 0; i < npes; i++) if (result[i] != me-1) - shmemx_long_atomic_compare_swap_nbi(&result[i], &target, me-1, me, i); + shmem_long_atomic_compare_swap_nbi(&result[i], &target, me-1, me, i); shmem_quiet(); diff --git a/test/shmemx/c11_shmemx_team_collective_types.c b/test/unit/c11_shmem_team_collective_types.c similarity index 97% rename from test/shmemx/c11_shmemx_team_collective_types.c rename to test/unit/c11_shmem_team_collective_types.c index cfddff0..7c50584 100644 --- a/test/shmemx/c11_shmemx_team_collective_types.c +++ b/test/unit/c11_shmem_team_collective_types.c @@ -34,7 +34,6 @@ #include #include #include -#include #define MAX_NPES 32 @@ -53,19 +52,19 @@ enum op { BCAST = 0, COLLECT, FCOLLECT, ALLTOALL, ALLTOALLS }; \ switch (OP) { \ case BCAST: \ - shmemx_broadcast(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES, npes-1); \ + shmem_broadcast(SHMEM_TEAM_WORLD, dest, src, MAX_NPES, npes-1); \ break; \ case COLLECT: \ - shmemx_collect(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES); \ + shmem_collect(SHMEM_TEAM_WORLD, dest, src, MAX_NPES); \ break; \ case FCOLLECT: \ - shmemx_fcollect(SHMEMX_TEAM_WORLD, dest, src, MAX_NPES); \ + shmem_fcollect(SHMEM_TEAM_WORLD, dest, src, MAX_NPES); \ break; \ case ALLTOALL: \ - shmemx_alltoall(SHMEMX_TEAM_WORLD, dest, src, 1); \ + shmem_alltoall(SHMEM_TEAM_WORLD, dest, src, 1); \ break; \ case ALLTOALLS: \ - shmemx_alltoalls(SHMEMX_TEAM_WORLD, dest, src, 1, 1, 1); \ + shmem_alltoalls(SHMEM_TEAM_WORLD, dest, src, 1, 1, 1); \ break; \ default: \ printf("Invalid operation (%d)\n", OP); \ diff --git a/test/shmemx/c11_shmemx_team_reduce.c b/test/unit/c11_shmem_team_reduce.c similarity index 99% rename from test/shmemx/c11_shmemx_team_reduce.c rename to test/unit/c11_shmem_team_reduce.c index 3ad721b..423536f 100644 --- a/test/shmemx/c11_shmemx_team_reduce.c +++ b/test/unit/c11_shmem_team_reduce.c @@ -37,7 +37,6 @@ #include #include #include -#include #define MAX_NPES 32 @@ -48,7 +47,7 @@ enum op { and = 0, or, xor, max, min, sum, prod }; const double FLOATING_POINT_TOLERANCE = 1e-6; #define REDUCTION(OP) \ - do { ret = shmemx_##OP##_reduce(SHMEMX_TEAM_WORLD, dest, src, npes); } while (0) + do { ret = shmem_##OP##_reduce(SHMEM_TEAM_WORLD, dest, src, npes); } while (0) #define is_floating_point(X) _Generic((X), \ float: true, \ diff --git a/test/shmemx/c11_test_shmemx_test.c b/test/unit/c11_shmem_test_all_any_some.c similarity index 95% rename from test/shmemx/c11_test_shmemx_test.c rename to test/unit/c11_shmem_test_all_any_some.c index 713ef8d..5a68995 100644 --- a/test/shmemx/c11_test_shmemx_test.c +++ b/test/unit/c11_shmem_test_all_any_some.c @@ -34,7 +34,6 @@ #include #include #include -#include #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L @@ -45,7 +44,7 @@ const int npes = shmem_n_pes(); \ int status = 0; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - while (!shmemx_test_all(&remote, 1, &status, SHMEM_CMP_NE, 0)) ; \ + while (!shmem_test_all(&remote, 1, &status, SHMEM_CMP_NE, 0)) ; \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_TEST_ALL(%s)\n", mype, #TYPE); \ @@ -60,7 +59,7 @@ const int npes = shmem_n_pes(); \ int status = 0; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - while (shmemx_test_any(&remote, 1, &status, SHMEM_CMP_NE, 0) == SIZE_MAX); \ + while (shmem_test_any(&remote, 1, &status, SHMEM_CMP_NE, 0) == SIZE_MAX); \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_TEST_ANY(%s)\n", mype, #TYPE); \ @@ -76,7 +75,7 @@ int status = 0; \ size_t indices; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - while (!shmemx_test_some(&remote, 1, &indices, &status, SHMEM_CMP_NE, 0)); \ + while (!shmem_test_some(&remote, 1, &indices, &status, SHMEM_CMP_NE, 0)); \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_TEST_SOME(%s)\n", mype, #TYPE); \ diff --git a/test/shmemx/c11_test_shmemx_test_vector.c b/test/unit/c11_shmem_test_vector.c similarity index 97% rename from test/shmemx/c11_test_shmemx_test_vector.c rename to test/unit/c11_shmem_test_vector.c index d91061c..ad6fe3c 100644 --- a/test/shmemx/c11_test_shmemx_test_vector.c +++ b/test/unit/c11_shmem_test_vector.c @@ -1,5 +1,4 @@ #include -#include #include #include @@ -26,7 +25,7 @@ expected_sum = (npes-1) * npes / 2; \ size_t ncompleted = 0; \ while(ncompleted == 0){ \ - ncompleted = shmemx_test_all_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \ + ncompleted = shmem_test_all_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \ } \ \ for(i = 0; i #include #include -#include #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L @@ -45,7 +44,7 @@ const int npes = shmem_n_pes(); \ int status = 0; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - shmemx_wait_until_all(&remote, 1, &status, SHMEM_CMP_NE, 0); \ + shmem_wait_until_all(&remote, 1, &status, SHMEM_CMP_NE, 0); \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_WAIT_UNTIL_ALL(%s)\n", mype, #TYPE); \ @@ -60,7 +59,7 @@ const int npes = shmem_n_pes(); \ int status = 0; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - shmemx_wait_until_any(&remote, 1, &status, SHMEM_CMP_NE, 0); \ + shmem_wait_until_any(&remote, 1, &status, SHMEM_CMP_NE, 0); \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_WAIT_UNTIL_ANY(%s)\n", mype, #TYPE); \ @@ -76,7 +75,7 @@ int status = 0; \ size_t indices; \ shmem_p(&remote, (TYPE)mype+1, (mype + 1) % npes); \ - shmemx_wait_until_some(&remote, 1, &indices, &status, SHMEM_CMP_NE, 0); \ + shmem_wait_until_some(&remote, 1, &indices, &status, SHMEM_CMP_NE, 0); \ if (remote != (TYPE)((mype + npes - 1) % npes)+1) { \ printf("PE %i received incorrect value with " \ "TEST_SHMEM_WAIT_UNTIL_SOME(%s)\n", mype, #TYPE); \ diff --git a/test/unit/c11_test_shmem_atomic_add.c b/test/unit/c11_test_shmem_atomic_add.c index 58686d5..5df80fb 100644 --- a/test/unit/c11_test_shmem_atomic_add.c +++ b/test/unit/c11_test_shmem_atomic_add.c @@ -35,10 +35,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, @@ -52,10 +48,9 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, #define DEPRECATED_FADD shmem_atomic_fetch_add #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_ADD_NBI: \ - shmemx_atomic_fetch_add_nbi(&old, &remote, (TYPE)(mype + 1), i); \ + shmem_atomic_fetch_add_nbi(&old, &remote, (TYPE)(mype + 1), i); \ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -64,7 +59,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, } \ break; \ case CTX_ATOMIC_FETCH_ADD_NBI: \ - shmemx_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(mype + 1), i); \ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ @@ -73,9 +68,6 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_ADD(OP, TYPE) \ do { \ @@ -120,7 +112,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -223,7 +215,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD, size_t); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD, ptrdiff_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, int); TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, long); TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, long long); @@ -249,7 +240,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, uint64_t); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, size_t); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, ptrdiff_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_and.c b/test/unit/c11_test_shmem_atomic_and.c index 1484fed..1d1eb13 100644 --- a/test/unit/c11_test_shmem_atomic_and.c +++ b/test/unit/c11_test_shmem_atomic_and.c @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, @@ -50,10 +46,9 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, * The result has the NPES least significant bits cleared, 111...000...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_AND_NBI: \ - shmemx_atomic_fetch_and_nbi(&old, &remote, \ + shmem_atomic_fetch_and_nbi(&old, &remote, \ ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -63,7 +58,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, } \ break; \ case CTX_FETCH_AND_NBI: \ - shmemx_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -72,9 +67,6 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_AND(OP, TYPE) \ do { \ @@ -107,7 +99,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -161,7 +153,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_AND(CTX_FETCH_AND, uint32_t); TEST_SHMEM_AND(CTX_FETCH_AND, uint64_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_AND(FETCH_AND_NBI, unsigned int); TEST_SHMEM_AND(FETCH_AND_NBI, unsigned long); TEST_SHMEM_AND(FETCH_AND_NBI, unsigned long long); @@ -177,7 +168,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_AND(CTX_FETCH_AND_NBI, int64_t); TEST_SHMEM_AND(CTX_FETCH_AND_NBI, uint32_t); TEST_SHMEM_AND(CTX_FETCH_AND_NBI, uint64_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_cswap.c b/test/unit/c11_test_shmem_atomic_cswap.c index d2d0c07..a6dc553 100644 --- a/test/unit/c11_test_shmem_atomic_cswap.c +++ b/test/unit/c11_test_shmem_atomic_cswap.c @@ -35,10 +35,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, @@ -50,20 +46,16 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, #define DEPRECATED_CSWAP shmem_atomic_compare_swap #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_atomic_compare_swap_nbi(&old, &remote, (TYPE)npes, \ + shmem_atomic_compare_swap_nbi(&old, &remote, (TYPE)npes, \ (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)npes, (TYPE)mype, \ (mype + 1) % npes); \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_CSWAP(OP, TYPE) \ do { \ @@ -87,7 +79,7 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, (TYPE)npes, (TYPE)mype, \ (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -156,7 +148,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP, size_t); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP, ptrdiff_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, int); TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, long); TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, long long); @@ -182,7 +173,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, uint64_t); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, size_t); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, ptrdiff_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_fetch.c b/test/unit/c11_test_shmem_atomic_fetch.c index 30affff..3c75256 100644 --- a/test/unit/c11_test_shmem_atomic_fetch.c +++ b/test/unit/c11_test_shmem_atomic_fetch.c @@ -35,10 +35,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, @@ -50,21 +46,17 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, #define DEPRECATED_FETCH shmem_atomic_fetch #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_NBI: \ - shmemx_atomic_fetch_nbi(&val, &remote, \ + shmem_atomic_fetch_nbi(&val, &remote, \ (mype + 1) % npes); \ shmem_quiet(); \ break; \ case CTX_ATOMIC_FETCH_NBI: \ - shmemx_atomic_fetch_nbi(SHMEM_CTX_DEFAULT, &val, \ + shmem_atomic_fetch_nbi(SHMEM_CTX_DEFAULT, &val, \ &remote, (mype + 1) % npes); \ shmem_quiet(); \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_FETCH(OP, TYPE) \ do { \ @@ -84,7 +76,7 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, case CTX_ATOMIC_FETCH: \ val = shmem_atomic_fetch(SHMEM_CTX_DEFAULT, &remote, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -153,7 +145,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH, size_t); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH, ptrdiff_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, float); TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, double); TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, int); @@ -183,7 +174,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, uint64_t); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, size_t); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, ptrdiff_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_inc.c b/test/unit/c11_test_shmem_atomic_inc.c index 4fab8c2..1156439 100644 --- a/test/unit/c11_test_shmem_atomic_inc.c +++ b/test/unit/c11_test_shmem_atomic_inc.c @@ -35,10 +35,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, @@ -53,10 +49,9 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, #define DEPRECATED_FINC shmem_atomic_fetch_inc #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_FETCH_INC_NBI: \ - shmemx_atomic_fetch_inc_nbi(&old, &remote, i); \ + shmem_atomic_fetch_inc_nbi(&old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -65,7 +60,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, } \ break; \ case CTX_ATOMIC_FETCH_INC_NBI: \ - shmemx_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT, &old, &remote, i); \ + shmem_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT, &old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -73,9 +68,6 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_INC(OP, TYPE) \ do { \ @@ -120,7 +112,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -223,7 +215,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC, size_t); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC, ptrdiff_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, int); TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, long); TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, long long); @@ -249,7 +240,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, uint64_t); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, size_t); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, ptrdiff_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_or.c b/test/unit/c11_test_shmem_atomic_or.c index 0511745..750814e 100644 --- a/test/unit/c11_test_shmem_atomic_or.c +++ b/test/unit/c11_test_shmem_atomic_or.c @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, @@ -50,10 +46,9 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, * The result has the NPES least significant bits set, 000...111...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_OR_NBI: \ - shmemx_atomic_fetch_or_nbi(&old, &remote, \ + shmem_atomic_fetch_or_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -63,7 +58,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, } \ break; \ case CTX_FETCH_OR_NBI: \ - shmemx_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -72,9 +67,6 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_OR(OP, TYPE) \ do { \ @@ -109,7 +101,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -163,7 +155,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_OR(CTX_FETCH_OR, uint32_t); TEST_SHMEM_OR(CTX_FETCH_OR, uint64_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_OR(FETCH_OR_NBI, unsigned int); TEST_SHMEM_OR(FETCH_OR_NBI, unsigned long); TEST_SHMEM_OR(FETCH_OR_NBI, unsigned long long); @@ -179,7 +170,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_OR(CTX_FETCH_OR_NBI, int64_t); TEST_SHMEM_OR(CTX_FETCH_OR_NBI, uint32_t); TEST_SHMEM_OR(CTX_FETCH_OR_NBI, uint64_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_swap.c b/test/unit/c11_test_shmem_atomic_swap.c index de12c84..6d8e8bd 100644 --- a/test/unit/c11_test_shmem_atomic_swap.c +++ b/test/unit/c11_test_shmem_atomic_swap.c @@ -35,10 +35,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, @@ -50,19 +46,15 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, #define DEPRECATED_SWAP shmem_atomic_swap #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case ATOMIC_SWAP_NBI: \ - shmemx_atomic_swap_nbi(&old, &remote, \ + shmem_atomic_swap_nbi(&old, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_SWAP_NBI: \ - shmemx_atomic_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_swap_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_SWAP(OP, TYPE) \ do { \ @@ -83,7 +75,7 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, old = shmem_atomic_swap(SHMEM_CTX_DEFAULT, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -158,7 +150,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP, size_t); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP, ptrdiff_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, float); TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, double); TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, int); @@ -188,7 +179,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, uint64_t); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, size_t); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, ptrdiff_t); -#endif shmem_finalize(); return rc; diff --git a/test/unit/c11_test_shmem_atomic_xor.c b/test/unit/c11_test_shmem_atomic_xor.c index 286d9ac..63f6abd 100644 --- a/test/unit/c11_test_shmem_atomic_xor.c +++ b/test/unit/c11_test_shmem_atomic_xor.c @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, @@ -50,10 +46,9 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, * The result has the NPES least significant bits cleared, 111...000...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE) \ case FETCH_XOR_NBI: \ - shmemx_atomic_fetch_xor_nbi(&old, &remote, \ + shmem_atomic_fetch_xor_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -63,7 +58,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, } \ break; \ case CTX_FETCH_XOR_NBI: \ - shmemx_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ + shmem_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT, &old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -72,9 +67,6 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE) -#endif #define TEST_SHMEM_XOR(OP, TYPE) \ do { \ @@ -107,7 +99,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE) \ + SHMEM_NBI_OPS_CASES(OP, TYPE) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -161,7 +153,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_XOR(CTX_FETCH_XOR, uint32_t); TEST_SHMEM_XOR(CTX_FETCH_XOR, uint64_t); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned int); TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned long); TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned long long); @@ -177,7 +168,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, int64_t); TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, uint32_t); TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, uint64_t); -#endif shmem_finalize(); return rc; diff --git a/test/shmemx/c11_test_shmemx_wait_until_vector.c b/test/unit/c11_test_shmem_wait_until_vector.c similarity index 97% rename from test/shmemx/c11_test_shmemx_wait_until_vector.c rename to test/unit/c11_test_shmem_wait_until_vector.c index 296b889..36be030 100644 --- a/test/shmemx/c11_test_shmemx_wait_until_vector.c +++ b/test/unit/c11_test_shmem_wait_until_vector.c @@ -1,5 +1,4 @@ #include -#include #include #include @@ -24,7 +23,7 @@ } \ \ expected_sum = (npes-1) * npes / 2; \ - shmemx_wait_until_all_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \ + shmem_wait_until_all_vector(ivars, npes, status, SHMEM_CMP_EQ, cmp_values); \ \ for(i = 0; i -#include int main(void) { @@ -44,7 +43,7 @@ int main(void) for (int i = 0; i < npes; i++) shmem_int_p(&flags[mype], 1, i); - while (!shmemx_int_test_all(flags, npes, status, SHMEM_CMP_EQ, 1)); + while (!shmem_int_test_all(flags, npes, status, SHMEM_CMP_EQ, 1)); /* Check the flags array */ for (int i = 0; i < npes; i++) { diff --git a/test/unit/cxx_test_shmem_atomic_add.cpp b/test/unit/cxx_test_shmem_atomic_add.cpp index 96e673a..50772e8 100644 --- a/test/unit/cxx_test_shmem_atomic_add.cpp +++ b/test/unit/cxx_test_shmem_atomic_add.cpp @@ -36,9 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, CTX_ATOMIC_FETCH_ADD, ATOMIC_FETCH_ADD_NBI, CTX_ATOMIC_FETCH_ADD_NBI }; @@ -51,10 +48,9 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, #define DEPRECATED_FADD(TYPENAME, ...) shmem_##TYPENAME##_atomic_fetch_add(__VA_ARGS__) #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case ATOMIC_FETCH_ADD_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_add_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_fetch_add_nbi(&old, &remote, \ (TYPE)(mype + 1), i); \ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ @@ -64,7 +60,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, } \ break; \ case CTX_ATOMIC_FETCH_ADD_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_add_nbi(SHMEM_CTX_DEFAULT,\ &old, &remote, (TYPE)(mype + 1), i);\ shmem_quiet(); \ if (old > (TYPE)(npes * (npes + 1) / 2)) { \ @@ -73,9 +69,6 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_ADD(OP, TYPE, TYPENAME) \ do { \ @@ -123,7 +116,7 @@ enum op { ADD = 0, ATOMIC_ADD, CTX_ATOMIC_ADD, FADD, ATOMIC_FETCH_ADD, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -222,7 +215,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD, size_t, size); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD, ptrdiff_t, ptrdiff); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, int, int); TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, long, long); TEST_SHMEM_ADD(ATOMIC_FETCH_ADD_NBI, long long, longlong); @@ -248,7 +240,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, uint64_t, uint64); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, size_t, size); TEST_SHMEM_ADD(CTX_ATOMIC_FETCH_ADD_NBI, ptrdiff_t, ptrdiff); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_and.cpp b/test/unit/cxx_test_shmem_atomic_and.cpp index 1d8550a..3f24850 100644 --- a/test/unit/cxx_test_shmem_atomic_and.cpp +++ b/test/unit/cxx_test_shmem_atomic_and.cpp @@ -37,10 +37,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, CTX_FETCH_AND_NBI }; @@ -49,10 +45,9 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, * The result has the NPES least significant bits cleared, 111...000...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case FETCH_AND_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_and_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_fetch_and_nbi(&old, &remote, \ ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -62,7 +57,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, } \ break; \ case CTX_FETCH_AND_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_and_nbi(SHMEM_CTX_DEFAULT,\ &old, &remote, ~(TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) == 0) { \ @@ -71,9 +66,6 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_AND(OP, TYPE, TYPENAME) \ do { \ @@ -108,7 +100,7 @@ enum op { AND = 0, CTX_AND, FETCH_AND, CTX_FETCH_AND, FETCH_AND_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -161,7 +153,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_AND(CTX_FETCH_AND, uint32_t, uint32); TEST_SHMEM_AND(CTX_FETCH_AND, uint64_t, uint64); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_AND(FETCH_AND_NBI, unsigned int, uint); TEST_SHMEM_AND(FETCH_AND_NBI, unsigned long, ulong); TEST_SHMEM_AND(FETCH_AND_NBI, unsigned long long, ulonglong); @@ -177,7 +168,7 @@ int main(int argc, char* argv[]) { TEST_SHMEM_AND(CTX_FETCH_AND_NBI, int64_t, int64); TEST_SHMEM_AND(CTX_FETCH_AND_NBI, uint32_t, uint32); TEST_SHMEM_AND(CTX_FETCH_AND_NBI, uint64_t, uint64); -#endif + shmem_finalize(); return rc; } diff --git a/test/unit/cxx_test_shmem_atomic_cswap.cpp b/test/unit/cxx_test_shmem_atomic_cswap.cpp index 0a3983c..cbef3e2 100644 --- a/test/unit/cxx_test_shmem_atomic_cswap.cpp +++ b/test/unit/cxx_test_shmem_atomic_cswap.cpp @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, ATOMIC_COMPARE_SWAP_NBI, CTX_ATOMIC_COMPARE_SWAP_NBI }; @@ -49,19 +45,15 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, #define DEPRECATED_CSWAP(TYPENAME,...) shmem_##TYPENAME##_atomic_compare_swap(__VA_ARGS__) #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_##TYPENAME##_atomic_compare_swap_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_compare_swap_nbi(&old, &remote, \ (TYPE)npes, (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_COMPARE_SWAP_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_compare_swap_nbi(SHMEM_CTX_DEFAULT,\ &old, &remote, (TYPE)npes, (TYPE)mype, (mype + 1) % npes);\ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_CSWAP(OP, TYPE, TYPENAME) \ do { \ @@ -86,7 +78,7 @@ enum op { CSWAP = 0, ATOMIC_COMPARE_SWAP, CTX_ATOMIC_COMPARE_SWAP, (TYPE)npes, (TYPE)mype, \ (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -151,8 +143,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP, size_t, size); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP, ptrdiff_t, ptrdiff); - -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, int, int); TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, long, long); TEST_SHMEM_CSWAP(ATOMIC_COMPARE_SWAP_NBI, long long, longlong); @@ -178,7 +168,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, uint64_t, uint64); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, size_t, size); TEST_SHMEM_CSWAP(CTX_ATOMIC_COMPARE_SWAP_NBI, ptrdiff_t, ptrdiff); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_fetch.cpp b/test/unit/cxx_test_shmem_atomic_fetch.cpp index 981edb3..a066bfe 100644 --- a/test/unit/cxx_test_shmem_atomic_fetch.cpp +++ b/test/unit/cxx_test_shmem_atomic_fetch.cpp @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, CTX_ATOMIC_FETCH_NBI }; @@ -49,21 +45,17 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, #define DEPRECATED_FETCH(TYPENAME,...) shmem_##TYPENAME##_atomic_fetch(__VA_ARGS__) #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case ATOMIC_FETCH_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_nbi(&val, &remote, \ + shmem_##TYPENAME##_atomic_fetch_nbi(&val, &remote, \ (mype + 1) % npes); \ shmem_quiet(); \ break; \ case CTX_ATOMIC_FETCH_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_nbi(SHMEM_CTX_DEFAULT,\ &val, &remote, (mype + 1) % npes); \ shmem_quiet(); \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_FETCH(OP, TYPE, TYPENAME) \ do { \ @@ -86,7 +78,7 @@ enum op { FETCH = 0, ATOMIC_FETCH, CTX_ATOMIC_FETCH, ATOMIC_FETCH_NBI, val = shmem_ctx_##TYPENAME##_atomic_fetch( \ SHMEM_CTX_DEFAULT, &remote, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -151,8 +143,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH, size_t, size); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH, ptrdiff_t, ptrdiff); - -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, float, float); TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, double, double); TEST_SHMEM_FETCH(ATOMIC_FETCH_NBI, int, int); @@ -182,7 +172,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, uint64_t, uint64); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, size_t, size); TEST_SHMEM_FETCH(CTX_ATOMIC_FETCH_NBI, ptrdiff_t, ptrdiff); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_inc.cpp b/test/unit/cxx_test_shmem_atomic_inc.cpp index 820023d..e0715fe 100644 --- a/test/unit/cxx_test_shmem_atomic_inc.cpp +++ b/test/unit/cxx_test_shmem_atomic_inc.cpp @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, CTX_ATOMIC_FETCH_INC, ATOMIC_FETCH_INC_NBI, CTX_ATOMIC_FETCH_INC_NBI }; @@ -52,10 +48,9 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, #define DEPRECATED_FINC(TYPENAME,...) shmem_##TYPENAME##_atomic_fetch_inc(__VA_ARGS__) #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case ATOMIC_FETCH_INC_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_inc_nbi(&old, &remote, i); \ + shmem_##TYPENAME##_atomic_fetch_inc_nbi(&old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ printf("PE %i error inconsistent value of old (%s, %s)\n", \ @@ -64,7 +59,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, } \ break; \ case CTX_ATOMIC_FETCH_INC_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_inc_nbi(SHMEM_CTX_DEFAULT,\ &old, &remote, i); \ shmem_quiet(); \ if (old > (TYPE) npes) { \ @@ -73,9 +68,6 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_INC(OP, TYPE, TYPENAME) \ do { \ @@ -122,7 +114,7 @@ enum op { INC = 0, ATOMIC_INC, CTX_ATOMIC_INC, FINC, ATOMIC_FETCH_INC, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -221,7 +213,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC, size_t, size); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC, ptrdiff_t, ptrdiff); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, int, int); TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, long, long); TEST_SHMEM_INC(ATOMIC_FETCH_INC_NBI, long long, longlong); @@ -247,7 +238,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, uint64_t, uint64); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, size_t, size); TEST_SHMEM_INC(CTX_ATOMIC_FETCH_INC_NBI, ptrdiff_t, ptrdiff); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_or.cpp b/test/unit/cxx_test_shmem_atomic_or.cpp index cd07046..3759c8e 100644 --- a/test/unit/cxx_test_shmem_atomic_or.cpp +++ b/test/unit/cxx_test_shmem_atomic_or.cpp @@ -37,10 +37,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, CTX_FETCH_OR_NBI }; @@ -49,10 +45,9 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, * The result has the NPES least significant bits set, 000...111...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case FETCH_OR_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_or_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_fetch_or_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -62,7 +57,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, } \ break; \ case CTX_FETCH_OR_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_or_nbi(SHMEM_CTX_DEFAULT, \ &old, &remote, (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if ((old & (TYPE)(1LLU << mype)) != 0) { \ @@ -71,9 +66,6 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_OR(OP, TYPE, TYPENAME) \ do { \ @@ -108,7 +100,7 @@ enum op { OR = 0, CTX_OR, FETCH_OR, CTX_FETCH_OR, FETCH_OR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -161,7 +153,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_OR(CTX_FETCH_OR, uint32_t, uint32); TEST_SHMEM_OR(CTX_FETCH_OR, uint64_t, uint64); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_OR(FETCH_OR_NBI, unsigned int, uint); TEST_SHMEM_OR(FETCH_OR_NBI, unsigned long, ulong); TEST_SHMEM_OR(FETCH_OR_NBI, unsigned long long, ulonglong); @@ -177,7 +168,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_OR(CTX_FETCH_OR_NBI, int64_t, int64); TEST_SHMEM_OR(CTX_FETCH_OR_NBI, uint32_t, uint32); TEST_SHMEM_OR(CTX_FETCH_OR_NBI, uint64_t, uint64); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_swap.cpp b/test/unit/cxx_test_shmem_atomic_swap.cpp index 817a7d8..e1c5731 100644 --- a/test/unit/cxx_test_shmem_atomic_swap.cpp +++ b/test/unit/cxx_test_shmem_atomic_swap.cpp @@ -36,10 +36,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, CTX_ATOMIC_SWAP_NBI }; @@ -49,19 +45,15 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, #define DEPRECATED_SWAP(TYPENAME, ...) shmem_##TYPENAME##_atomic_swap(__VA_ARGS__) #endif -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case ATOMIC_SWAP_NBI: \ - shmemx_##TYPENAME##_atomic_swap_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_swap_nbi(&old, &remote, \ (TYPE)mype, (mype + 1) % npes); \ break; \ case CTX_ATOMIC_SWAP_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_swap_nbi(SHMEM_CTX_DEFAULT, \ + shmem_ctx_##TYPENAME##_atomic_swap_nbi(SHMEM_CTX_DEFAULT, \ &old, &remote, (TYPE)mype, (mype + 1) % npes); \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_SWAP(OP, TYPE, TYPENAME) \ do { \ @@ -84,7 +76,7 @@ enum op { SWAP = 0, ATOMIC_SWAP, CTX_ATOMIC_SWAP, ATOMIC_SWAP_NBI, old = shmem_ctx_##TYPENAME##_atomic_swap(SHMEM_CTX_DEFAULT, \ &remote, (TYPE)mype, (mype + 1) % npes); \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -155,7 +147,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP, size_t, size); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP, ptrdiff_t, ptrdiff); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, float, float); TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, double, double); TEST_SHMEM_SWAP(ATOMIC_SWAP_NBI, int, int); @@ -185,7 +176,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, uint64_t, uint64); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, size_t, size); TEST_SHMEM_SWAP(CTX_ATOMIC_SWAP_NBI, ptrdiff_t, ptrdiff); -#endif shmem_finalize(); return rc; diff --git a/test/unit/cxx_test_shmem_atomic_xor.cpp b/test/unit/cxx_test_shmem_atomic_xor.cpp index e44fb03..141c179 100644 --- a/test/unit/cxx_test_shmem_atomic_xor.cpp +++ b/test/unit/cxx_test_shmem_atomic_xor.cpp @@ -37,10 +37,6 @@ #include #include -#ifdef ENABLE_SHMEMX_TESTS -#include -#endif - enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, CTX_FETCH_XOR_NBI }; @@ -49,10 +45,9 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, * The result has the NPES least significant bits cleared, 111...000...b. */ -#ifdef ENABLE_SHMEMX_TESTS -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ +#define SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ case FETCH_XOR_NBI: \ - shmemx_##TYPENAME##_atomic_fetch_xor_nbi(&old, &remote, \ + shmem_##TYPENAME##_atomic_fetch_xor_nbi(&old, &remote, \ (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -62,7 +57,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, } \ break; \ case CTX_FETCH_XOR_NBI: \ - shmemx_ctx_##TYPENAME##_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT,\ + shmem_ctx_##TYPENAME##_atomic_fetch_xor_nbi(SHMEM_CTX_DEFAULT,\ &old, &remote, (TYPE)(1LLU << mype), i); \ shmem_quiet(); \ if (((old ^ (TYPE)(1LLU << mype)) & (TYPE)(1LLU << mype)) != 0) { \ @@ -71,9 +66,6 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, rc = EXIT_FAILURE; \ } \ break; -#else -#define SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) -#endif #define TEST_SHMEM_XOR(OP, TYPE, TYPENAME) \ do { \ @@ -108,7 +100,7 @@ enum op { XOR = 0, CTX_XOR, FETCH_XOR, CTX_FETCH_XOR, FETCH_XOR_NBI, rc = EXIT_FAILURE; \ } \ break; \ - SHMEMX_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ + SHMEM_NBI_OPS_CASES(OP, TYPE, TYPENAME) \ default: \ printf("Invalid operation (%d)\n", OP); \ shmem_global_exit(1); \ @@ -161,7 +153,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_XOR(CTX_FETCH_XOR, uint32_t, uint32); TEST_SHMEM_XOR(CTX_FETCH_XOR, uint64_t, uint64); -#ifdef ENABLE_SHMEMX_TESTS TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned int, uint); TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned long, ulong); TEST_SHMEM_XOR(FETCH_XOR_NBI, unsigned long long, ulonglong); @@ -177,7 +168,6 @@ int main(int argc, char* argv[]) { TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, int64_t, int64); TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, uint32_t, uint32); TEST_SHMEM_XOR(CTX_FETCH_XOR_NBI, uint64_t, uint64); -#endif shmem_finalize(); return rc; diff --git a/test/shmemx/fadd_nbi.c b/test/unit/fadd_nbi.c similarity index 97% rename from test/shmemx/fadd_nbi.c rename to test/unit/fadd_nbi.c index 26daaf9..af2aad3 100644 --- a/test/shmemx/fadd_nbi.c +++ b/test/unit/fadd_nbi.c @@ -73,7 +73,7 @@ int main(void) { t = shmemx_wtime(); for (i = 0; i < npes; i++) { - shmemx_long_atomic_fetch_add_nbi(&out[i], &ctr, 1, i); + shmem_long_atomic_fetch_add_nbi(&out[i], &ctr, 1, i); } shmem_barrier_all(); diff --git a/test/unit/hello.c b/test/unit/hello.c index cfe65d2..c1c694b 100644 --- a/test/unit/hello.c +++ b/test/unit/hello.c @@ -52,7 +52,7 @@ main(int argc, char* argv[], char *envp[]) me = shmem_my_pe(); if (NULL == getenv("MAKELEVEL")) { - printf("Hello World from %d of %d\n",me,myshmem_n_pes); + printf("Hello World from %d of %d\n", me, myshmem_n_pes); } shmem_finalize(); diff --git a/test/shmemx/pcontrol.c b/test/unit/pcontrol.c similarity index 94% rename from test/shmemx/pcontrol.c rename to test/unit/pcontrol.c index 27a9d92..75eb497 100644 --- a/test/shmemx/pcontrol.c +++ b/test/unit/pcontrol.c @@ -32,17 +32,16 @@ #include #include #include -#include int main(int argc, char* argv[], char *envp[]) { shmem_init(); - shmemx_pcontrol(1, "Region 1"); + shmem_pcontrol(1, "Region 1"); shmem_barrier_all(); - shmemx_pcontrol(1, "Region 2"); + shmem_pcontrol(1, "Region 2"); shmem_barrier_all(); shmem_finalize(); diff --git a/test/unit/pi.c b/test/unit/pi.c index 73a6e5f..5dec996 100644 --- a/test/unit/pi.c +++ b/test/unit/pi.c @@ -87,7 +87,7 @@ main(int argc, char* argv[], char *envp[]) } if (NULL == getenv("MAKELEVEL")) { - printf("Pi from %llu points on %d PEs: %lf\n",total,myshmem_n_pes,approx_pi); + printf("Pi from %llu points on %d PEs: %lf\n", total, myshmem_n_pes, approx_pi); } } diff --git a/test/shmemx/put_signal.c b/test/unit/put_signal.c similarity index 88% rename from test/shmemx/put_signal.c rename to test/unit/put_signal.c index dc929cf..b432303 100644 --- a/test/shmemx/put_signal.c +++ b/test/unit/put_signal.c @@ -35,8 +35,6 @@ #include #include -#include - #define MSG_SZ 10 int main(int argc, char *argv[]) @@ -64,7 +62,7 @@ int main(int argc, char *argv[]) } if (me == 0) { - shmemx_long_put_signal(target, source, MSG_SZ, &sig_addr, 1, SHMEMX_SIGNAL_SET, dest); + shmem_long_put_signal(target, source, MSG_SZ, &sig_addr, 1, SHMEM_SIGNAL_SET, dest); #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L shmem_wait_until(&sig_addr, SHMEM_CMP_EQ, 1); #else @@ -76,12 +74,12 @@ int main(int argc, char *argv[]) #else shmem_uint64_wait_until(&sig_addr, SHMEM_CMP_EQ, 1); #endif - shmemx_long_put_signal(target, target, MSG_SZ, &sig_addr, 1, SHMEMX_SIGNAL_SET, dest); + shmem_long_put_signal(target, target, MSG_SZ, &sig_addr, 1, SHMEM_SIGNAL_SET, dest); } for (i = 0; i < MSG_SZ; i++) { if (target[i] != source[i]) { - fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEMX_SIGNAL_SET\n", + fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEM_SIGNAL_SET\n", me, i, target[i], source[i]); errors++; } @@ -97,7 +95,7 @@ int main(int argc, char *argv[]) shmem_barrier_all(); if (me == 0) { - shmemx_long_put_signal(target, source, MSG_SZ, &sig_addr, one, SHMEMX_SIGNAL_ADD, dest); + shmem_long_put_signal(target, source, MSG_SZ, &sig_addr, one, SHMEM_SIGNAL_ADD, dest); #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L shmem_wait_until(&sig_addr, SHMEM_CMP_EQ, one); #else @@ -109,12 +107,12 @@ int main(int argc, char *argv[]) #else shmem_uint64_wait_until(&sig_addr, SHMEM_CMP_EQ, one); #endif - shmemx_long_put_signal(target, target, MSG_SZ, &sig_addr, one, SHMEMX_SIGNAL_ADD, dest); + shmem_long_put_signal(target, target, MSG_SZ, &sig_addr, one, SHMEM_SIGNAL_ADD, dest); } for (i = 0; i < MSG_SZ; i++) { if (target[i] != source[i]) { - fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEMX_SIGNAL_ADD\n", + fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEM_SIGNAL_ADD\n", me, i, target[i], source[i]); errors++; } diff --git a/test/shmemx/put_signal_nbi.c b/test/unit/put_signal_nbi.c similarity index 91% rename from test/shmemx/put_signal_nbi.c rename to test/unit/put_signal_nbi.c index c2303ee..37de7c3 100644 --- a/test/shmemx/put_signal_nbi.c +++ b/test/unit/put_signal_nbi.c @@ -34,8 +34,6 @@ #include #include -#include - #define MSG_SZ 10 int main(int argc, char *argv[]) @@ -63,7 +61,7 @@ int main(int argc, char *argv[]) if (me == 0) { for (i = 0; i < npes; i++) { - shmemx_long_put_signal_nbi(target, source, MSG_SZ, &sig_addr, 1, SHMEMX_SIGNAL_SET, i); + shmem_long_put_signal_nbi(target, source, MSG_SZ, &sig_addr, 1, SHMEM_SIGNAL_SET, i); } } @@ -75,7 +73,7 @@ int main(int argc, char *argv[]) for (i = 0; i < MSG_SZ; i++) { if (target[i] != source[i]) { - fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEMX_SIGNAL_SET\n", + fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEM_SIGNAL_SET\n", me, i, target[i], source[i]); errors++; } @@ -91,7 +89,7 @@ int main(int argc, char *argv[]) shmem_barrier_all(); if (me == 0) { for (i = 0; i < npes; i++) { - shmemx_long_put_signal_nbi(target, source, MSG_SZ, &sig_addr, i + 1, SHMEMX_SIGNAL_ADD, i); + shmem_long_put_signal_nbi(target, source, MSG_SZ, &sig_addr, i + 1, SHMEM_SIGNAL_ADD, i); } } @@ -103,7 +101,7 @@ int main(int argc, char *argv[]) for (i = 0; i < MSG_SZ; i++) { if (target[i] != source[i]) { - fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEMX_SIGNAL_ADD\n", + fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEM_SIGNAL_ADD\n", me, i, target[i], source[i]); errors++; } diff --git a/test/unit/shmalloc.c b/test/unit/shmalloc.c index 4e059c5..7726bf1 100644 --- a/test/unit/shmalloc.c +++ b/test/unit/shmalloc.c @@ -191,7 +191,14 @@ main(int argc, char **argv) for(l=0; l < loops; l++) { - result_sz = (nProcs-1) * (nWords * sizeof(DataType)); + result = (DataType *)shmem_malloc(0); + if (result != NULL) { + perror ("Zero-length memory allocation has non-null result"); + shmem_finalize(); + exit (1); + } + + result_sz = nProcs * (nWords * sizeof(DataType)); result = (DataType *)shmem_malloc(result_sz); if (! result) { diff --git a/test/unit/shmem_calloc.c b/test/unit/shmem_calloc.c index 5cfca33..45b3201 100644 --- a/test/unit/shmem_calloc.c +++ b/test/unit/shmem_calloc.c @@ -191,8 +191,15 @@ main(int argc, char **argv) for(l=0; l < loops; l++) { - result_sz = (nProcs-1) * (nWords * sizeof(DataType)); - result = (DataType *)shmem_calloc((nProcs-1)*nWords, sizeof(DataType)); + result = (DataType *)shmem_calloc(0, sizeof(DataType)); + if (result != NULL) { + perror ("Zero-length memory allocation has non-null result"); + shmem_finalize(); + exit (1); + } + + result_sz = nProcs * (nWords * sizeof(DataType)); + result = (DataType *)shmem_calloc(nProcs * nWords, sizeof(DataType)); if (! result) { perror ("Failed result memory allocation"); diff --git a/test/unit/shmem_ctx.c b/test/unit/shmem_ctx.c deleted file mode 100644 index 518c67d..0000000 --- a/test/unit/shmem_ctx.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include - -long pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE]; -long psync[SHMEM_REDUCE_SYNC_SIZE]; - -long task_cntr = 0; /* Next task counter */ -long tasks_done = 0; /* Tasks done by this PE */ -long total_done = 0; /* Total tasks done by all PEs */ - -int main(void) { - int tl, i, ret; - long ntasks = 1024; /* Total tasks per PE */ - - for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++) - psync[i] = SHMEM_SYNC_VALUE; - - ret = shmem_init_thread(SHMEM_THREAD_MULTIPLE, &tl); - - if (tl != SHMEM_THREAD_MULTIPLE || ret != 0) { - printf("Init failed (requested thread level %d, got %d, ret %d)\n", - SHMEM_THREAD_MULTIPLE, tl, ret); - - if (ret == 0) { - shmem_global_exit(1); - } else { - return ret; - } - } - - int me = shmem_my_pe(); - int npes = shmem_n_pes(); - -#pragma omp parallel reduction (+:tasks_done) - { - shmem_ctx_t ctx; - int task_pe = me, pes_done = 0; - int ret = shmem_ctx_create(SHMEM_CTX_PRIVATE, &ctx); - - if (ret != 0) { - printf("%d: Warning, unable to create context (%d)\n", me, ret); - ctx = SHMEM_CTX_DEFAULT; - } - - /* Process tasks on all PEs, starting with the local PE. After - * all tasks on a PE are completed, help the next PE. */ - while (pes_done < npes) { - long task = shmem_ctx_long_atomic_fetch_inc(ctx, &task_cntr, task_pe); - while (task < ntasks) { - /* Perform task (task_pe, task) */ - tasks_done++; - task = shmem_ctx_long_atomic_fetch_inc(ctx, &task_cntr, task_pe); - } - pes_done++; - task_pe = (task_pe + 1) % npes; - } - - if (ctx != SHMEM_CTX_DEFAULT) shmem_ctx_destroy(ctx); - } - - shmem_long_sum_to_all(&total_done, &tasks_done, 1, 0, 0, npes, pwrk, psync); - - int result = (total_done != ntasks * npes); - if (me == 0 && result) - printf("Error: total_done is %ld, expected %ld\n", total_done, ntasks * npes); - - shmem_finalize(); - return result; -} diff --git a/test/unit/shmem_ctx_pipelined_reduce.c b/test/unit/shmem_ctx_pipelined_reduce.c deleted file mode 100644 index f99b710..0000000 --- a/test/unit/shmem_ctx_pipelined_reduce.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation. All rights reserved. - * This software is available to you under the BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This test is derived from an example provided in the OpenSHMEM 1.4 - * specification. Additional copyrights may apply. - * - */ - -#include -#include -#include - -#define LEN 8192 /* Full buffer length */ -#define PLEN 512 /* Length of each pipeline stage */ - -int in_buf[LEN], out_buf[LEN]; - -int main(void) { - int i, j, *pbuf[2]; - shmem_ctx_t ctx[2]; - - shmem_init(); - int me = shmem_my_pe(); - int npes = shmem_n_pes(); - - pbuf[0] = shmem_malloc(PLEN * npes * sizeof(int)); - pbuf[1] = shmem_malloc(PLEN * npes * sizeof(int)); - - int ret_0 = shmem_ctx_create(0, &ctx[0]); - int ret_1 = shmem_ctx_create(0, &ctx[1]); - - if (ret_0) ctx[0] = SHMEM_CTX_DEFAULT; - if (ret_1) ctx[1] = SHMEM_CTX_DEFAULT; - - for (i = 0; i < LEN; i++) { - in_buf[i] = me; out_buf[i] = 0; - } - - /* Index of ctx and pbuf (p_idx) for current pipeline stage (p) */ - int p_idx = 0, p = 0; - for (i = 1; i <= npes; i++) - shmem_ctx_int_put_nbi(ctx[p_idx], &pbuf[p_idx][PLEN*me], - &in_buf[PLEN*p], PLEN, (me+i) % npes); - - /* Issue communication for pipeline stage p, then accumulate results for - * stage p-1 */ - for (p = 1; p < LEN/PLEN; p++) { - p_idx ^= 1; - for (i = 1; i <= npes; i++) - shmem_ctx_int_put_nbi(ctx[p_idx], &pbuf[p_idx][PLEN*me], - &in_buf[PLEN*p], PLEN, (me+i) % npes); - - shmem_ctx_quiet(ctx[p_idx^1]); - shmem_sync_all(); - for (i = 0; i < npes; i++) - for (j = 0; j < PLEN; j++) - out_buf[PLEN*(p-1)+j] += pbuf[p_idx^1][PLEN*i+j]; - } - - shmem_ctx_quiet(ctx[p_idx]); - shmem_sync_all(); - for (i = 0; i < npes; i++) - for (j = 0; j < PLEN; j++) - out_buf[PLEN*(p-1)+j] += pbuf[p_idx][PLEN*i+j]; - - int errors = 0; - int expected = (npes - 1) * npes / 2; - for (i = 0; i < LEN; i++) { - if (out_buf[i] != expected) { - printf("%d: out_buf[%d] = %d, expected %d\n", me, i, out_buf[i], expected); - errors++; - } - } - - shmem_finalize(); - return errors; -} diff --git a/test/unit/shmem_malloc_with_hints.c b/test/unit/shmem_malloc_with_hints.c new file mode 100644 index 0000000..e7176b6 --- /dev/null +++ b/test/unit/shmem_malloc_with_hints.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2020 Intel Corporation. All rights reserved. + * This software is available to you under the BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +#include +#include + +#define N 128 +#define MAX(a,b) ((a) > (b)) ? a : b +#define WRK_SIZE MAX(N/2+1, SHMEM_REDUCE_MIN_WRKDATA_SIZE) + +#define NUM_TESTS 5 + +#define SHMEM_MALLOC_INVALID_HINT ~(SHMEM_MALLOC_ATOMICS_REMOTE) + +long pSync[SHMEM_ALLTOALL_SYNC_SIZE]; +int pWrk[WRK_SIZE]; + + +static int sumtoall_with_malloc_hint(long hint, int mype, int npes) +{ + int failed = 0; + int i; + int *dst, *src; + + if (mype == 0) + printf("Sum reduction operation started\n"); + + dst = (int *)shmem_malloc_with_hints(N * sizeof(*dst), hint); + src = (int *)shmem_malloc_with_hints(N * sizeof(*src), hint); + + for (i = 0; i < N; i++) { + src[i] = mype; + dst[i] = -1; + } + + shmem_barrier_all(); + shmem_int_sum_to_all(dst, src, N, 0, 0, npes, pWrk, pSync); + + if (mype == 0) { + for (i = 0; i < N; i++) { + int expected; + expected = npes * (npes-1)/2; + if (dst[i] != expected) { + printf("[%d] dst[%d] = %d, expected %d\n", mype, i, dst[i], expected); + failed = 1; + } + } + } + + return (!failed); +} + + +int main(int argc, char **argv) { + int npes, i, mype; + int passed = 0; + int fail = 0; + + shmem_init(); + + npes = shmem_n_pes(); + mype = shmem_my_pe(); + + for (i = 0; i < SHMEM_ALLTOALL_SYNC_SIZE; i++) + pSync[i] = SHMEM_SYNC_VALUE; + + passed = sumtoall_with_malloc_hint(0, mype, npes); + passed += sumtoall_with_malloc_hint(SHMEM_MALLOC_ATOMICS_REMOTE, mype, npes); + passed += sumtoall_with_malloc_hint(SHMEM_MALLOC_SIGNAL_REMOTE, mype, npes); + passed += sumtoall_with_malloc_hint(SHMEM_MALLOC_ATOMICS_REMOTE | SHMEM_MALLOC_SIGNAL_REMOTE, mype, npes); + passed += sumtoall_with_malloc_hint(SHMEM_MALLOC_INVALID_HINT, mype, npes); + + + fail = NUM_TESTS - passed; + + if (mype == 0) { + if (passed != NUM_TESTS) + printf("%d out of %d tests passed\n", fail, NUM_TESTS); + else + printf("All %d tests passed\n", passed); + } + + shmem_finalize(); + return 0; +} diff --git a/test/shmemx/shmemx_team_b2b_collectives.c b/test/unit/shmem_team_b2b_collectives.c similarity index 81% rename from test/shmemx/shmemx_team_b2b_collectives.c rename to test/unit/shmem_team_b2b_collectives.c index d3beb45..e796e66 100644 --- a/test/shmemx/shmemx_team_b2b_collectives.c +++ b/test/unit/shmem_team_b2b_collectives.c @@ -27,7 +27,6 @@ #include #include #include -#include #define NITERS 100 #define NELEMS 10 @@ -68,12 +67,12 @@ int main(void) src[i] = me; } - TEST_B2B_COLLECTIVE("broadcast", shmemx_long_broadcast, SHMEMX_TEAM_WORLD, dest, src, NELEMS, 0); - TEST_B2B_COLLECTIVE("reduce", shmemx_long_sum_reduce, SHMEMX_TEAM_WORLD, dest, src, NELEMS); - TEST_B2B_COLLECTIVE("collect", shmemx_long_collect, SHMEMX_TEAM_WORLD, dest, src, NELEMS); - TEST_B2B_COLLECTIVE("fcollect", shmemx_long_fcollect, SHMEMX_TEAM_WORLD, dest, src, NELEMS); - TEST_B2B_COLLECTIVE("alltoall", shmemx_long_alltoall, SHMEMX_TEAM_WORLD, dest, src, NELEMS); - TEST_B2B_COLLECTIVE("alltoalls", shmemx_long_alltoalls, SHMEMX_TEAM_WORLD, dest, src, 1, 1, NELEMS); + TEST_B2B_COLLECTIVE("broadcast", shmem_long_broadcast, SHMEM_TEAM_WORLD, dest, src, NELEMS, 0); + TEST_B2B_COLLECTIVE("reduce", shmem_long_sum_reduce, SHMEM_TEAM_WORLD, dest, src, NELEMS); + TEST_B2B_COLLECTIVE("collect", shmem_long_collect, SHMEM_TEAM_WORLD, dest, src, NELEMS); + TEST_B2B_COLLECTIVE("fcollect", shmem_long_fcollect, SHMEM_TEAM_WORLD, dest, src, NELEMS); + TEST_B2B_COLLECTIVE("alltoall", shmem_long_alltoall, SHMEM_TEAM_WORLD, dest, src, NELEMS); + TEST_B2B_COLLECTIVE("alltoalls", shmem_long_alltoalls, SHMEM_TEAM_WORLD, dest, src, 1, 1, NELEMS); shmem_finalize(); return total_errors; diff --git a/test/shmemx/shmemx_team_collect_active_set.c b/test/unit/shmem_team_collect_active_set.c similarity index 84% rename from test/shmemx/shmemx_team_collect_active_set.c rename to test/unit/shmem_team_collect_active_set.c index 590d8a1..7902c44 100644 --- a/test/shmemx/shmemx_team_collect_active_set.c +++ b/test/unit/shmem_team_collect_active_set.c @@ -29,7 +29,6 @@ #include #include #include -#include #define MAX_NPES 32 @@ -62,8 +61,8 @@ int main(void) if (me == 0) printf("Shrinking team size test\n"); - shmemx_team_t old_team, new_team; - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 1, npes, NULL, 0, &old_team); + shmem_team_t old_team, new_team; + shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 1, npes, NULL, 0, &old_team); /* A total of npes-1 tests are performed, where the active set in each test * includes PEs i..npes-1, and each PE contributes PE ID elements. The size @@ -73,13 +72,14 @@ int main(void) int idx = 0; if (me == i) - printf(" + team size %d\n", shmemx_team_n_pes(old_team)-1); + printf(" + team size %d\n", shmem_team_n_pes(old_team)-1); - shmemx_team_split_strided(old_team, 1, 1, shmemx_team_n_pes(old_team)-1, NULL, 0, &new_team); + shmem_team_split_strided(old_team, 1, 1, shmem_team_n_pes(old_team)-1, NULL, 0, &new_team); - if (new_team != SHMEMX_TEAM_INVALID) { + if (new_team != SHMEM_TEAM_INVALID) { - shmemx_int64_collect(new_team, dst, src, me); + + shmem_int64_collect(new_team, dst, src, me); /* Validate destination buffer data */ for (j = 0; j < npes - i; j++) { @@ -105,13 +105,17 @@ int main(void) for (j = 0; j < MAX_NPES*MAX_NPES; j++) dst[j] = -1; - shmemx_sync(new_team); +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + shmem_sync(new_team); +#else + shmem_team_sync(new_team); +#endif } old_team = new_team; } - shmemx_team_destroy(old_team); + shmem_team_destroy(old_team); shmem_finalize(); return errors != 0; diff --git a/test/shmemx/shmemx_team_max.c b/test/unit/shmem_team_max.c similarity index 85% rename from test/shmemx/shmemx_team_max.c rename to test/unit/shmem_team_max.c index ec2bfb3..df760e8 100644 --- a/test/shmemx/shmemx_team_max.c +++ b/test/unit/shmem_team_max.c @@ -27,7 +27,6 @@ #include #include -#include #define NUM_TEAMS 64 @@ -44,15 +43,19 @@ int main(void) me = shmem_my_pe(); npes = shmem_n_pes(); - shmemx_team_t new_team[NUM_TEAMS]; + shmem_team_t new_team[NUM_TEAMS]; for (i = j = 0; i < NUM_TEAMS; ) { - ret = shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 1, 1 + i % npes, + ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 1, 1 + i % npes, NULL, 0, &new_team[i]); /* Wait for all PEs to fill in ret before starting the reduction */ - shmemx_sync(SHMEMX_TEAM_WORLD); - shmemx_int_and_reduce(SHMEMX_TEAM_WORLD, &dest_ret, &ret, 1); +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + shmem_sync(SHMEM_TEAM_WORLD); +#else + shmem_team_sync(SHMEM_TEAM_WORLD); +#endif + shmem_int_and_reduce(SHMEM_TEAM_WORLD, &dest_ret, &ret, 1); /* If success was not global, free a team and retry */ if (dest_ret != 0) { @@ -66,7 +69,7 @@ int main(void) if (i == j) break; - shmemx_team_destroy(new_team[j]); + shmem_team_destroy(new_team[j]); j++; } else { i++; diff --git a/test/shmemx/shmemx_team_reuse_teams.c b/test/unit/shmem_team_reuse_teams.c similarity index 78% rename from test/shmemx/shmemx_team_reuse_teams.c rename to test/unit/shmem_team_reuse_teams.c index 0aeb59d..d157e32 100644 --- a/test/shmemx/shmemx_team_reuse_teams.c +++ b/test/unit/shmem_team_reuse_teams.c @@ -27,8 +27,6 @@ #include #include -#include - int main(void) { @@ -43,8 +41,8 @@ int main(void) if (me == 0) printf("Reuse teams test\n"); - shmemx_team_t old_team, new_team; - ret = shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 1, npes, NULL, 0, &old_team); + shmem_team_t old_team, new_team; + ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 1, npes, NULL, 0, &old_team); if (ret) ++errors; /* A total of npes-1 iterations are performed, where the active set in iteration i @@ -53,17 +51,17 @@ int main(void) if (me == i) { printf("%3d: creating new team (start, stride, size): %3d, %3d, %3d\n", me, - shmemx_team_translate_pe(old_team, 1, SHMEMX_TEAM_WORLD), 1, shmemx_team_n_pes(old_team)-1); + shmem_team_translate_pe(old_team, 1, SHMEM_TEAM_WORLD), 1, shmem_team_n_pes(old_team)-1); } - ret = shmemx_team_split_strided(old_team, 1, 1, shmemx_team_n_pes(old_team)-1, NULL, 0, &new_team); - if (old_team != SHMEMX_TEAM_INVALID && ret) ++errors; + ret = shmem_team_split_strided(old_team, 1, 1, shmem_team_n_pes(old_team)-1, NULL, 0, &new_team); + if (old_team != SHMEM_TEAM_INVALID && ret) ++errors; - shmemx_team_destroy(old_team); + shmem_team_destroy(old_team); old_team = new_team; } - shmemx_team_destroy(old_team); + shmem_team_destroy(old_team); shmem_finalize(); return errors != 0; diff --git a/test/shmemx/shmemx_team_shared.c b/test/unit/shmem_team_shared.c similarity index 87% rename from test/shmemx/shmemx_team_shared.c rename to test/unit/shmem_team_shared.c index 6cb99fa..62e1513 100644 --- a/test/shmemx/shmemx_team_shared.c +++ b/test/unit/shmem_team_shared.c @@ -28,7 +28,6 @@ #include #include #include -#include int main(void) @@ -39,19 +38,19 @@ int main(void) int me = shmem_my_pe(); int npes = shmem_n_pes(); - int team_shared_npes = shmemx_team_n_pes(SHMEMX_TEAM_SHARED); + int team_shared_npes = shmem_team_n_pes(SHMEM_TEAM_SHARED); int *peers = malloc(team_shared_npes * sizeof(int)); int num_peers = 0; - /* Print the team members on SHMEMX_TEAM_SHARED */ + /* Print the team members on SHMEM_TEAM_SHARED */ /* Use a lock for cleaner output */ shmem_set_lock(&lock); printf("[PE: %d] SHMEM_TEAM_SHARED peers: { ", me); for (int i = 0; i < npes; i++) { - if (shmemx_team_translate_pe(SHMEMX_TEAM_WORLD, i, - SHMEMX_TEAM_SHARED) != -1) { + if (shmem_team_translate_pe(SHMEM_TEAM_WORLD, i, + SHMEM_TEAM_SHARED) != -1) { peers[num_peers++] = i; printf("%d ", i); } diff --git a/test/shmemx/shmemx_team_split_2d.c b/test/unit/shmem_team_split_2d.c similarity index 69% rename from test/shmemx/shmemx_team_split_2d.c rename to test/unit/shmem_team_split_2d.c index a94a435..0210d4d 100644 --- a/test/shmemx/shmemx_team_split_2d.c +++ b/test/unit/shmem_team_split_2d.c @@ -27,24 +27,23 @@ #include #include -#include -static int check_2d(shmemx_team_t parent_team, int xdim) { - int me = shmemx_team_my_pe(parent_team); +static int check_2d(shmem_team_t parent_team, int xdim) { + int me = shmem_team_my_pe(parent_team); - shmemx_team_t xteam = SHMEMX_TEAM_INVALID; - shmemx_team_t yteam = SHMEMX_TEAM_INVALID; + shmem_team_t xteam = SHMEM_TEAM_INVALID; + shmem_team_t yteam = SHMEM_TEAM_INVALID; - int ret = shmemx_team_split_2d(parent_team, xdim, NULL, 0, &xteam, NULL, 0, &yteam); + int ret = shmem_team_split_2d(parent_team, xdim, NULL, 0, &xteam, NULL, 0, &yteam); int errors = 0; if (ret == 0) { - int me_x = shmemx_team_my_pe(xteam); - int me_y = shmemx_team_my_pe(yteam); - int npes_x = shmemx_team_n_pes(xteam); - int npes_y = shmemx_team_n_pes(yteam); + int me_x = shmem_team_my_pe(xteam); + int me_y = shmem_team_my_pe(yteam); + int npes_x = shmem_team_n_pes(xteam); + int npes_y = shmem_team_n_pes(yteam); - if (xteam == SHMEMX_TEAM_INVALID || yteam == SHMEMX_TEAM_INVALID) { + if (xteam == SHMEM_TEAM_INVALID || yteam == SHMEM_TEAM_INVALID) { printf("%d: Error, received an invalid team\n", shmem_my_pe()); ++errors; } @@ -53,9 +52,9 @@ static int check_2d(shmemx_team_t parent_team, int xdim) { * PE indices and compare with the expected indices */ for (int i = 0; i < npes_x; i++) { int expected_parent = me_y * xdim + i; /* row (fixed) + column */ - int pe_parent = shmemx_team_translate_pe(xteam, i, parent_team); - int pe_world = shmemx_team_translate_pe(xteam, i, SHMEMX_TEAM_WORLD); - int expected_world = shmemx_team_translate_pe(parent_team, expected_parent, SHMEMX_TEAM_WORLD); + int pe_parent = shmem_team_translate_pe(xteam, i, parent_team); + int pe_world = shmem_team_translate_pe(xteam, i, SHMEM_TEAM_WORLD); + int expected_world = shmem_team_translate_pe(parent_team, expected_parent, SHMEM_TEAM_WORLD); if (expected_parent != pe_parent) { printf("%d: xteam[%d] expected parent PE id %d, got %d\n", @@ -72,9 +71,9 @@ static int check_2d(shmemx_team_t parent_team, int xdim) { for (int i = 0; i < npes_y; i++) { int expected_parent = i * xdim + me_x; /* row + column (fixed) */ - int pe_parent = shmemx_team_translate_pe(yteam, i, parent_team); - int pe_world = shmemx_team_translate_pe(yteam, i, SHMEMX_TEAM_WORLD); - int expected_world = shmemx_team_translate_pe(parent_team, expected_parent, SHMEMX_TEAM_WORLD); + int pe_parent = shmem_team_translate_pe(yteam, i, parent_team); + int pe_world = shmem_team_translate_pe(yteam, i, SHMEM_TEAM_WORLD); + int expected_world = shmem_team_translate_pe(parent_team, expected_parent, SHMEM_TEAM_WORLD); if (expected_parent != pe_parent) { printf("%d: yteam[%d] expected parent PE id %d, got %d\n", @@ -93,17 +92,17 @@ static int check_2d(shmemx_team_t parent_team, int xdim) { printf("%d: 2d split failed\n", shmem_my_pe()); } - if (xteam != SHMEMX_TEAM_INVALID) - shmemx_team_destroy(xteam); - if (yteam != SHMEMX_TEAM_INVALID) - shmemx_team_destroy(yteam); + if (xteam != SHMEM_TEAM_INVALID) + shmem_team_destroy(xteam); + if (yteam != SHMEM_TEAM_INVALID) + shmem_team_destroy(yteam); return errors != 0; } int main(void) { int errors = 0, me, npes, ret; - shmemx_team_t even_team; + shmem_team_t even_team; shmem_init(); @@ -112,11 +111,11 @@ int main(void) { if (me == 0) printf("Performing 2d split test on SHMEM_TEAM_WORLD\n"); - errors += check_2d(SHMEMX_TEAM_WORLD, 1); - errors += check_2d(SHMEMX_TEAM_WORLD, 2); - errors += check_2d(SHMEMX_TEAM_WORLD, 3); + errors += check_2d(SHMEM_TEAM_WORLD, 1); + errors += check_2d(SHMEM_TEAM_WORLD, 2); + errors += check_2d(SHMEM_TEAM_WORLD, 3); - ret = shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 2, (npes-1)/2 + 1, + ret = shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 2, (npes-1)/2 + 1, NULL, 0, &even_team); if (ret == 0) { diff --git a/test/shmemx/shmemx_team_translate_2.c b/test/unit/shmem_team_translate.c similarity index 78% rename from test/shmemx/shmemx_team_translate_2.c rename to test/unit/shmem_team_translate.c index c571b2a..da70e99 100644 --- a/test/shmemx/shmemx_team_translate_2.c +++ b/test/unit/shmem_team_translate.c @@ -5,31 +5,30 @@ */ #include -#include #include int main(void) { int my_pe, npes, errors = 0; int t_pe_2, t_pe_3, t_pe_2_to_3, t_pe_3_to_2; - shmemx_team_t team_2s; - shmemx_team_t team_3s; - shmemx_team_config_t *config; + shmem_team_t team_2s; + shmem_team_t team_3s; + shmem_team_config_t *config; shmem_init(); config = NULL; my_pe = shmem_my_pe(); npes = shmem_n_pes(); - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 2, ((npes-1)/2)+1, config, 0, + shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 2, ((npes-1)/2)+1, config, 0, &team_2s); - shmemx_team_split_strided(SHMEMX_TEAM_WORLD, 0, 3, ((npes-1)/3)+1, config, 0, + shmem_team_split_strided(SHMEM_TEAM_WORLD, 0, 3, ((npes-1)/3)+1, config, 0, &team_3s); - t_pe_3 = shmemx_team_my_pe(team_3s); - t_pe_2 = shmemx_team_my_pe(team_2s); - t_pe_3_to_2 = shmemx_team_translate_pe(team_3s, t_pe_3, team_2s); - t_pe_2_to_3 = shmemx_team_translate_pe(team_2s, t_pe_2, team_3s); + t_pe_3 = shmem_team_my_pe(team_3s); + t_pe_2 = shmem_team_my_pe(team_2s); + t_pe_3_to_2 = shmem_team_translate_pe(team_3s, t_pe_3, team_2s); + t_pe_2_to_3 = shmem_team_translate_pe(team_2s, t_pe_2, team_3s); if (my_pe % 2 == 0 && my_pe % 3 == 0) { if (t_pe_2 == -1 || t_pe_3 == -1 || t_pe_2_to_3 == -1 || t_pe_3_to_2 == -1) { diff --git a/test/unit/signal_fetch.c b/test/unit/signal_fetch.c new file mode 100644 index 0000000..50d76e9 --- /dev/null +++ b/test/unit/signal_fetch.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2020 Intel Corporation. All rights reserved. + * This software is available to you under the BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Validate signal_fetch operation using blocking put_signal +*/ + +#include +#include +#include + +#define MSG_SZ 10 + +int main(int argc, char *argv[]) +{ + long source[MSG_SZ]; + long *target; + int me, npes, i; + int errors = 0; + + static uint64_t sig_addr = 0; + + shmem_init(); + + me = shmem_my_pe(); + npes = shmem_n_pes(); + + for (i = 0; i < MSG_SZ; i++) + source[i] = i; + + target = (long *) shmem_calloc(MSG_SZ, sizeof(long)); + if (!target) { + fprintf(stderr, "Failed to allocate target pointer\n"); + shmem_global_exit(1); + } + + shmem_barrier_all(); + for (i = 0; i < npes; i++) { + shmem_long_put_signal(target, source, MSG_SZ, &sig_addr, me, SHMEM_SIGNAL_ADD, i); + } + + uint64_t sig_value = shmem_signal_fetch(&sig_addr); + while (sig_value != (uint64_t) ((npes * (npes - 1)) / 2)) { +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + shmem_wait_until(&sig_addr, SHMEM_CMP_NE, 0); +#else + shmem_uint64_wait_until(&sig_addr, SHMEM_CMP_NE, 0); +#endif + sig_value = shmem_signal_fetch(&sig_addr); + } + + for (i = 0; i < MSG_SZ; i++) { + if (target[i] != source[i]) { + fprintf(stderr, "%10d: target[%d] = %ld not matching %ld with SHMEM_SIGNAL_ADD\n", + me, i, target[i], source[i]); + errors++; + } + } + + shmem_free(target); + shmem_finalize(); + + return errors; +}