Skip to content

Commit

Permalink
Merge pull request #1017 from kholland-intel/pr/deprecated_sync_reduc…
Browse files Browse the repository at this point in the history
…tions

Added "Deprecated" Attribute to Necessary Reduction and Barrier Routines
  • Loading branch information
kholland-intel authored Oct 25, 2021
2 parents 674608c + 82cc11f commit 3b44eee
Show file tree
Hide file tree
Showing 16 changed files with 335 additions and 283 deletions.
4 changes: 2 additions & 2 deletions mpp/shmem_c_func.h4
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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')

Expand Down
10 changes: 1 addition & 9 deletions test/unit/big_reduction.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
#include <string.h>
#include <stdlib.h>

long pSync[SHMEM_REDUCE_SYNC_SIZE];

#define N 128

long src[N];
Expand All @@ -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[])
{
Expand All @@ -74,18 +70,14 @@ 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) {
src[i] = shmem_my_pe() + i;
}
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() );
Expand Down
10 changes: 2 additions & 8 deletions test/unit/bigput.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) );
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/cxx_test_shmem_complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); \
\
Expand Down
10 changes: 1 addition & 9 deletions test/unit/max_reduction.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
#include <string.h>
#include <stdlib.h>

long pSync[SHMEM_REDUCE_SYNC_SIZE];

#define N 3

long src[N];
Expand All @@ -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[])
{
Expand All @@ -72,18 +68,14 @@ 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) {
src[i] = shmem_my_pe() + i;
}
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() );
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mt_membar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
38 changes: 36 additions & 2 deletions test/unit/nop_collectives.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");

Expand Down Expand Up @@ -108,19 +114,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");
Expand Down
20 changes: 5 additions & 15 deletions test/unit/pingpong-short.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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++)
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -283,7 +273,7 @@ main(int argc, char* argv[])
break;
}
}
shmem_barrier(0, 0, nProcs, pSync4);
shmem_barrier_all();

if (loops > 1) {
RDfprintf(stderr,".");
Expand Down
21 changes: 5 additions & 16 deletions test/unit/pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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();
Expand Down Expand Up @@ -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++)
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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,".");
Expand Down
Loading

0 comments on commit 3b44eee

Please sign in to comment.