From 6a2912ee77bd357a1d6990f310d03331fe15cba0 Mon Sep 17 00:00:00 2001 From: kholland-intel Date: Thu, 26 Aug 2021 12:22:37 -0500 Subject: [PATCH 1/5] Added Depecated Attribute to Barrier and Reduction --- mpp/shmem_c_func.h4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mpp/shmem_c_func.h4 b/mpp/shmem_c_func.h4 index b4a7a159..869b446b 100644 --- a/mpp/shmem_c_func.h4 +++ b/mpp/shmem_c_func.h4 @@ -403,7 +403,7 @@ define(`SHMEM_C_CTX_FETCH_OR', SHMEM_DECLARE_FOR_BITWISE_AMO(`SHMEM_C_CTX_FETCH_OR') /* COLL: Barrier Synchronization Routines */ -SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmem_barrier(int PE_start, int logPE_stride, int PE_size, long *pSync); +SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmem_barrier(int PE_start, int logPE_stride, int PE_size, long *pSync) SHMEM_ATTRIBUTE_DEPRECATED; SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmem_barrier_all(void); SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmem_sync(int PE_start, int logPE_stride, int PE_size, long *pSync); SHMEM_FUNCTION_ATTRIBUTES void SHPRE()shmem_sync_all(void); @@ -414,7 +414,7 @@ define(`SHMEM_C_TO_ALL', SH_PAD(`$1',`$4') const $2 *source, int nreduce, SH_PAD(`$1',`$4') int PE_start, int logPE_stride, SH_PAD(`$1',`$4') int PE_size, $2 *pWrk, -SH_PAD(`$1',`$4') long *pSync);')dnl +SH_PAD(`$1',`$4') long *pSync) SHMEM_ATTRIBUTE_DEPRECATED;')dnl dnl SHMEM_BIND_C_COLL_INTS(`SHMEM_C_TO_ALL', `and') From 496e2a94e4fcc2e9c93725dcb3c3c2a81eddf72d Mon Sep 17 00:00:00 2001 From: kholland-intel Date: Tue, 31 Aug 2021 13:21:15 -0500 Subject: [PATCH 2/5] Updated deprecated reduction/barrier unit tests Replaced deprecated reduction and barrier routines in the unit tests. In situations where the active set syntax was actually used, the reductions were wrapped in an ifdef. --- test/unit/big_reduction.c | 10 +- test/unit/bigput.c | 10 +- test/unit/cxx_test_shmem_complex.cpp | 4 +- test/unit/max_reduction.c | 10 +- test/unit/mt_membar.c | 2 +- test/unit/nop_collectives.c | 28 +++ test/unit/pingpong-short.c | 20 +- test/unit/pingpong.c | 21 +- test/unit/reduce_active_set.c | 72 ++++-- test/unit/reduce_in_place.c | 9 +- test/unit/self_collectives.c | 42 ++++ test/unit/shmem_malloc_with_hints.c | 11 +- test/unit/sync-size.c | 13 +- test/unit/to_all.c | 329 +++++++++++++-------------- 14 files changed, 302 insertions(+), 279 deletions(-) diff --git a/test/unit/big_reduction.c b/test/unit/big_reduction.c index 51fd5ccd..c76d343a 100644 --- a/test/unit/big_reduction.c +++ b/test/unit/big_reduction.c @@ -40,8 +40,6 @@ #include #include -long pSync[SHMEM_REDUCE_SYNC_SIZE]; - #define N 128 long src[N]; @@ -50,8 +48,6 @@ long dst[N]; #define MAX(a, b) ((a) > (b)) ? (a) : (b) #define WRK_SIZE MAX(N/2+1, SHMEM_REDUCE_MIN_WRKDATA_SIZE) -long pWrk[WRK_SIZE]; - int main(int argc, char* argv[]) { @@ -74,10 +70,6 @@ main(int argc, char* argv[]) } } - for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i += 1) { - pSync[i] = SHMEM_SYNC_VALUE; - } - shmem_init(); for (i = 0; i < N; i += 1) { @@ -85,7 +77,7 @@ main(int argc, char* argv[]) } shmem_barrier_all(); - shmem_long_max_to_all(dst, src, N, 0, 0, shmem_n_pes(), pWrk, pSync); + shmem_long_max_reduce(SHMEM_TEAM_WORLD, dst, src, N); if (Verbose) { printf("%d/%d\tdst =", shmem_my_pe(), shmem_n_pes() ); diff --git a/test/unit/bigput.c b/test/unit/bigput.c index ce372492..7ca09579 100644 --- a/test/unit/bigput.c +++ b/test/unit/bigput.c @@ -52,9 +52,6 @@ int Track; int elements = NUM_ELEMENTS; double sum_time, time_taken; -double pWrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE]; -long pSync[SHMEM_REDUCE_SYNC_SIZE]; - static int atoi_scaled(char *s) { @@ -159,9 +156,6 @@ main(int argc, char **argv) } } - for(i=0; i < SHMEM_REDUCE_SYNC_SIZE; i++) - pSync[i] = SHMEM_SYNC_VALUE; - target_PE = (me+1) % npes; total_time = (double *) shmem_malloc( npes * sizeof(double) ); @@ -222,7 +216,7 @@ main(int argc, char **argv) // collect time per node. shmem_double_put( &total_time[me], &time_taken, 1, 0 ); - shmem_double_sum_to_all(&sum_time, &time_taken, 1, 0, 0, npes, pWrk, pSync); + shmem_double_sum_reduce(SHMEM_TEAM_WORLD, &sum_time, &time_taken, 1); shmem_barrier_all(); @@ -250,7 +244,7 @@ main(int argc, char **argv) sum_time /= (double)npes; comp_time /= (double)npes; if (sum_time != comp_time) - printf("%s: computed_time %7.5f != sum_to_all_time %7.5f)\n", + printf("%s: computed_time %7.5f != sum_reduce_time %7.5f)\n", pgm, comp_time, sum_time ); rate = ((double)bytes/(1024.0*1024.0)) / comp_time; diff --git a/test/unit/cxx_test_shmem_complex.cpp b/test/unit/cxx_test_shmem_complex.cpp index 0cf2f7a1..dfaaee11 100644 --- a/test/unit/cxx_test_shmem_complex.cpp +++ b/test/unit/cxx_test_shmem_complex.cpp @@ -59,8 +59,8 @@ long syncArr[SHMEM_REDUCE_SYNC_SIZE]; \ memset(TYPE##_src,0,sizeof(TYPE##_src)); \ \ - shmem_complex##LETTER##_##OP##_to_all(TYPE##_dest,TYPE##_src,10, \ - 0,0, shmem_n_pes(), TYPE##_workData, syncArr); \ + shmem_complex##LETTER##_##OP##_reduce(SHMEM_TEAM_WORLD, \ + TYPE##_dest,TYPE##_src,10); \ \ shmem_barrier_all(); \ \ diff --git a/test/unit/max_reduction.c b/test/unit/max_reduction.c index b5008073..57cbf114 100644 --- a/test/unit/max_reduction.c +++ b/test/unit/max_reduction.c @@ -38,8 +38,6 @@ #include #include -long pSync[SHMEM_REDUCE_SYNC_SIZE]; - #define N 3 long src[N]; @@ -48,8 +46,6 @@ long dst[N]; #define MAX(a, b) ((a) > (b)) ? (a) : (b) #define WRK_SIZE MAX(N/2+1, SHMEM_REDUCE_MIN_WRKDATA_SIZE) -long pWrk[WRK_SIZE]; - int main(int argc, char* argv[]) { @@ -72,10 +68,6 @@ main(int argc, char* argv[]) } } - for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i += 1) { - pSync[i] = SHMEM_SYNC_VALUE; - } - shmem_init(); for (i = 0; i < N; i += 1) { @@ -83,7 +75,7 @@ main(int argc, char* argv[]) } shmem_barrier_all(); - shmem_long_max_to_all(dst, src, N, 0, 0, shmem_n_pes(), pWrk, pSync); + shmem_long_max_reduce(SHMEM_TEAM_WORLD, dst, src, N); if (Verbose) { printf("%d/%d\tdst =", shmem_my_pe(), shmem_n_pes() ); diff --git a/test/unit/mt_membar.c b/test/unit/mt_membar.c index d5efb67b..4505e775 100644 --- a/test/unit/mt_membar.c +++ b/test/unit/mt_membar.c @@ -229,7 +229,7 @@ int main(int argc, char **argv) { pthread_barrier_destroy(&fencebar); shmem_barrier_all(); - shmem_int_sum_to_all(&sum_error, &errors, 1, 0, 0, npes, pWrk, pSync); + shmem_int_sum_reduce(SHMEM_TEAM_WORLD, &sum_error, &errors, 1); shmem_finalize(); return (sum_error == 0) ? 0 : 1; diff --git a/test/unit/nop_collectives.c b/test/unit/nop_collectives.c index f19cc920..62965e9e 100644 --- a/test/unit/nop_collectives.c +++ b/test/unit/nop_collectives.c @@ -108,19 +108,47 @@ int main(void) { shmem_barrier_all(); if (me == 0) printf(" + reduction\n"); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_and_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_and_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_or_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_or_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_xor_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_xor_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_min_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_min_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_max_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_max_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_sum_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_sum_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_prod_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync); +#else + shmem_int_prod_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0); +#endif shmem_barrier_all(); if (me == 0) printf(" + all-to-all\n"); diff --git a/test/unit/pingpong-short.c b/test/unit/pingpong-short.c index 7394eb31..df32b89b 100644 --- a/test/unit/pingpong-short.c +++ b/test/unit/pingpong-short.c @@ -61,11 +61,6 @@ static int atoi_scaled(char *s); int output_mod = OUTPUT_MOD; int Verbose; int Slow; -long pSync0[SHMEM_BARRIER_SYNC_SIZE], - pSync1[SHMEM_BARRIER_SYNC_SIZE], - pSync2[SHMEM_BARRIER_SYNC_SIZE], - pSync3[SHMEM_BARRIER_SYNC_SIZE], - pSync4[SHMEM_BARRIER_SYNC_SIZE]; #define DFLT_NWORDS 128 #define DFLT_LOOPS 100 @@ -89,11 +84,6 @@ main(int argc, char* argv[]) DataType *wp; long work_sz; - for(j=0; j < SHMEM_BARRIER_SYNC_SIZE; j++) { - pSync0[j] = pSync1[j] = pSync2[j] = pSync3[j] = - pSync4[j] = SHMEM_SYNC_VALUE; - } - shmem_init(); my_pe = shmem_my_pe(); nProcs = shmem_n_pes(); @@ -200,7 +190,7 @@ main(int argc, char* argv[]) if ( Verbose && (j==0 || (j % output_mod) == 0) ) fprintf(stderr,"[%d] +(%d)\n", shmem_my_pe(),j); #endif - shmem_barrier(0, 0, nProcs, pSync0); + shmem_barrier_all(); if ( my_pe == 0 ) { int p; for(p=1; p < nProcs; p++) @@ -220,7 +210,7 @@ main(int argc, char* argv[]) if ( Verbose && (j==0 || (j % output_mod) == 0) ) fprintf(stderr,"[%d] -(%d)\n", my_pe,j); #endif - shmem_barrier(0, 0, nProcs, pSync1); + shmem_barrier_all(); RDprintf("Workers[1 ... %d] verify Target data put by my_pe 0\n", nWorkers); @@ -241,7 +231,7 @@ main(int argc, char* argv[]) else /* clear results buffer, workers will put here */ memset(work, 0, work_sz); - shmem_barrier(0, 0, nProcs, pSync2); + shmem_barrier_all(); RDprintf("Workers[1 ... %d] put Target data to PE0 work " "vector\n",nWorkers); @@ -264,7 +254,7 @@ main(int argc, char* argv[]) } } - shmem_barrier(0, 0, nProcs, pSync3); + shmem_barrier_all(); if ( my_pe == 0 ) { RDprintf("Loop(%d) PE0 verifing work data.\n",j); @@ -283,7 +273,7 @@ main(int argc, char* argv[]) break; } } - shmem_barrier(0, 0, nProcs, pSync4); + shmem_barrier_all(); if (loops > 1) { RDfprintf(stderr,"."); diff --git a/test/unit/pingpong.c b/test/unit/pingpong.c index f4761378..8f6efff4 100644 --- a/test/unit/pingpong.c +++ b/test/unit/pingpong.c @@ -61,12 +61,6 @@ int output_mod = OUTPUT_MOD; int Verbose; int Slow; -long pSync0[SHMEM_BARRIER_SYNC_SIZE], - pSync1[SHMEM_BARRIER_SYNC_SIZE], - pSync2[SHMEM_BARRIER_SYNC_SIZE], - pSync3[SHMEM_BARRIER_SYNC_SIZE], - pSync4[SHMEM_BARRIER_SYNC_SIZE]; - #define DFLT_NWORDS 128 #define DFLT_LOOPS 10 @@ -86,11 +80,6 @@ main(int argc, char* argv[]) char *prog_name; long *wp,work_sz; - for(j=0; j < SHMEM_BARRIER_SYNC_SIZE; j++) { - pSync0[j] = pSync1[j] = pSync2[j] = pSync3[j] = - pSync4[j] = SHMEM_SYNC_VALUE; - } - shmem_init(); my_pe = shmem_my_pe(); nProcs = shmem_n_pes(); @@ -198,7 +187,7 @@ main(int argc, char* argv[]) if ( Verbose && (j==0 || (j % output_mod) == 0) ) fprintf(stderr,"[%d] +(%d)\n", my_pe,j); #endif - shmem_barrier(0, 0, nProcs, pSync0); + shmem_barrier_all(); if ( my_pe == 0 ) { int p; for(p=1; p < nProcs; p++) @@ -218,7 +207,7 @@ main(int argc, char* argv[]) if ( Verbose && (j==0 || (j % output_mod) == 0) ) fprintf(stderr,"[%d] -(%d)\n", shmem_my_pe(),j); #endif - shmem_barrier(0, 0, nProcs, pSync1); + shmem_barrier_all(); RDprintf("Workers[1 ... %d] verify Target data put by proc0\n", nWorkers); @@ -239,7 +228,7 @@ main(int argc, char* argv[]) else /* clear results buffer, workers will put here */ memset(work, 0, work_sz); - shmem_barrier(0, 0, nProcs, pSync2); + shmem_barrier_all(); RDprintf("Workers[1 ... %d] put Target data to PE0 work " "vector\n",nWorkers); @@ -262,7 +251,7 @@ main(int argc, char* argv[]) } } - shmem_barrier(0, 0, nProcs, pSync3); + shmem_barrier_all(); if ( my_pe == 0 ) { RDprintf("Loop(%d) PE0 verifing work data.\n",j); @@ -283,7 +272,7 @@ main(int argc, char* argv[]) break; } } - shmem_barrier(0, 0, nProcs, pSync4); + shmem_barrier_all(); #if _DEBUG if (loops > 1) { Rfprintf(stderr,"."); diff --git a/test/unit/reduce_active_set.c b/test/unit/reduce_active_set.c index 1a057882..beab68bf 100644 --- a/test/unit/reduce_active_set.c +++ b/test/unit/reduce_active_set.c @@ -30,16 +30,46 @@ #define NELEM 10 +#ifdef ENABLE_DEPRECATED_TESTS long max_psync[SHMEM_REDUCE_SYNC_SIZE]; long min_psync[SHMEM_REDUCE_SYNC_SIZE]; long min_pwrk[NELEM/2 + SHMEM_REDUCE_MIN_WRKDATA_SIZE]; long max_pwrk[NELEM/2 + SHMEM_REDUCE_MIN_WRKDATA_SIZE]; +#endif long src[NELEM]; long dst_max[NELEM]; long dst_min[NELEM]; +static int validate_max(int i, int me, int npes) { + int errors = 0; + /* Validate reduced max data */ + for (int j = 0; j < NELEM; j++) { + long expected = npes-1; + if (dst_max[j] != expected) { + printf("%d: Max expected dst_max[%d] = %ld, got dst_max[%d] = %ld, iteration %d\n", + me, j, expected, j, dst_max[j], i); + errors++; + } + } + return errors; +} + +static int validate_min(int i, int me, int npes) { + int errors = 0; + /* Validate reduced min data */ + for (int j = 0; j < NELEM; j++) { + long expected = i; + if (dst_min[j] != expected) { + printf("%d: Min expected dst_min[%d] = %ld, got dst_min[%d] = %ld, iteration %d\n", + me, j, expected, j, dst_min[j], i); + errors++; + } + } + return errors; +} + int main(void) { int i, me, npes; @@ -56,10 +86,12 @@ int main(void) dst_min[i] = -1; } +#ifdef ENABLE_DEPRECATED_TESTS for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++) { max_psync[i] = SHMEM_SYNC_VALUE; min_psync[i] = SHMEM_SYNC_VALUE; } +#endif if (me == 0) printf("Shrinking active set test\n"); @@ -68,37 +100,37 @@ int main(void) /* A total of npes tests are performed, where the active set in each test * includes PEs i..npes-1 */ +#ifdef ENABLE_DEPRECATED_TESTS for (i = 0; i <= me; i++) { - int j; if (me == i) printf(" + PE_start=%d, logPE_stride=0, PE_size=%d\n", i, npes-i); shmem_long_max_to_all(dst_max, src, NELEM, i, 0, npes-i, max_pwrk, max_psync); - - /* Validate reduced data */ - for (j = 0; j < NELEM; j++) { - long expected = npes-1; - if (dst_max[j] != expected) { - printf("%d: Max expected dst_max[%d] = %ld, got dst_max[%d] = %ld, iteration %d\n", - me, j, expected, j, dst_max[j], i); - errors++; - } - } + errors += validate_max(i, me, npes); shmem_long_min_to_all(dst_min, src, NELEM, i, 0, npes-i, min_pwrk, min_psync); + errors += validate_min(i, me, npes); - /* Validate reduced data */ - for (j = 0; j < NELEM; j++) { - long expected = i; - if (dst_min[j] != expected) { - printf("%d: Min expected dst_min[%d] = %ld, got dst_min[%d] = %ld, iteration %d\n", - me, j, expected, j, dst_min[j], i); - errors++; - } - } + } +#else + shmem_team_t new_team; + for (i = 0; i < npes; i++) { + if (me == i) + printf(" + PE_start=%d, PE_stride=1, PE_size=%d\n", i, npes-i); + + shmem_team_split_strided(SHMEM_TEAM_WORLD, i, 1, npes-i, NULL, 0, &new_team); + if (new_team != SHMEM_TEAM_INVALID) { + shmem_long_max_reduce(new_team, dst_max, src, NELEM); + errors += validate_max(i, me, npes); + + shmem_long_min_reduce(new_team, dst_min, src, NELEM); + errors += validate_min(i, me, npes); + } } +#endif + shmem_finalize(); diff --git a/test/unit/reduce_in_place.c b/test/unit/reduce_in_place.c index cca93bdf..66ac5d2e 100644 --- a/test/unit/reduce_in_place.c +++ b/test/unit/reduce_in_place.c @@ -30,10 +30,6 @@ #define NELEM 10 -long psync[SHMEM_REDUCE_SYNC_SIZE]; - -long pwrk[NELEM/2 + SHMEM_REDUCE_MIN_WRKDATA_SIZE]; - long src[NELEM]; int main(void) @@ -49,12 +45,9 @@ int main(void) for (int i = 0; i < NELEM; i++) src[i] = me; - for (int i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++) - psync[i] = SHMEM_SYNC_VALUE; - shmem_barrier_all(); - shmem_long_max_to_all(src, src, NELEM, 0, 0, npes, pwrk, psync); + shmem_long_max_reduce(SHMEM_TEAM_WORLD, src, src, NELEM); /* Validate reduced data */ for (int j = 0; j < NELEM; j++) { diff --git a/test/unit/self_collectives.c b/test/unit/self_collectives.c index 4c0c18c9..2c1347b7 100644 --- a/test/unit/self_collectives.c +++ b/test/unit/self_collectives.c @@ -161,38 +161,80 @@ int main(void) { if (me == 0) printf(" + reduction\n"); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_and_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_and_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_and_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_and_reduce", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_or_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_or_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_or_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_or_reduce", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_xor_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_xor_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_xor_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_xor_reduce", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_min_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_min_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_min_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_min_reduce", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_max_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_max_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_max_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_max_to_all", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_sum_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_sum_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_sum_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_sum_reduce", in, out); +#endif shmem_barrier_all(); in = me; out = -1; +#ifdef ENABLE_DEPRECATED_TESTS shmem_int_prod_to_all(&in, &out, 1, me, 0, 1, pwrk, reduce_psync); CHECK("shmem_int_prod_to_all", in, out); +#else + if (new_team != SHMEM_TEAM_INVALID) + shmem_int_prod_reduce(new_team, &in, &out, 1); + CHECK("shmem_int_prod_reduce", in, out); +#endif shmem_barrier_all(); /* All-to-all */ diff --git a/test/unit/shmem_malloc_with_hints.c b/test/unit/shmem_malloc_with_hints.c index b1856af8..5cf142b3 100644 --- a/test/unit/shmem_malloc_with_hints.c +++ b/test/unit/shmem_malloc_with_hints.c @@ -37,10 +37,6 @@ #define SHMEM_MALLOC_INVALID_HINT ~(SHMEM_MALLOC_ATOMICS_REMOTE) -long pSync[SHMEM_REDUCE_SYNC_SIZE]; -int pWrk[WRK_SIZE]; - - static int sumtoall_with_malloc_hint(long hint, int mype, int npes) { int failed = 0; @@ -59,7 +55,7 @@ static int sumtoall_with_malloc_hint(long hint, int mype, int npes) } shmem_barrier_all(); - shmem_int_sum_to_all(dst, src, N, 0, 0, npes, pWrk, pSync); + shmem_int_sum_reduce(SHMEM_TEAM_WORLD, dst, src, N); if (mype == 0) { for (i = 0; i < N; i++) { @@ -77,7 +73,7 @@ static int sumtoall_with_malloc_hint(long hint, int mype, int npes) int main(int argc, char **argv) { - int npes, i, mype; + int npes, mype; int passed = 0; int fail = 0; @@ -86,9 +82,6 @@ int main(int argc, char **argv) { npes = shmem_n_pes(); mype = shmem_my_pe(); - for (i = 0; i < SHMEM_REDUCE_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); diff --git a/test/unit/sync-size.c b/test/unit/sync-size.c index c96557ab..090cdf7b 100644 --- a/test/unit/sync-size.c +++ b/test/unit/sync-size.c @@ -25,8 +25,6 @@ * SOFTWARE. */ -/* Test various collectives using the same pSync array of SHMEM_SYNC_SIZE */ - #include #include #include @@ -35,9 +33,6 @@ #define N 3 #define MAX(A,B) ((A) > (B)) ? (A) : (B) -long pSync[SHMEM_SYNC_SIZE]; -long pWrk[MAX(N/2 + 1, SHMEM_REDUCE_MIN_WRKDATA_SIZE)]; - long src[N]; long dst[N]; @@ -45,11 +40,6 @@ int main(int argc, char* argv[]) { int i, j, me, npes; int errors = 0; - for (i = 0; i < SHMEM_SYNC_SIZE; i++) { - pSync[i] = SHMEM_SYNC_VALUE; - pSync[i] = SHMEM_SYNC_VALUE; - } - shmem_init(); me = shmem_my_pe(); @@ -62,7 +52,6 @@ int main(int argc, char* argv[]) { /* Barrier */ - shmem_barrier(0, 0, npes, pSync); shmem_barrier_all(); /* Broadcast */ @@ -98,7 +87,7 @@ int main(int argc, char* argv[]) { /* Reduction */ - shmem_long_max_to_all(dst, src, N, 0, 0, npes, pWrk, pSync); + shmem_long_max_reduce(SHMEM_TEAM_WORLD, dst, src, N); for (i = 0; i < N; i++) { if (dst[i] != npes-1) { diff --git a/test/unit/to_all.c b/test/unit/to_all.c index 6bb49ae6..74e14143 100644 --- a/test/unit/to_all.c +++ b/test/unit/to_all.c @@ -35,8 +35,6 @@ * short, int, long, float, double, long double, long long. * Point being numerous SHMEM atomics and synchronizations in flight. * From OpenSHMEM_specification_v1.0-final doc: -* The pWrk and pSync arrays on all PEs in the active set must not be -* in use from a prior call to a collective OpenSHMEM routine. * * frank @ SystemFabric Works identified an interesting overflow issue in the * prod_to_all test. In the presence of slightly larger PE counts (>=14), @@ -44,8 +42,7 @@ * The short and int both wrap correctly and are both uniformly wrong...uniformly * being the salient point. float, double and long double all suffer from * floating point rounding errors, hence the FP test results are ignored -* (assumed to pass)when FP rounding is encountered. FP*_prod_to_all() calls are -* still made so as not to upset the pSync ordering. +* (assumed to pass)when FP rounding is encountered. * * usage: to_all {-amopsSv|h} * where: @@ -71,34 +68,31 @@ #define Rfprintf if (shmem_my_pe() == 0) fprintf #define Vprintf if (Verbose > 1) printf -int sum_to_all(int me, int npes); -int and_to_all(int me, int npes); -int min_to_all(int me, int npes); -int max_to_all(int me, int npes); -int prod_to_all(int me, int npes); -int or_to_all(int me, int npes); -int xor_to_all(int me, int npes); +int sum_reduce(int me, int npes); +int and_reduce(int me, int npes); +int min_reduce(int me, int npes); +int max_reduce(int me, int npes); +int prod_reduce(int me, int npes); +int or_reduce(int me, int npes); +int xor_reduce(int me, int npes); int Verbose; int Serialize; int Min, And, Sum, Prod, Or, Xor; int Passed; -long pSync[SHMEM_REDUCE_SYNC_SIZE]; -long pSync1[SHMEM_REDUCE_SYNC_SIZE]; - #define N 128 #define MAX(a, b) ((a) > (b)) ? (a) : (b) #define WRK_SIZE MAX(N/2+1, SHMEM_REDUCE_MIN_WRKDATA_SIZE) -short src0[N], dst0[N], pWrk0[WRK_SIZE]; -int src1[N], dst1[N], pWrk1[WRK_SIZE]; -long src2[N], dst2[N], pWrk2[WRK_SIZE]; -float src3[N], dst3[N], pWrk3[WRK_SIZE]; -double src4[N], dst4[N], pWrk4[WRK_SIZE]; -long double src5[N], dst5[N], pWrk5[WRK_SIZE]; -long long src6[N], dst6[N], pWrk6[WRK_SIZE]; +short src0[N], dst0[N]; +int src1[N], dst1[N]; +long src2[N], dst2[N]; +float src3[N], dst3[N]; +double src4[N], dst4[N]; +long double src5[N], dst5[N]; +long long src6[N], dst6[N]; short expected_result0; int expected_result1; @@ -111,7 +105,7 @@ long long expected_result6; int ok[7]; int -max_to_all(int me, int npes) +max_reduce(int me, int npes) { int i, j, pass=0; @@ -123,13 +117,13 @@ max_to_all(int me, int npes) } shmem_barrier_all(); - shmem_short_max_to_all( dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_max_to_all( dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_max_to_all( dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_float_max_to_all( dst3, src3, N, 0, 0, npes, pWrk3, pSync1); - shmem_double_max_to_all( dst4, src4, N, 0, 0, npes, pWrk4, pSync); - shmem_longdouble_max_to_all(dst5, src5, N, 0, 0, npes, pWrk5, pSync1); - shmem_longlong_max_to_all( dst6, src6, N, 0, 0, npes, pWrk6, pSync); + shmem_short_max_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_max_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_max_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_float_max_reduce( SHMEM_TEAM_WORLD, dst3, src3, N); + shmem_double_max_reduce( SHMEM_TEAM_WORLD, dst4, src4, N); + shmem_longdouble_max_reduce(SHMEM_TEAM_WORLD, dst5, src5, N); + shmem_longlong_max_reduce( SHMEM_TEAM_WORLD, dst6, src6, N); if (me == 0) { for (i = 0,j=-1; i < N; i++,j++) { @@ -143,52 +137,52 @@ max_to_all(int me, int npes) } if(ok[0]==1){ - printf("Reduction operation shmem_short_max_to_all: Failed\n"); + printf("Reduction operation shmem_short_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_short_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_max_reduce: Passed\n"); pass++; } if(ok[1]==1){ - printf("Reduction operation shmem_int_max_to_all: Failed\n"); + printf("Reduction operation shmem_int_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_int_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_max_reduce: Passed\n"); pass++; } if(ok[2]==1){ - printf("Reduction operation shmem_long_max_to_all: Failed\n"); + printf("Reduction operation shmem_long_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_long_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_max_reduce: Passed\n"); pass++; } if(ok[3]==1){ - printf("Reduction operation shmem_float_max_to_all: Failed\n"); + printf("Reduction operation shmem_float_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_float_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_float_max_reduce: Passed\n"); pass++; } if(ok[4]==1){ - printf("Reduction operation shmem_double_max_to_all: Failed\n"); + printf("Reduction operation shmem_double_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_double_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_double_max_reduce: Passed\n"); pass++; } if(ok[5]==1){ - printf("Reduction operation shmem_longdouble_max_to_all: Failed\n"); + printf("Reduction operation shmem_longdouble_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longdouble_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longdouble_max_reduce: Passed\n"); pass++; } if(ok[6]==1){ - printf("Reduction operation shmem_longlong_max_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_max_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longlong_max_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_max_reduce: Passed\n"); pass++; } Vprintf("\n"); @@ -199,7 +193,7 @@ max_to_all(int me, int npes) } int -min_to_all(int me, int npes) +min_reduce(int me, int npes) { int i, pass=0; @@ -219,13 +213,13 @@ min_to_all(int me, int npes) shmem_barrier_all(); - shmem_short_min_to_all(dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_min_to_all(dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_min_to_all(dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_float_min_to_all(dst3, src3, N, 0, 0, npes, pWrk3, pSync1); - shmem_double_min_to_all(dst4, src4, N, 0, 0, npes, pWrk4, pSync); - shmem_longdouble_min_to_all(dst5, src5, N, 0, 0, npes, pWrk5, pSync1); - shmem_longlong_min_to_all(dst6, src6, N, 0, 0, npes, pWrk6, pSync); + shmem_short_min_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_min_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_min_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_float_min_reduce( SHMEM_TEAM_WORLD, dst3, src3, N); + shmem_double_min_reduce( SHMEM_TEAM_WORLD, dst4, src4, N); + shmem_longdouble_min_reduce(SHMEM_TEAM_WORLD, dst5, src5, N); + shmem_longlong_min_reduce( SHMEM_TEAM_WORLD, dst6, src6, N); if(me == 0) { for (i = 0; i < N; i++) { @@ -238,52 +232,52 @@ min_to_all(int me, int npes) if(dst6[i] != i) ok[6] = 1; } if(ok[0]==1){ - printf("Reduction operation shmem_short_min_to_all: Failed\n"); + printf("Reduction operation shmem_short_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_short_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_min_reduce: Passed\n"); pass++; } if(ok[1]==1){ - printf("Reduction operation shmem_int_min_to_all: Failed\n"); + printf("Reduction operation shmem_int_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_int_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_min_reduce: Passed\n"); pass++; } if(ok[2]==1){ - printf("Reduction operation shmem_long_min_to_all: Failed\n"); + printf("Reduction operation shmem_long_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_long_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_min_reduce: Passed\n"); pass++; } if(ok[3]==1){ - printf("Reduction operation shmem_float_min_to_all: Failed\n"); + printf("Reduction operation shmem_float_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_float_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_float_min_reduce: Passed\n"); pass++; } if(ok[4]==1){ - printf("Reduction operation shmem_double_min_to_all: Failed\n"); + printf("Reduction operation shmem_double_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_double_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_double_min_reduce: Passed\n"); pass++; } if(ok[5]==1){ - printf("Reduction operation shmem_longdouble_min_to_all: Failed\n"); + printf("Reduction operation shmem_longdouble_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longdouble_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longdouble_min_reduce: Passed\n"); pass++; } if(ok[6]==1){ - printf("Reduction operation shmem_longlong_min_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_min_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longlong_min_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_min_reduce: Passed\n"); pass++; } Vprintf("\n"); @@ -295,7 +289,7 @@ min_to_all(int me, int npes) int -sum_to_all(int me, int npes) +sum_reduce(int me, int npes) { int i, pass=0; @@ -314,13 +308,13 @@ sum_to_all(int me, int npes) shmem_barrier_all(); - shmem_short_sum_to_all(dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_sum_to_all(dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_sum_to_all(dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_float_sum_to_all(dst3, src3, N, 0, 0, npes, pWrk3, pSync1); - shmem_double_sum_to_all(dst4, src4, N, 0, 0, npes, pWrk4, pSync); - shmem_longdouble_sum_to_all(dst5, src5, N, 0, 0, npes, pWrk5, pSync1); - shmem_longlong_sum_to_all(dst6, src6, N, 0, 0, npes, pWrk6, pSync); + shmem_short_sum_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_sum_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_sum_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_float_sum_reduce( SHMEM_TEAM_WORLD, dst3, src3, N); + shmem_double_sum_reduce( SHMEM_TEAM_WORLD, dst4, src4, N); + shmem_longdouble_sum_reduce(SHMEM_TEAM_WORLD, dst5, src5, N); + shmem_longlong_sum_reduce( SHMEM_TEAM_WORLD, dst6, src6, N); if(me == 0) { for (i = 0; i < N; i++) { @@ -333,52 +327,52 @@ sum_to_all(int me, int npes) if(dst6[i] != (long long) (npes * (npes-1)/2)) ok[6] = 1; } if(ok[0]==1){ - printf("Reduction operation shmem_short_sum_to_all: Failed\n"); + printf("Reduction operation shmem_short_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_short_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_sum_reduce: Passed\n"); pass++; } if(ok[1]==1){ - printf("Reduction operation shmem_int_sum_to_all: Failed\n"); + printf("Reduction operation shmem_int_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_int_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_sum_reduce: Passed\n"); pass++; } if(ok[2]==1){ - printf("Reduction operation shmem_long_sum_to_all: Failed\n"); + printf("Reduction operation shmem_long_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_long_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_sum_reduce: Passed\n"); pass++; } if(ok[3]==1){ - printf("Reduction operation shmem_float_sum_to_all: Failed\n"); + printf("Reduction operation shmem_float_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_float_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_float_sum_reduce: Passed\n"); pass++; } if(ok[4]==1){ - printf("Reduction operation shmem_double_sum_to_all: Failed\n"); + printf("Reduction operation shmem_double_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_double_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_double_sum_reduce: Passed\n"); pass++; } if(ok[5]==1){ - printf("Reduction operation shmem_longdouble_sum_to_all: Failed\n"); + printf("Reduction operation shmem_longdouble_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longdouble_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longdouble_sum_reduce: Passed\n"); pass++; } if(ok[6]==1){ - printf("Reduction operation shmem_longlong_sum_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_sum_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longlong_sum_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_sum_reduce: Passed\n"); pass++; } Vprintf("\n"); fflush(stdout); @@ -390,7 +384,7 @@ sum_to_all(int me, int npes) int -and_to_all(int me, int num_pes) +and_reduce(int me, int num_pes) { int i, pass=0; @@ -403,10 +397,10 @@ and_to_all(int me, int num_pes) shmem_barrier_all(); - shmem_short_and_to_all(dst0, src0, N, 0, 0, num_pes, pWrk0, pSync); - shmem_int_and_to_all(dst1, src1, N, 0, 0, num_pes, pWrk1, pSync1); - shmem_long_and_to_all(dst2, src2, N, 0, 0, num_pes, pWrk2, pSync); - shmem_longlong_and_to_all(dst6, src6, N, 0, 0, num_pes, pWrk6, pSync1); + shmem_short_and_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_and_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_and_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_longlong_and_reduce(SHMEM_TEAM_WORLD, dst6, src6, N); if (me==0) { for (i = 0; i < N; i++) { @@ -417,31 +411,31 @@ and_to_all(int me, int num_pes) } if(ok[0]==1){ - printf("Reduction operation shmem_short_and_to_all: Failed\n"); + printf("Reduction operation shmem_short_and_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_short_and_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_and_reduce: Passed\n"); pass++; } if(ok[1]==1){ - printf("Reduction operation shmem_int_and_to_all: Failed\n"); + printf("Reduction operation shmem_int_and_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_int_and_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_and_reduce: Passed\n"); pass++; } if(ok[2]==1){ - printf("Reduction operation shmem_long_and_to_all: Failed\n"); + printf("Reduction operation shmem_long_and_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_long_and_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_and_reduce: Passed\n"); pass++; } if(ok[3]==1){ - printf("Reduction operation shmem_longlong_and_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_and_reduce: Failed\n"); } else{ - Vprintf("Reduction operation shmem_longlong_and_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_and_reduce: Passed\n"); pass++; } Vprintf("\n"); fflush(stdout); @@ -453,7 +447,7 @@ and_to_all(int me, int num_pes) int -prod_to_all(int me, int npes) +prod_reduce(int me, int npes) { int i, pass=0; int float_rounding_err=0; @@ -501,13 +495,13 @@ prod_to_all(int me, int npes) shmem_barrier_all(); - shmem_short_prod_to_all(dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_prod_to_all(dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_prod_to_all(dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_float_prod_to_all(dst3, src3, N, 0, 0, npes, pWrk3, pSync1); - shmem_double_prod_to_all(dst4, src4, N, 0, 0, npes, pWrk4, pSync); - shmem_longdouble_prod_to_all(dst5, src5, N, 0, 0, npes, pWrk5, pSync1); - shmem_longlong_prod_to_all(dst6, src6, N, 0, 0, npes, pWrk6, pSync); + shmem_short_prod_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_prod_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_prod_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_float_prod_reduce( SHMEM_TEAM_WORLD, dst3, src3, N); + shmem_double_prod_reduce( SHMEM_TEAM_WORLD, dst4, src4, N); + shmem_longdouble_prod_reduce(SHMEM_TEAM_WORLD, dst5, src5, N); + shmem_longlong_prod_reduce( SHMEM_TEAM_WORLD, dst6, src6, N); if(me == 0) { for (i = 0; i < N; i++) { @@ -529,66 +523,66 @@ prod_to_all(int me, int npes) } if(ok[0]==1) - printf("Reduction operation shmem_short_prod_to_all: Failed\n"); + printf("Reduction operation shmem_short_prod_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_short_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_prod_reduce: Passed\n"); pass++; } if(ok[1]==1) - printf("Reduction operation shmem_int_prod_to_all: Failed\n"); + printf("Reduction operation shmem_int_prod_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_int_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_prod_reduce: Passed\n"); pass++; } if(ok[2]==1) - printf("Reduction operation shmem_long_prod_to_all: Failed\n"); + printf("Reduction operation shmem_long_prod_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_long_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_prod_reduce: Passed\n"); pass++; } if(ok[3]==1) - printf("Reduction operation shmem_float_prod_to_all: Failed\n"); + printf("Reduction operation shmem_float_prod_reduce: Failed\n"); else { if (float_rounding_err) { - Vprintf("Reduction operation shmem_float_prod_to_all: skipped due to float rounding error\n"); + Vprintf("Reduction operation shmem_float_prod_reduce: skipped due to float rounding error\n"); } else { - Vprintf("Reduction operation shmem_float_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_float_prod_reduce: Passed\n"); } pass++; } if(ok[4]==1) - printf("Reduction operation shmem_double_prod_to_all: Failed\n"); + printf("Reduction operation shmem_double_prod_reduce: Failed\n"); else { if (double_rounding_err) { - Vprintf("Reduction operation shmem_double_prod_to_all: skipped due to double rounding error\n"); + Vprintf("Reduction operation shmem_double_prod_reduce: skipped due to double rounding error\n"); } else { - Vprintf("Reduction operation shmem_double_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_double_prod_reduce: Passed\n"); } pass++; } if(ok[5]==1) - printf("Reduction operation shmem_longdouble_prod_to_all: Failed\n"); + printf("Reduction operation shmem_longdouble_prod_reduce: Failed\n"); else { if (double_rounding_err) { - Vprintf("Reduction operation shmem_longdouble_prod_to_all: skipped due to long double rounding error\n"); + Vprintf("Reduction operation shmem_longdouble_prod_reduce: skipped due to long double rounding error\n"); } else { - Vprintf("Reduction operation shmem_longdouble_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longdouble_prod_reduce: Passed\n"); } pass++; } if(ok[6]==1) - printf("Reduction operation shmem_longlong_prod_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_prod_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_longlong_prod_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_prod_reduce: Passed\n"); pass++; } Vprintf("\n"); @@ -600,7 +594,7 @@ prod_to_all(int me, int npes) int -or_to_all(int me, int npes) +or_reduce(int me, int npes) { int i, pass=0; @@ -616,10 +610,10 @@ or_to_all(int me, int npes) shmem_barrier_all(); - shmem_short_or_to_all(dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_or_to_all(dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_or_to_all(dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_longlong_or_to_all(dst6, src6, N, 0, 0, npes, pWrk6, pSync1); + shmem_short_or_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_or_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_or_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_longlong_or_reduce(SHMEM_TEAM_WORLD, dst6, src6, N); if (me==0) { for (i = 0; i < N; i++) { @@ -632,30 +626,30 @@ or_to_all(int me, int npes) } if(ok[0]==1) - printf("Reduction operation shmem_short_or_to_all: Failed\n"); + printf("Reduction operation shmem_short_or_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_short_or_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_or_reduce: Passed\n"); pass++; } if(ok[1]==1) - printf("Reduction operation shmem_int_or_to_all: Failed\n"); + printf("Reduction operation shmem_int_or_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_int_or_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_or_reduce: Passed\n"); pass++; } if(ok[2]==1) - printf("Reduction operation shmem_long_or_to_all: Failed\n"); + printf("Reduction operation shmem_long_or_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_long_or_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_or_reduce: Passed\n"); pass++; } if(ok[6]==1) - printf("Reduction operation shmem_longlong_or_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_or_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_longlong_or_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_or_reduce: Passed\n"); pass++; } Vprintf("\n"); @@ -667,7 +661,7 @@ or_to_all(int me, int npes) int -xor_to_all(int me, int npes) +xor_reduce(int me, int npes) { int i, pass=0; int expected_result = ((int)(npes/2) % 2); @@ -684,10 +678,10 @@ xor_to_all(int me, int npes) shmem_barrier_all(); - shmem_short_xor_to_all(dst0, src0, N, 0, 0, npes, pWrk0, pSync); - shmem_int_xor_to_all(dst1, src1, N, 0, 0, npes, pWrk1, pSync1); - shmem_long_xor_to_all(dst2, src2, N, 0, 0, npes, pWrk2, pSync); - shmem_longlong_xor_to_all(dst6, src6, N, 0, 0, npes, pWrk6, pSync1); + shmem_short_xor_reduce( SHMEM_TEAM_WORLD, dst0, src0, N); + shmem_int_xor_reduce( SHMEM_TEAM_WORLD, dst1, src1, N); + shmem_long_xor_reduce( SHMEM_TEAM_WORLD, dst2, src2, N); + shmem_longlong_xor_reduce(SHMEM_TEAM_WORLD, dst6, src6, N); if (me==0) { for (i = 0; i < N; i++) { @@ -698,30 +692,30 @@ xor_to_all(int me, int npes) } if(ok[0]==1) - printf("Reduction operation shmem_short_xor_to_all: Failed\n"); + printf("Reduction operation shmem_short_xor_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_short_xor_to_all: Passed\n"); + Vprintf("Reduction operation shmem_short_xor_reduce: Passed\n"); pass++; } if(ok[1]==1) - printf("Reduction operation shmem_int_xor_to_all: Failed\n"); + printf("Reduction operation shmem_int_xor_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_int_xor_to_all: Passed\n"); + Vprintf("Reduction operation shmem_int_xor_reduce: Passed\n"); pass++; } if(ok[2]==1) - printf("Reduction operation shmem_long_xor_to_all: Failed\n"); + printf("Reduction operation shmem_long_xor_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_long_xor_to_all: Passed\n"); + Vprintf("Reduction operation shmem_long_xor_reduce: Passed\n"); pass++; } if(ok[6]==1) - printf("Reduction operation shmem_longlong_xor_to_all: Failed\n"); + printf("Reduction operation shmem_longlong_xor_reduce: Failed\n"); else { - Vprintf("Reduction operation shmem_longlong_xor_to_all: Passed\n"); + Vprintf("Reduction operation shmem_longlong_xor_reduce: Passed\n"); pass++; } @@ -736,7 +730,7 @@ xor_to_all(int me, int npes) int main(int argc, char* argv[]) { - int c, i, mype, num_pes, tests, passed; + int c, mype, num_pes, tests, passed; char *pgm; shmem_init(); @@ -752,22 +746,22 @@ main(int argc, char* argv[]) while((c=getopt(argc,argv,"ampsSoxhv")) != -1) { switch(c) { case 'a': - And++; // do not run and_to_all + And++; // do not run and_reduce break; case 'm': - Min++; // do not run min_to_all + Min++; // do not run min_reduce break; case 'o': - Or++; // do not run or_to_all + Or++; // do not run or_reduce break; case 'p': - Prod++; // do not run prod_to_all + Prod++; // do not run prod_reduce break; case 's': - Sum++; // do not run sum_to_all + Sum++; // do not run sum_reduce break; case 'x': - Xor++; // do not run xor_to_all + Xor++; // do not run xor_reduce break; case 'S': Serialize++; @@ -783,45 +777,40 @@ main(int argc, char* argv[]) } } - for (i = 0; i < SHMEM_REDUCE_SYNC_SIZE; i++) { - pSync[i] = SHMEM_SYNC_VALUE; - pSync1[i] = SHMEM_SYNC_VALUE; - } - tests = passed = 0; shmem_barrier_all(); - passed += max_to_all(mype, num_pes); + passed += max_reduce(mype, num_pes); tests++; if (!Min) { - passed += min_to_all(mype, num_pes); + passed += min_reduce(mype, num_pes); tests++; } if (!Sum) { - passed += sum_to_all(mype, num_pes); + passed += sum_reduce(mype, num_pes); tests++; } if (!And) { - passed += and_to_all(mype, num_pes); + passed += and_reduce(mype, num_pes); tests++; } if (!Prod) { - passed += prod_to_all(mype, num_pes); + passed += prod_reduce(mype, num_pes); tests++; } if (!Or) { - passed += or_to_all(mype, num_pes); + passed += or_reduce(mype, num_pes); tests++; } if (!Xor) { - passed += xor_to_all(mype, num_pes); + passed += xor_reduce(mype, num_pes); tests++; } From d5d17603bea9b6cb5c1831d0ef305e8eb6fc4bb0 Mon Sep 17 00:00:00 2001 From: kholland-intel Date: Tue, 21 Sep 2021 15:10:35 -0700 Subject: [PATCH 3/5] Addressed compiler warnings in unit tests Removed unused variables and wrapped deprecated barrier API in ifdef's --- test/unit/nop_collectives.c | 10 ++++++++-- test/unit/repeated_barriers.c | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/test/unit/nop_collectives.c b/test/unit/nop_collectives.c index 62965e9e..70b4604a 100644 --- a/test/unit/nop_collectives.c +++ b/test/unit/nop_collectives.c @@ -38,8 +38,10 @@ long alltoalls_psync[SHMEM_ALLTOALLS_SYNC_SIZE]; int pwrk[SHMEM_REDUCE_MIN_WRKDATA_SIZE]; int main(void) { - int i; - int me, npes; + int me; + +#ifdef ENABLE_DEPRECATED_TESTS + int i, npes; for (i = 0; i < SHMEM_BCAST_SYNC_SIZE; i++) bcast_psync[i] = SHMEM_SYNC_VALUE; @@ -58,11 +60,15 @@ int main(void) { for (i = 0; i < SHMEM_REDUCE_MIN_WRKDATA_SIZE; i++) pwrk[i] = 0; +#endif shmem_init(); me = shmem_my_pe(); + +#ifdef ENABLE_DEPRECATED_TESTS npes = shmem_n_pes(); +#endif if (me == 0) printf("Testing zero length collectives\n"); diff --git a/test/unit/repeated_barriers.c b/test/unit/repeated_barriers.c index b15b265b..7aea3124 100644 --- a/test/unit/repeated_barriers.c +++ b/test/unit/repeated_barriers.c @@ -30,8 +30,10 @@ #define NREPS 50 +#ifdef ENABLE_DEPRECATED_TESTS long barrier_psync0[SHMEM_BARRIER_SYNC_SIZE]; long barrier_psync1[SHMEM_BARRIER_SYNC_SIZE]; +#endif int main(void) { @@ -42,15 +44,18 @@ int main(void) me = shmem_my_pe(); npes = shmem_n_pes(); +#ifdef ENABLE_DEPRECATED_TESTS for (i = 0; i < SHMEM_BARRIER_SYNC_SIZE; i++) { barrier_psync0[i] = SHMEM_SYNC_VALUE; barrier_psync1[i] = SHMEM_SYNC_VALUE; } +#endif shmem_barrier_all(); /* A total of npes tests are performed, where the active set in each test * includes PEs i..npes-1 */ +#ifdef ENABLE_DEPRECATED_TESTS for (i = 0; i <= me; i++) { int j; @@ -61,6 +66,24 @@ int main(void) for (j = 0; j < NREPS; j++) shmem_barrier(i, 0, npes-i, (i % 2) ? barrier_psync0 : barrier_psync1); } +#else + shmem_team_t new_team; + for (i = 0; i <= npes; i++) { + int j; + + if (me == i) + printf(" + iteration %d\n", i); + + /* Test that quiet + sync can be called repeatedly*/ + shmem_team_split_strided(SHMEM_TEAM_WORLD, i, 1, npes-i, NULL, 0, &new_team); + if (new_team != SHMEM_TEAM_INVALID) { + for (j = 0; j < NREPS; j++) { + shmem_quiet(); + shmem_sync(new_team); + } + } + } +#endif shmem_finalize(); From c2bdb3956d864566ae0cf8b728a647ce80e225e2 Mon Sep 17 00:00:00 2001 From: kholland-intel Date: Fri, 22 Oct 2021 15:07:57 -0700 Subject: [PATCH 4/5] Fixed Indentation issues Also, updated shmem_sync to shmem_team_sync in repeated bariers test --- test/unit/reduce_active_set.c | 2 +- test/unit/repeated_barriers.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/reduce_active_set.c b/test/unit/reduce_active_set.c index beab68bf..978e260a 100644 --- a/test/unit/reduce_active_set.c +++ b/test/unit/reduce_active_set.c @@ -123,7 +123,7 @@ int main(void) shmem_team_split_strided(SHMEM_TEAM_WORLD, i, 1, npes-i, NULL, 0, &new_team); if (new_team != SHMEM_TEAM_INVALID) { shmem_long_max_reduce(new_team, dst_max, src, NELEM); - errors += validate_max(i, me, npes); + errors += validate_max(i, me, npes); shmem_long_min_reduce(new_team, dst_min, src, NELEM); errors += validate_min(i, me, npes); diff --git a/test/unit/repeated_barriers.c b/test/unit/repeated_barriers.c index 7aea3124..5584adab 100644 --- a/test/unit/repeated_barriers.c +++ b/test/unit/repeated_barriers.c @@ -79,7 +79,7 @@ int main(void) if (new_team != SHMEM_TEAM_INVALID) { for (j = 0; j < NREPS; j++) { shmem_quiet(); - shmem_sync(new_team); + shmem_team_sync(new_team); } } } From 82cc11f4ffbd1de9f9a1aab82f8157dafc40dc81 Mon Sep 17 00:00:00 2001 From: David Ozog Date: Mon, 25 Oct 2021 16:31:30 -0400 Subject: [PATCH 5/5] Fixing minor spacing issues --- test/unit/reduce_active_set.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/reduce_active_set.c b/test/unit/reduce_active_set.c index 978e260a..d5767e85 100644 --- a/test/unit/reduce_active_set.c +++ b/test/unit/reduce_active_set.c @@ -124,10 +124,10 @@ int main(void) if (new_team != SHMEM_TEAM_INVALID) { shmem_long_max_reduce(new_team, dst_max, src, NELEM); errors += validate_max(i, me, npes); - + shmem_long_min_reduce(new_team, dst_min, src, NELEM); - errors += validate_min(i, me, npes); - } + errors += validate_min(i, me, npes); + } } #endif