From a357508a1e85da79fa80e58277fdcd6e8c371815 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:35:33 -0800 Subject: [PATCH 01/51] main returns int (C89) --- SERIAL/DGEMM/dgemm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SERIAL/DGEMM/dgemm.c b/SERIAL/DGEMM/dgemm.c index 1418316e7..66bf66bb9 100755 --- a/SERIAL/DGEMM/dgemm.c +++ b/SERIAL/DGEMM/dgemm.c @@ -80,8 +80,8 @@ HISTORY: Written by Rob Van der Wijngaart, February 2009. #define forder (1.0*order) -main(int argc, char **argv){ - +int main(int argc, char **argv) +{ int iter, i,ii,j,jj,k,kk,ig,jg,kg; /* dummies */ int iterations; /* number of times the multiplication is done */ double dgemm_time, /* timing parameters */ From ffb0ddea85f7bac6bcbae96ae35eec62e310406c Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:39:22 -0800 Subject: [PATCH 02/51] silence pragma and uninit warnings --- SERIAL/Nstream/nstream.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SERIAL/Nstream/nstream.c b/SERIAL/Nstream/nstream.c index 831d83cb8..14c5160d3 100755 --- a/SERIAL/Nstream/nstream.c +++ b/SERIAL/Nstream/nstream.c @@ -206,7 +206,9 @@ int main(int argc, char **argv) printf("Offset = %ld\n", offset); printf("Number of iterations = %d\n", iterations); +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (j=0; j Date: Thu, 14 Jan 2016 21:39:35 -0800 Subject: [PATCH 03/51] silence format warnings --- SERIAL/DGEMM/dgemm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SERIAL/DGEMM/dgemm.c b/SERIAL/DGEMM/dgemm.c index 66bf66bb9..ee670995a 100755 --- a/SERIAL/DGEMM/dgemm.c +++ b/SERIAL/DGEMM/dgemm.c @@ -120,7 +120,7 @@ int main(int argc, char **argv) order = -order; } if (order < 1) { - printf("ERROR: Matrix order must be positive: %d\n", order); + printf("ERROR: Matrix order must be positive: %ld\n", order); exit(EXIT_FAILURE); } @@ -130,11 +130,11 @@ int main(int argc, char **argv) } else block = DEFAULTBLOCK; #endif - printf("Matrix order = %d\n", order); + printf("Matrix order = %ld\n", order); if (shortcut) printf("Only doing initialization\n"); if (block>0) - printf("Blocking factor = %d\n", block); + printf("Blocking factor = %ld\n", block); else printf("No blocking\n"); printf("Number of iterations = %d\n", iterations); From 130d1cf6e6f8783493a4f5c28d297dd992f88479 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:40:52 -0800 Subject: [PATCH 04/51] silence uninit warning --- SERIAL/Reduce/reduce.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SERIAL/Reduce/reduce.c b/SERIAL/Reduce/reduce.c index 014fb0b6b..4b790cf3f 100755 --- a/SERIAL/Reduce/reduce.c +++ b/SERIAL/Reduce/reduce.c @@ -112,6 +112,8 @@ int main(int argc, char ** argv) ones[i] = (double)1; } + reduce_time = 0.0; /* silence compiler warning */ + for (iter=0; iter<=iterations; iter++) { /* start timer after a warmup iteration */ From 521b17cc84fa874a167f6cbac1450ab55c2ff97c Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:43:48 -0800 Subject: [PATCH 05/51] stencil Wformat, Wsigned/unsigned, Wunint --- Makefile | 6 ++++-- SERIAL/Stencil/stencil.c | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1151e29ea..3e4423e79 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,12 @@ ifndef matrix_rank endif ifndef default_opt_flags - default_opt_flags=-O3 + default_opt_flags=-O3 -Wall -Wextra -Wformat -Werror -pedantic -std=c11 endif -default: +default: allserial allopenmp allmpi + +help: @echo "Usage: \"make all\" (re-)builds all targets" @echo " \"make allserial\" (re-)builds all serial targets" @echo " \"make allopenmp\" (re-)builds all OpenMP targets" diff --git a/SERIAL/Stencil/stencil.c b/SERIAL/Stencil/stencil.c index 79a610365..d7af383f3 100755 --- a/SERIAL/Stencil/stencil.c +++ b/SERIAL/Stencil/stencil.c @@ -137,14 +137,14 @@ int main(int argc, char ** argv) { } if (2*RADIUS +1 > n) { - printf("ERROR: Stencil radius %d exceeds grid size %d\n", RADIUS, n); + printf("ERROR: Stencil radius %d exceeds grid size %ld\n", RADIUS, n); exit(EXIT_FAILURE); } /* make sure the vector space can be represented */ total_length = n*n*sizeof(DTYPE); - if (total_length/n != n*sizeof(DTYPE)) { - printf("ERROR: Space for %d x %d grid cannot be represented; ", n, n); + if (total_length/n != n*(signed)sizeof(DTYPE)) { + printf("ERROR: Space for %ld x %ld grid cannot be represented; ", n, n); exit(EXIT_FAILURE); } @@ -181,7 +181,7 @@ int main(int argc, char ** argv) { norm = (DTYPE) 0.0; f_active_points = (DTYPE) (n-2*RADIUS)*(DTYPE) (n-2*RADIUS); - printf("Grid size = %d\n", n); + printf("Grid size = %ld\n", n); printf("Radius of stencil = %d\n", RADIUS); #ifdef STAR printf("Type of stencil = star\n"); @@ -208,6 +208,8 @@ int main(int argc, char ** argv) { for (j=RADIUS; j Date: Thu, 14 Jan 2016 21:45:58 -0800 Subject: [PATCH 06/51] transpose silent --- SERIAL/Transpose/transpose.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SERIAL/Transpose/transpose.c b/SERIAL/Transpose/transpose.c index f5ead244d..3aab90b03 100755 --- a/SERIAL/Transpose/transpose.c +++ b/SERIAL/Transpose/transpose.c @@ -64,7 +64,8 @@ HISTORY: Written by Rob Van der Wijngaart, February 2009. #define A(i,j) A_p[(i)+order*(j)] #define B(i,j) B_p[(i)+order*(j)] -static double test_results (int , double*); +/* Never used... + * static double test_results (int , double*); */ int main(int argc, char ** argv) { @@ -101,7 +102,7 @@ int main(int argc, char ** argv) { order = atol(*++argv); if (order < 0){ - printf("ERROR: Matrix Order must be greater than 0 : %d \n", order); + printf("ERROR: Matrix Order must be greater than 0 : %ld \n", order); exit(EXIT_FAILURE); } @@ -126,8 +127,8 @@ int main(int argc, char ** argv) { bytes = 2.0 * sizeof(double) * order * order; - printf("Matrix order = %d\n", order); - if (tile_size < order) printf("Tile size = %d\n", tile_size); + printf("Matrix order = %ld\n", order); + if (tile_size < order) printf("Tile size = %ld\n", tile_size); else printf("Untiled\n"); printf("Number of iterations = %d\n", iterations); @@ -143,6 +144,8 @@ int main(int argc, char ** argv) { B(i,j) = 0.0; } + trans_time = 0.0; /* silence compiler warning */ + for (iter = 0; iter<=iterations; iter++){ /* start timer after a warmup iteration */ From c0e1355615f7ba657a8ca64c13c525384a1c21aa Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:47:33 -0800 Subject: [PATCH 07/51] signed/unsigned compare fix --- SERIAL/Random/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SERIAL/Random/random.c b/SERIAL/Random/random.c index e2f8f3e77..72015b8d6 100644 --- a/SERIAL/Random/random.c +++ b/SERIAL/Random/random.c @@ -250,7 +250,7 @@ int main(int argc, char **argv) { /* even though the table size can be represented, computing the space required for the table may lead to overflow */ tablespace = (size_t) tablesize*sizeof(u64Int); - if ((tablespace/sizeof(u64Int)) != tablesize || tablespace <=0) { + if ((signed)(tablespace/sizeof(u64Int)) != tablesize || tablespace <=0) { printf("Cannot represent space for table on this system; "); printf("reduce log2 tablesize\n"); exit(EXIT_FAILURE); From d8bec405f312220866f515d08637396d6ea9640b Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:53:43 -0800 Subject: [PATCH 08/51] silence warnings; some of this should be resolved with different integer types --- SERIAL/Sparse/sparse.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SERIAL/Sparse/sparse.c b/SERIAL/Sparse/sparse.c index cfc828241..4b794a5c1 100755 --- a/SERIAL/Sparse/sparse.c +++ b/SERIAL/Sparse/sparse.c @@ -146,7 +146,7 @@ int main(int argc, char **argv){ /* emit error if (periodic) stencil overlaps with itself */ if (size <2*radius+1) { - printf("ERROR: Grid extent %d smaller than stencil diameter 2*%d+1= %d\n", + printf("ERROR: Grid extent %lld smaller than stencil diameter 2*%lld+1= %lld\n", size, radius, radius*2+1); exit(EXIT_FAILURE); } @@ -162,13 +162,13 @@ int main(int argc, char **argv){ matrix_space = nent*sizeof(double); matrix = (double *) malloc(matrix_space); if (!matrix) { - printf("ERROR: Could not allocate space for sparse matrix: %ld\n", nent); + printf("ERROR: Could not allocate space for sparse matrix: %lld\n", nent); exit(EXIT_FAILURE); } vector_space = 2*size2*sizeof(double); - if (vector_space/sizeof(double) != 2*size2) { - printf("ERROR: Cannot represent space for vectors: %ul\n", vector_space); + if (vector_space/sizeof(double) != (size_t)2*size2) { + printf("ERROR: Cannot represent space for vectors: %lu\n", vector_space); exit(EXIT_FAILURE); } @@ -180,8 +180,8 @@ int main(int argc, char **argv){ result = vector + size2; index_space = nent*sizeof(s64Int); - if (index_space/sizeof(s64Int) != nent) { - printf("ERROR: Cannot represent space for column indices: %ul\n", index_space); + if (index_space/sizeof(s64Int) != (size_t)nent) { + printf("ERROR: Cannot represent space for column indices: %lu\n", index_space); exit(EXIT_FAILURE); } colIndex = (s64Int *) malloc(index_space); @@ -192,7 +192,7 @@ int main(int argc, char **argv){ } printf("Matrix order = "FSTR64U"\n", size2); - printf("Stencil diameter = %16d\n", 2*radius+1); + printf("Stencil diameter = %16lld\n", 2*radius+1); printf("Sparsity = %16.10lf\n", sparsity); printf("Number of iterations = %16d\n", iterations); #ifdef SCRAMBLE @@ -224,6 +224,8 @@ int main(int argc, char **argv){ matrix[elm] = 1.0/(double)(colIndex[elm]+1); } + sparse_time = 0.0; /* silence compiler warning */ + for (iter=0; iter<=iterations; iter++) { if (iter==1) sparse_time = wtime(); @@ -234,7 +236,9 @@ int main(int argc, char **argv){ /* do the actual matrix-vector multiplication */ for (row=0; row Date: Thu, 14 Jan 2016 21:55:47 -0800 Subject: [PATCH 09/51] preprocess conditionalize Intel pragma --- SERIAL/Branch/branch.c | 22 ++++++++++++++++++++-- SERIAL/Synch_p2p/p2p.c | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/SERIAL/Branch/branch.c b/SERIAL/Branch/branch.c index 4a56d8fed..bcb5c5c0c 100755 --- a/SERIAL/Branch/branch.c +++ b/SERIAL/Branch/branch.c @@ -145,7 +145,7 @@ int main(int argc, char ** argv) total_ref; /* computed and stored verification values */ int * RESTRICT vector; int * RESTRICT index; - int factor = -1; + /* UNUSED int factor = -1; */ /********************************************************************************** ** process and test input parameters @@ -169,7 +169,7 @@ int main(int argc, char ** argv) vector_length = atol(*++argv); if (vector_length < 1){ - printf("ERROR: loop length must be >= 1 : %d \n",vector_length); + printf("ERROR: loop length must be >= 1 : %ld \n",vector_length); exit(EXIT_FAILURE); } @@ -214,13 +214,17 @@ int main(int argc, char ** argv) case VECTOR_STOP: /* condition vector[index[i]]>0 inhibits vectorization */ for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -232,13 +236,17 @@ int main(int argc, char ** argv) case VECTOR_GO: /* condition aux>0 allows vectorization */ for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -250,13 +258,17 @@ int main(int argc, char ** argv) case NO_VECTOR: /* condition aux>0 allows vectorization, but indirect indexing inbibits it */ for (iter=0; iter0) vector[i] -= 2*vector[index[i]]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[index[i]]; @@ -286,7 +298,9 @@ int main(int argc, char ** argv) case VECTOR_STOP: case VECTOR_GO: for (iter=0; iter Date: Thu, 14 Jan 2016 21:56:41 -0800 Subject: [PATCH 10/51] silence warnings --- OPENMP/DGEMM/dgemm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OPENMP/DGEMM/dgemm.c b/OPENMP/DGEMM/dgemm.c index 7f0805ed9..cd7fe666f 100755 --- a/OPENMP/DGEMM/dgemm.c +++ b/OPENMP/DGEMM/dgemm.c @@ -87,7 +87,7 @@ HISTORY: Written by Rob Van der Wijngaart, September 2006. #define forder (1.0*order) -main(int argc, char **argv){ +int main(int argc, char **argv){ int iter, i,ii,j,jj,k,kk,ig,jg,kg; /* dummies */ int iterations; /* number of times the multiplication is done */ @@ -167,7 +167,7 @@ main(int argc, char **argv){ #pragma omp parallel private (i,j,k,ii,jj,kk,ig,jg,kg,iter) { - double *AA, *BB, *CC; + double *AA=NULL, *BB=NULL, *CC=NULL; if (block > 0) { /* matrix blocks for local temporary copies */ From 9389669b9afdc30d46184e066f58b00d96dfc738 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 21:57:45 -0800 Subject: [PATCH 11/51] we need OpenMP4 instead of Intel SIMD --- OPENMP/Nstream/nstream.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OPENMP/Nstream/nstream.c b/OPENMP/Nstream/nstream.c index ab3142119..1299294be 100755 --- a/OPENMP/Nstream/nstream.c +++ b/OPENMP/Nstream/nstream.c @@ -230,8 +230,11 @@ int main(int argc, char **argv) } bail_out(num_error); + /* FIXME Use OpenMP 4 via _Pragma */ #pragma omp for +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (j=0; j Date: Thu, 14 Jan 2016 21:58:20 -0800 Subject: [PATCH 12/51] silence format warnings --- OPENMP/Reduce/reduce.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OPENMP/Reduce/reduce.c b/OPENMP/Reduce/reduce.c index 126e84907..2c20b4e8a 100755 --- a/OPENMP/Reduce/reduce.c +++ b/OPENMP/Reduce/reduce.c @@ -150,7 +150,7 @@ int main(int argc, char ** argv) vector_length = atol(*++argv); if (vector_length < 1){ - printf("ERROR: vector length must be >= 1 : %d \n",vector_length); + printf("ERROR: vector length must be >= 1 : %ld \n",vector_length); exit(EXIT_FAILURE); } @@ -195,7 +195,7 @@ int main(int argc, char ** argv) } else { printf("Number of threads = %d\n",nthread_input); - printf("Vector length = %d\n", vector_length); + printf("Vector length = %ld\n", vector_length); printf("Reduction algorithm = %s\n", algorithm); printf("Number of iterations = %d\n", iterations); } From 5425f5328b82ea65a2fa237d3a6652d90bc0407a Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 22:03:45 -0800 Subject: [PATCH 13/51] rename default_opt_flags to PRK_FLAGS since preprocessor macros should be all-caps --- Makefile | 150 +++++++++++++++++++++++++++---------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/Makefile b/Makefile index 3e4423e79..f3514c65e 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,8 @@ ifndef matrix_rank matrix_rank=5 endif -ifndef default_opt_flags - default_opt_flags=-O3 -Wall -Wextra -Wformat -Werror -pedantic -std=c11 +ifndef PRK_FLAGS + PRK_FLAGS=-O3 endif default: allserial allopenmp allmpi @@ -74,117 +74,117 @@ alldarwin: allserial allopenmp allmpi1 allfgmpi allmpiopenmp allmpirma allshmem allfreaks: allcharm++ allampi allgrappa allmpi1: - cd MPI1/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPI1/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(default_opt_flags)" \ + cd MPI1/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPI1/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" \ "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" allampi: - cd AMPI/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd AMPI/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(default_opt_flags)" \ + cd AMPI/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd AMPI/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" \ "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" allfgmpi: cd scripts/small; $(MAKE) -f Makefile_FG_MPI runfgmpi cd scripts/wide; $(MAKE) -f Makefile_FG_MPI runfgmpi - cd FG_MPI/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd FG_MPI/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(default_opt_flags)" \ + cd FG_MPI/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd FG_MPI/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" \ "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" allmpiopenmp: - cd MPIOPENMP/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPIOPENMP/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPIOPENMP/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPIOPENMP/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd MPIOPENMP/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPIOPENMP/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPIOPENMP/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPIOPENMP/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allmpiomp: allmpiopenmp allmpirma: - cd MPIRMA/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPIRMA/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPIRMA/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd MPIRMA/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPIRMA/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPIRMA/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allshmem: - cd SHMEM/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SHMEM/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SHMEM/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd SHMEM/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SHMEM/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SHMEM/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allmpishm: - cd MPISHM/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPISHM/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd MPISHM/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd MPISHM/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPISHM/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd MPISHM/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allmpi: allmpi1 allmpiomp allmpirma allmpishm allupc: - cd UPC/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd UPC/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd UPC/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd UPC/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd UPC/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd UPC/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allpgas: allshmem allupc allmpirma allopenmp: - cd OPENMP/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/RefCount_shared; $(MAKE) shared "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/RefCount_private; $(MAKE) private "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd OPENMP/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(default_opt_flags)" \ + cd OPENMP/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/RefCount_shared; $(MAKE) shared "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/RefCount_private; $(MAKE) private "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd OPENMP/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" \ "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" allcharm++: - cd CHARM++/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd CHARM++/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd CHARM++/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd CHARM++/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd CHARM++/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd CHARM++/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allgrappa: - cd GRAPPA/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd GRAPPA/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd GRAPPA/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" + cd GRAPPA/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd GRAPPA/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd GRAPPA/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" allserial: - cd SERIAL/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(default_opt_flags)" - cd SERIAL/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(default_opt_flags)" \ + cd SERIAL/DGEMM; $(MAKE) dgemm "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Nstream; $(MAKE) nstream "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Reduce; $(MAKE) reduce "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Random; $(MAKE) random "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Sparse; $(MAKE) sparse "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" + cd SERIAL/Branch; $(MAKE) branch "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" \ "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" From 1ba6b11901f42cb116e31bcdeac99b636a3b5d99 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 22:06:51 -0800 Subject: [PATCH 14/51] turn on OCD compiler flags --- .travis.yml | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a0189c54..b059d7300 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,23 +95,23 @@ addons: #- clang-3.8 env: # Order by likelihood of failing... - - PRK_TARGET=allupc - UPC_IMPL=bupc - GASNET_CONDUIT=mpi - - PRK_TARGET=allupc - UPC_IMPL=bupc - GASNET_CONDUIT=ofi - - PRK_TARGET=allupc - UPC_IMPL=bupc - GASNET_CONDUIT=smp - - PRK_TARGET=allupc - UPC_IMPL=bupc - GASNET_CONDUIT=udp - - PRK_TARGET=allupc - UPC_IMPL=gupc - - PRK_TARGET=allampi - - PRK_TARGET=allcharm++ - - PRK_TARGET=allfgmpi +# - PRK_TARGET=allupc +# UPC_IMPL=bupc +# GASNET_CONDUIT=mpi +# - PRK_TARGET=allupc +# UPC_IMPL=bupc +# GASNET_CONDUIT=ofi +# - PRK_TARGET=allupc +# UPC_IMPL=bupc +# GASNET_CONDUIT=smp +# - PRK_TARGET=allupc +# UPC_IMPL=bupc +# GASNET_CONDUIT=udp +# - PRK_TARGET=allupc +# UPC_IMPL=gupc +# - PRK_TARGET=allampi +# - PRK_TARGET=allcharm++ +# - PRK_TARGET=allfgmpi - PRK_TARGET=allshmem - PRK_TARGET=allmpirma - PRK_TARGET=allmpishm @@ -138,6 +138,8 @@ install: before_script: - pwd script: + # This is going to cause most of our tests to fail! + - export PRK_FLAGS="-O3 -Wall -Wextra -Wformat -Werror -pedantic -std=c11" - sh ./travis/build-run-prk.sh $TRAVIS_ROOT $PRK_TARGET after_failure: - echo "Sad panda" From 8c77e22b762c8cc42203d8acb4463950b2109fae Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Thu, 14 Jan 2016 22:09:51 -0800 Subject: [PATCH 15/51] drop down to C99 since C11 not supported by Travis compilers --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b059d7300..d696fa8bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -139,7 +139,7 @@ before_script: - pwd script: # This is going to cause most of our tests to fail! - - export PRK_FLAGS="-O3 -Wall -Wextra -Wformat -Werror -pedantic -std=c11" + - export PRK_FLAGS="-O3 -Wall -Wextra -Wformat -Werror -pedantic -std=c99" - sh ./travis/build-run-prk.sh $TRAVIS_ROOT $PRK_TARGET after_failure: - echo "Sad panda" From d6138b7af31117be40bced1d460b9a89760f58ca Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 05:42:01 -0800 Subject: [PATCH 16/51] fix more Wformat [ci skip] --- OPENMP/RefCount_shared/shared.c | 2 +- OPENMP/Stencil/stencil.c | 6 +++--- OPENMP/Transpose/transpose.c | 2 +- SERIAL/Synch_p2p/p2p.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OPENMP/RefCount_shared/shared.c b/OPENMP/RefCount_shared/shared.c index 3864c6761..3958c60e3 100644 --- a/OPENMP/RefCount_shared/shared.c +++ b/OPENMP/RefCount_shared/shared.c @@ -123,7 +123,7 @@ int main(int argc, char ** argv) iterations = atol(*++argv); if (iterations < 1){ - printf("ERROR: iterations must be >= 1 : %d \n",iterations); + printf("ERROR: iterations must be >= 1 : %ld \n",iterations); exit(EXIT_FAILURE); } diff --git a/OPENMP/Stencil/stencil.c b/OPENMP/Stencil/stencil.c index 57875e0a8..1ac87e3d4 100755 --- a/OPENMP/Stencil/stencil.c +++ b/OPENMP/Stencil/stencil.c @@ -136,7 +136,7 @@ int main(int argc, char ** argv) { n = atol(*++argv); if (n < 1){ - printf("ERROR: grid dimension must be positive: %d\n", n); + printf("ERROR: grid dimension must be positive: %ld\n", n); exit(EXIT_FAILURE); } @@ -146,7 +146,7 @@ int main(int argc, char ** argv) { } if (2*RADIUS +1 > n) { - printf("ERROR: Stencil radius %d exceeds grid size %d\n", RADIUS, n); + printf("ERROR: Stencil radius %d exceeds grid size %ld\n", RADIUS, n); exit(EXIT_FAILURE); } @@ -202,7 +202,7 @@ int main(int argc, char ** argv) { } else { printf("Number of threads = %d\n",nthread_input); - printf("Grid size = %d\n", n); + printf("Grid size = %ld\n", n); printf("Radius of stencil = %d\n", RADIUS); printf("Number of iterations = %d\n", iterations); #ifdef STAR diff --git a/OPENMP/Transpose/transpose.c b/OPENMP/Transpose/transpose.c index e12c25871..de634cb13 100755 --- a/OPENMP/Transpose/transpose.c +++ b/OPENMP/Transpose/transpose.c @@ -122,7 +122,7 @@ int main(int argc, char ** argv) { order = atoi(*++argv); if (order < 0){ - printf("ERROR: Matrix Order must be greater than 0 : %d \n", order); + printf("ERROR: Matrix Order must be greater than 0 : %ld \n", order); exit(EXIT_FAILURE); } diff --git a/SERIAL/Synch_p2p/p2p.c b/SERIAL/Synch_p2p/p2p.c index 05ec170e9..1625e4525 100755 --- a/SERIAL/Synch_p2p/p2p.c +++ b/SERIAL/Synch_p2p/p2p.c @@ -142,7 +142,7 @@ int main(int argc, char ** argv) { /* verify correctness, using top right value; */ corner_val = (double)((iterations+1)*(n+m-2)); - if (abs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { + if (fabs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(m-1,n-1), corner_val); exit(EXIT_FAILURE); From 86855f0d3b716ca02af6a47e4b8161ee90cebfa3 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 10:15:47 -0800 Subject: [PATCH 17/51] reorder make targets in order of success likelihood; rename charm++ to charm internally since ++ messes up syntax highlighting --- Makefile | 92 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index f3514c65e..041c64fde 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ help: all: alldarwin allfreaks alldarwin: allserial allopenmp allmpi1 allfgmpi allmpiopenmp allmpirma allshmem allmpishm allupc -allfreaks: allcharm++ allampi allgrappa +allfreaks: allcharm allampi allgrappa allmpi1: cd MPI1/Synch_global; $(MAKE) global "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" @@ -165,7 +165,9 @@ allopenmp: "MATRIX_RANK = $(matrix_rank)" \ "NUMBER_OF_FUNCTIONS = $(number_of_functions)" -allcharm++: +allcharm++: allcharm + +allcharm: cd CHARM++/Synch_p2p; $(MAKE) p2p "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" cd CHARM++/Stencil; $(MAKE) stencil "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" cd CHARM++/Transpose; $(MAKE) transpose "DEFAULT_OPT_FLAGS = $(PRK_FLAGS)" @@ -189,6 +191,27 @@ allserial: "NUMBER_OF_FUNCTIONS = $(number_of_functions)" clean: + cd SERIAL/DGEMM; $(MAKE) clean + cd SERIAL/Nstream; $(MAKE) clean + cd SERIAL/Reduce; $(MAKE) clean + cd SERIAL/Stencil; $(MAKE) clean + cd SERIAL/Transpose; $(MAKE) clean + cd SERIAL/Random; $(MAKE) clean + cd SERIAL/Sparse; $(MAKE) clean + cd SERIAL/Synch_p2p; $(MAKE) clean + cd SERIAL/Branch; $(MAKE) clean + cd OPENMP/DGEMM; $(MAKE) clean + cd OPENMP/Nstream; $(MAKE) clean + cd OPENMP/Reduce; $(MAKE) clean + cd OPENMP/RefCount_shared; $(MAKE) clean + cd OPENMP/RefCount_private; $(MAKE) clean + cd OPENMP/Stencil; $(MAKE) clean + cd OPENMP/Transpose; $(MAKE) clean + cd OPENMP/Random; $(MAKE) clean + cd OPENMP/Sparse; $(MAKE) clean + cd OPENMP/Synch_global; $(MAKE) clean + cd OPENMP/Synch_p2p; $(MAKE) clean + cd OPENMP/Branch; $(MAKE) clean cd MPI1/DGEMM; $(MAKE) clean cd MPI1/Nstream; $(MAKE) clean cd MPI1/Reduce; $(MAKE) clean @@ -199,6 +222,22 @@ clean: cd MPI1/Synch_global; $(MAKE) clean cd MPI1/Synch_p2p; $(MAKE) clean cd MPI1/Branch; $(MAKE) clean + cd MPIOPENMP/Nstream; $(MAKE) clean + cd MPIOPENMP/Stencil; $(MAKE) clean + cd MPIOPENMP/Transpose; $(MAKE) clean + cd MPIOPENMP/Synch_p2p; $(MAKE) clean + cd MPIRMA/Stencil; $(MAKE) clean + cd MPIRMA/Synch_p2p; $(MAKE) clean + cd MPIRMA/Transpose; $(MAKE) clean + cd MPISHM/Stencil; $(MAKE) clean + cd MPISHM/Synch_p2p; $(MAKE) clean + cd MPISHM/Transpose; $(MAKE) clean + cd SHMEM/Transpose; $(MAKE) clean + cd SHMEM/Stencil; $(MAKE) clean + cd SHMEM/Synch_p2p; $(MAKE) clean + cd UPC/Stencil; $(MAKE) clean + cd UPC/Transpose; $(MAKE) clean + cd UPC/Synch_p2p; $(MAKE) clean cd FG_MPI/DGEMM; $(MAKE) clean cd FG_MPI/Nstream; $(MAKE) clean cd FG_MPI/Reduce; $(MAKE) clean @@ -219,66 +258,29 @@ clean: cd AMPI/Synch_global; $(MAKE) clean cd AMPI/Synch_p2p; $(MAKE) clean cd AMPI/Branch; $(MAKE) clean - cd MPIRMA/Stencil; $(MAKE) clean - cd MPIRMA/Synch_p2p; $(MAKE) clean - cd MPIRMA/Transpose; $(MAKE) clean - cd UPC/Stencil; $(MAKE) clean - cd UPC/Transpose; $(MAKE) clean - cd UPC/Synch_p2p; $(MAKE) clean - cd MPISHM/Stencil; $(MAKE) clean - cd MPISHM/Synch_p2p; $(MAKE) clean - cd MPISHM/Transpose; $(MAKE) clean - cd SHMEM/Transpose; $(MAKE) clean - cd SHMEM/Stencil; $(MAKE) clean - cd SHMEM/Synch_p2p; $(MAKE) clean cd CHARM++/Stencil; $(MAKE) clean cd CHARM++/Synch_p2p; $(MAKE) clean cd CHARM++/Transpose; $(MAKE) clean cd GRAPPA/Synch_p2p; $(MAKE) clean cd GRAPPA/Stencil; $(MAKE) clean cd GRAPPA/Transpose; $(MAKE) clean - cd MPIOPENMP/Nstream; $(MAKE) clean - cd MPIOPENMP/Stencil; $(MAKE) clean - cd MPIOPENMP/Transpose; $(MAKE) clean - cd MPIOPENMP/Synch_p2p; $(MAKE) clean - cd OPENMP/DGEMM; $(MAKE) clean - cd OPENMP/Nstream; $(MAKE) clean - cd OPENMP/Reduce; $(MAKE) clean - cd OPENMP/RefCount_shared; $(MAKE) clean - cd OPENMP/RefCount_private; $(MAKE) clean - cd OPENMP/Stencil; $(MAKE) clean - cd OPENMP/Transpose; $(MAKE) clean - cd OPENMP/Random; $(MAKE) clean - cd OPENMP/Sparse; $(MAKE) clean - cd OPENMP/Synch_global; $(MAKE) clean - cd OPENMP/Synch_p2p; $(MAKE) clean - cd OPENMP/Branch; $(MAKE) clean - cd SERIAL/DGEMM; $(MAKE) clean - cd SERIAL/Nstream; $(MAKE) clean - cd SERIAL/Reduce; $(MAKE) clean - cd SERIAL/Stencil; $(MAKE) clean - cd SERIAL/Transpose; $(MAKE) clean - cd SERIAL/Random; $(MAKE) clean - cd SERIAL/Sparse; $(MAKE) clean - cd SERIAL/Synch_p2p; $(MAKE) clean - cd SERIAL/Branch; $(MAKE) clean rm -f stats.json veryclean: clean - cd MPI1/Branch; $(MAKE) veryclean - cd OPENMP/Branch; $(MAKE) veryclean cd SERIAL/Branch; $(MAKE) veryclean - cd MPI1/Stencil; $(MAKE) veryclean - cd OPENMP/Stencil; $(MAKE) veryclean cd SERIAL/Stencil; $(MAKE) veryclean + cd OPENMP/Branch; $(MAKE) veryclean + cd OPENMP/Stencil; $(MAKE) veryclean + cd MPI1/Branch; $(MAKE) veryclean + cd MPI1/Stencil; $(MAKE) veryclean + cd MPIOPENMP/Stencil; $(MAKE) veryclean cd MPIRMA/Stencil; $(MAKE) veryclean cd MPISHM/Stencil; $(MAKE) veryclean cd SHMEM/Stencil; $(MAKE) veryclean + cd UPC/Stencil; $(MAKE) veryclean cd FG_MPI/Stencil; $(MAKE) veryclean - cd MPIOPENMP/Stencil; $(MAKE) veryclean cd GRAPPA/Stencil; $(MAKE) veryclean cd CHARM++/Stencil; $(MAKE) veryclean - cd UPC/Stencil; $(MAKE) veryclean cd FG_MPI/Branch; $(MAKE) veryclean cd AMPI/Branch; $(MAKE) veryclean cd scripts/small; $(MAKE) -f Makefile_FG_MPI veryclean From e3ba0aa313fec4bbb808e07d23d16f6239611c8b Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 10:20:48 -0800 Subject: [PATCH 18/51] fix format warnings --- OPENMP/Sparse/sparse.c | 6 +++--- OPENMP/Synch_global/global.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OPENMP/Sparse/sparse.c b/OPENMP/Sparse/sparse.c index bb7185aad..61a9322a2 100755 --- a/OPENMP/Sparse/sparse.c +++ b/OPENMP/Sparse/sparse.c @@ -176,7 +176,7 @@ int main(int argc, char **argv){ matrix_space = nent*sizeof(double); if (matrix_space/sizeof(double) != nent) { - printf("ERROR: Cannot represent space for matrix: %ul\n", matrix_space); + printf("ERROR: Cannot represent space for matrix: %lu\n", matrix_space); exit(EXIT_FAILURE); } @@ -188,7 +188,7 @@ int main(int argc, char **argv){ vector_space = 2*size2*sizeof(double); if (vector_space/sizeof(double) != 2*size2) { - printf("ERROR: Cannot represent space for vectors: %ul\n", vector_space); + printf("ERROR: Cannot represent space for vectors: %lu\n", vector_space); exit(EXIT_FAILURE); } @@ -201,7 +201,7 @@ int main(int argc, char **argv){ index_space = nent*sizeof(s64Int); if (index_space/sizeof(s64Int) != nent) { - printf("ERROR: Cannot represent space for column indices: %ul\n", index_space); + printf("ERROR: Cannot represent space for column indices: %lu\n", index_space); exit(EXIT_FAILURE); } colIndex = (s64Int *) malloc(index_space); diff --git a/OPENMP/Synch_global/global.c b/OPENMP/Synch_global/global.c index 7f4c36244..894d418bf 100755 --- a/OPENMP/Synch_global/global.c +++ b/OPENMP/Synch_global/global.c @@ -128,7 +128,7 @@ int main(int argc, char ** argv) length = atol(*++argv); if (length Date: Fri, 15 Jan 2016 10:26:08 -0800 Subject: [PATCH 19/51] size_t is %zu --- MPI1/Random/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MPI1/Random/random.c b/MPI1/Random/random.c index 9aa9539b1..452138ed1 100644 --- a/MPI1/Random/random.c +++ b/MPI1/Random/random.c @@ -194,7 +194,7 @@ int main(int argc, char **argv) { #ifdef LONG_IS_64BITS if (sizeof(long) != 8) { - printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %d bytes\n", + printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %zu bytes\n", sizeof(long)); exit(EXIT_FAILURE); } From ae4c54dea43613ae7776d1c39cddea03beb869dd Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 10:26:34 -0800 Subject: [PATCH 20/51] long long int is %lld, although %ll may be valid too --- include/par-res-kern_general.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/par-res-kern_general.h b/include/par-res-kern_general.h index 5f3b9f048..8a0d0316b 100755 --- a/include/par-res-kern_general.h +++ b/include/par-res-kern_general.h @@ -62,7 +62,7 @@ POSSIBILITY OF SUCH DAMAGE. #else typedef unsigned long long u64Int; typedef long long s64Int; - #define FSTR64 "%16ll" + #define FSTR64 "%16lld" #define FSTR64U "%16llu" #endif From 6bb2bfbfa279be9ea286e3ee11d25161b9635b30 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 10:26:42 -0800 Subject: [PATCH 21/51] format fix --- OPENMP/Synch_p2p/p2p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OPENMP/Synch_p2p/p2p.c b/OPENMP/Synch_p2p/p2p.c index b6d9231d0..6fb556a80 100755 --- a/OPENMP/Synch_p2p/p2p.c +++ b/OPENMP/Synch_p2p/p2p.c @@ -148,7 +148,7 @@ int main(int argc, char ** argv) { } if (m Date: Fri, 15 Jan 2016 10:29:09 -0800 Subject: [PATCH 22/51] format fix --- MPIOPENMP/Stencil/stencil.c | 2 +- MPIOPENMP/Synch_p2p/p2p.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MPIOPENMP/Stencil/stencil.c b/MPIOPENMP/Stencil/stencil.c index 61833163e..fcd5a9c44 100644 --- a/MPIOPENMP/Stencil/stencil.c +++ b/MPIOPENMP/Stencil/stencil.c @@ -186,7 +186,7 @@ int main(int argc, char ** argv) { n = atoi(*++argv); nsquare = n * n; if (nsquare < Num_procs){ - printf("ERROR: grid size %d must be at least # ranks: %ld\n", + printf("ERROR: grid size %ld must be at least # ranks: %d\n", nsquare, Num_procs); error = 1; goto ENDOFTESTS; diff --git a/MPIOPENMP/Synch_p2p/p2p.c b/MPIOPENMP/Synch_p2p/p2p.c index f921a89c6..5eea3c758 100755 --- a/MPIOPENMP/Synch_p2p/p2p.c +++ b/MPIOPENMP/Synch_p2p/p2p.c @@ -113,7 +113,7 @@ int main(int argc, char ** argv) } if (requested Date: Fri, 15 Jan 2016 10:29:50 -0800 Subject: [PATCH 23/51] protect developer pragma warning --- MPIRMA/Synch_p2p/p2p.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MPIRMA/Synch_p2p/p2p.c b/MPIRMA/Synch_p2p/p2p.c index e444df26a..3a1ec610f 100755 --- a/MPIRMA/Synch_p2p/p2p.c +++ b/MPIRMA/Synch_p2p/p2p.c @@ -188,8 +188,10 @@ int main(int argc, char ** argv) vector = (double *) malloc(total_length*sizeof(double)); MPI_Win_create(vector, total_length*sizeof(double), sizeof(double), rma_winfo, MPI_COMM_WORLD, &rma_win); +#ifdef PRK_DEBUG #warning Why are we not using MPI_Win_allocate here? #warning If this is a shared-memory bug, then we need to fix the bug. +#endif /* MPI_Win_allocate(total_length*sizeof(double), sizeof(double), rma_winfo, MPI_COMM_WORLD, (void *) &vector, &rma_win); */ if (vector == NULL) { printf("Could not allocate space for grid slice of %ld by %ld points", From 92172aca7cdb4dfd56aa19547843dcd91715da93 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 10:53:23 -0800 Subject: [PATCH 24/51] format fixes --- Makefile | 2 +- OPENMP/Random/random.c | 2 +- SERIAL/Random/random.c | 2 +- SERIAL/Sparse/sparse.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 041c64fde..ee5a7752b 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ ifndef PRK_FLAGS PRK_FLAGS=-O3 endif -default: allserial allopenmp allmpi +default: allserial allopenmp allmpi allshmem help: @echo "Usage: \"make all\" (re-)builds all targets" diff --git a/OPENMP/Random/random.c b/OPENMP/Random/random.c index cc3d646f8..a57abdf1b 100644 --- a/OPENMP/Random/random.c +++ b/OPENMP/Random/random.c @@ -210,7 +210,7 @@ int main(int argc, char **argv) { #ifdef LONG_IS_64BITS if (sizeof(long) != 8) { - printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %d bytes\n", + printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %zu bytes\n", sizeof(long)); exit(EXIT_FAILURE); } diff --git a/SERIAL/Random/random.c b/SERIAL/Random/random.c index 72015b8d6..bf8f0680d 100644 --- a/SERIAL/Random/random.c +++ b/SERIAL/Random/random.c @@ -185,7 +185,7 @@ int main(int argc, char **argv) { #ifdef LONG_IS_64BITS if (sizeof(long) != 8) { - printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %d bytes\n", + printf("ERROR: Makefile says \"long\" is 8 bytes, but it is %zu bytes\n", sizeof(long)); exit(EXIT_FAILURE); } diff --git a/SERIAL/Sparse/sparse.c b/SERIAL/Sparse/sparse.c index 4b794a5c1..60c988424 100755 --- a/SERIAL/Sparse/sparse.c +++ b/SERIAL/Sparse/sparse.c @@ -146,7 +146,7 @@ int main(int argc, char **argv){ /* emit error if (periodic) stencil overlaps with itself */ if (size <2*radius+1) { - printf("ERROR: Grid extent %lld smaller than stencil diameter 2*%lld+1= %lld\n", + printf("ERROR: Grid extent " FSTR64 " smaller than stencil diameter 2*" FSTR64 "+1= " FSTR64 "\n", size, radius, radius*2+1); exit(EXIT_FAILURE); } @@ -162,7 +162,7 @@ int main(int argc, char **argv){ matrix_space = nent*sizeof(double); matrix = (double *) malloc(matrix_space); if (!matrix) { - printf("ERROR: Could not allocate space for sparse matrix: %lld\n", nent); + printf("ERROR: Could not allocate space for sparse matrix: " FSTR64 "\n", nent); exit(EXIT_FAILURE); } @@ -192,7 +192,7 @@ int main(int argc, char **argv){ } printf("Matrix order = "FSTR64U"\n", size2); - printf("Stencil diameter = %16lld\n", 2*radius+1); + printf("Stencil diameter = " FSTR64 "\n", 2*radius+1); printf("Sparsity = %16.10lf\n", sparsity); printf("Number of iterations = %16d\n", iterations); #ifdef SCRAMBLE From 18e40b406d9f018810b37b6ef342c344afcc8db1 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:01:13 -0800 Subject: [PATCH 25/51] dos2unix and compiler warning silencing --- common/SHMEM_bail_out.c | 154 +++++++++++++++++++++------------------- 1 file changed, 79 insertions(+), 75 deletions(-) diff --git a/common/SHMEM_bail_out.c b/common/SHMEM_bail_out.c index 8e18f34f8..6f2dfebb7 100644 --- a/common/SHMEM_bail_out.c +++ b/common/SHMEM_bail_out.c @@ -1,75 +1,79 @@ -/* -Copyright (c) 2013, Intel Corporation - -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. -* Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -/******************************************************************* - -NAME: bail_out - -PURPOSE: Exit gracefully when an SHMEM process has encountered an error - -Arguments: error code, work space - -Returns: nothing, but the program terminates with a nonzero exit status - -Notes: This function must be called by all participating processes - -HISTORY: - Written by Gabriele Jost, March 2015. - -**********************************************************************************/ - -#include -#include - -void bail_out (int error) { - long *global_error; - long *local_error; - long *pWrk; - long *pSync_local; - - int i; - global_error = prk_shmem_malloc(sizeof(long)); - local_error = prk_shmem_malloc(sizeof(long)); - pWrk = prk_shmem_malloc(sizeof(long)*PRK_SHMEM_BCAST_SYNC_SIZE); - pSync_local = prk_shmem_malloc(sizeof(long)*PRK_SHMEM_BCAST_SYNC_SIZE); - for (i = 0; i < PRK_SHMEM_BCAST_SYNC_SIZE; i += 1) { - pSync_local[i] = PRK_SHMEM_SYNC_VALUE; - } - local_error [0] = error; - shmem_barrier_all (); - shmem_long_max_to_all (global_error, local_error, 1, 0, 0, prk_shmem_n_pes(), pWrk, pSync_local); - if (global_error [0] > 0) { - prk_shmem_finalize (); - exit (1); - } - return; -} - +/* +Copyright (c) 2013, Intel Corporation + +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. +* Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +/******************************************************************* + +NAME: bail_out + +PURPOSE: Exit gracefully when an SHMEM process has encountered an error + +Arguments: error code, work space + +Returns: nothing, but the program terminates with a nonzero exit status + +Notes: This function must be called by all participating processes + +HISTORY: - Written by Gabriele Jost, March 2015. + +**********************************************************************************/ + +#include +#include + +void bail_out (int error) { + long *global_error; + long *local_error; + long *pWrk; + long *pSync_local; + + int i; + global_error = prk_shmem_malloc(sizeof(long)); + local_error = prk_shmem_malloc(sizeof(long)); + pWrk = prk_shmem_malloc(sizeof(long)*PRK_SHMEM_BCAST_SYNC_SIZE); + pSync_local = prk_shmem_malloc(sizeof(long)*PRK_SHMEM_BCAST_SYNC_SIZE); + for (i = 0; i < PRK_SHMEM_BCAST_SYNC_SIZE; i += 1) { + pSync_local[i] = PRK_SHMEM_SYNC_VALUE; + } + local_error [0] = error; + shmem_barrier_all (); + shmem_long_max_to_all (global_error, local_error, 1, 0, 0, prk_shmem_n_pes(), pWrk, pSync_local); + if (global_error [0] > 0) { + prk_shmem_finalize (); + exit (1); + } + return; + + /* silence -Wunused-functions until PRK SHMEM wrappers are properly refactored out of header */ + prk_shmem_init(); + prk_shmem_my_pe(); + prk_shmem_free(NULL); +} From 62f2714b336a4d23ec0d80f7bdd8b9b308f04309 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:01:23 -0800 Subject: [PATCH 26/51] silence compiler warnings --- SHMEM/Synch_p2p/p2p.c | 11 +++++++---- include/par-res-kern_shmem.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/SHMEM/Synch_p2p/p2p.c b/SHMEM/Synch_p2p/p2p.c index 858087a6f..11ef1fd16 100644 --- a/SHMEM/Synch_p2p/p2p.c +++ b/SHMEM/Synch_p2p/p2p.c @@ -75,7 +75,7 @@ int main(int argc, char ** argv) { int my_ID; /* SHMEM thread ID */ int root; /* ID of master rank */ - long m, n; /* grid dimensions */ + long m=0, n=0; /* grid dimensions */ double *pipeline_time, /* timing parameters */ *local_pipeline_time, avgtime; double epsilon = 1.e-8; /* error tolerance */ @@ -136,7 +136,7 @@ int main(int argc, char ** argv) n = atol(*++argv); if (m < 1 || n < 1){ if (my_ID == root) - printf("ERROR: grid dimensions must be positive: %d, %d \n", m, n); + printf("ERROR: grid dimensions must be positive: %ld, %ld \n", m, n); error = 1; goto ENDOFTESTS; } @@ -155,7 +155,7 @@ int main(int argc, char ** argv) if (m<=Num_procs) { if (my_ID == root) - printf("ERROR: First grid dimension %d must be > #ranks %ld\n", m, Num_procs); + printf("ERROR: First grid dimension %ld must be > #ranks %d\n", m, Num_procs); error = 1; } ENDOFTESTS:; @@ -327,7 +327,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == root) { - if (abs(ARRAY(end[my_ID],n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end[my_ID],n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end[my_ID],n-1), corner_val); error = 1; @@ -348,6 +348,9 @@ int main(int argc, char ** argv) 1.0E-06 * 2 * ((double)((m-1)*(n-1)))/avgtime, avgtime); } + prk_shmem_free(pSync); + prk_shmem_free(pWrk); + prk_shmem_finalize(); exit(EXIT_SUCCESS); diff --git a/include/par-res-kern_shmem.h b/include/par-res-kern_shmem.h index 8f2d7704f..4cf5a1f6c 100644 --- a/include/par-res-kern_shmem.h +++ b/include/par-res-kern_shmem.h @@ -90,6 +90,7 @@ static void * prk_shmem_malloc(size_t n) { #endif } +#if UNUSED static void * prk_shmem_realloc(void *ptr, size_t size) { #ifdef PRK_HAVE_OPENSHMEM_1_2 return shmem_realloc(ptr,size); @@ -106,6 +107,7 @@ static void * prk_shmem_align(size_t alignment, size_t size) { return shmalloc(size); #endif } +#endif static void prk_shmem_free(void * ptr) { #ifdef PRK_HAVE_OPENSHMEM_1_2 From 1b9794f4b2d8be7dfd5b4d478c82a831dfb3074d Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:08:12 -0800 Subject: [PATCH 27/51] silence compiler warnings --- SHMEM/Stencil/stencil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SHMEM/Stencil/stencil.c b/SHMEM/Stencil/stencil.c index db6007f0e..13d9c4ba3 100644 --- a/SHMEM/Stencil/stencil.c +++ b/SHMEM/Stencil/stencil.c @@ -87,7 +87,7 @@ HISTORY: - Written by Tom St. John, July 2015. int main(int argc, char ** argv) { int Num_procs; /* number of ranks */ - int Num_procsx, Num_procsy; /* number of ranks in each coord direction */ + int Num_procsx=0, Num_procsy=0; /* number of ranks in each coord direction */ int my_ID; /* SHMEM rank */ int my_IDx, my_IDy; /* coordinates of rank in rank grid */ int right_nbr; /* global rank of right neighboring tile */ @@ -104,7 +104,7 @@ int main(int argc, char ** argv) { DTYPE *left_buf_in[2]; /* " " */ int root = 0; int n, width, height;/* linear global and local grid dimension */ - int i, j, ii, jj, kk, it, jt, iter, leftover; /* dummies */ + int i, j, ii, jj, kk, iter, leftover; /* dummies */ int istart, iend; /* bounds of grid tile assigned to calling rank */ int jstart, jend; /* bounds of grid tile assigned to calling rank */ DTYPE reference_norm; @@ -367,7 +367,7 @@ int main(int argc, char ** argv) { bottom_buf_out = top_buf_out+RADIUS*width; top_buf_in[0]=(DTYPE*)prk_shmem_malloc(4*sizeof(DTYPE)*RADIUS*width); - if(!top_buf_in) + if(!(top_buf_in[0])) { printf("ERROR: Rank %d could not allocate input comm buffers for y-direction\n", my_ID); error=1; @@ -386,7 +386,7 @@ int main(int argc, char ** argv) { left_buf_out=right_buf_out+RADIUS*height; right_buf_in[0]=(DTYPE*)prk_shmem_malloc(4*sizeof(DTYPE)*RADIUS*height); - if(!right_buf_in) + if(!(right_buf_in[0])) { printf("ERROR: Rank %d could not allocate input comm buffers for x-dimension\n", my_ID); error=1; From 8e732a5ee936368b411e8e64db76163a45fc23a7 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:17:57 -0800 Subject: [PATCH 28/51] remove unused status --- MPIRMA/Synch_p2p/p2p.c | 1 - 1 file changed, 1 deletion(-) diff --git a/MPIRMA/Synch_p2p/p2p.c b/MPIRMA/Synch_p2p/p2p.c index 3a1ec610f..cfdc02cae 100755 --- a/MPIRMA/Synch_p2p/p2p.c +++ b/MPIRMA/Synch_p2p/p2p.c @@ -88,7 +88,6 @@ int main(int argc, char ** argv) int Num_procs; /* Number of ranks */ double *vector; /* array holding grid values */ long total_length; /* total required length to store grid values */ - MPI_Status status; /* completion status of message */ MPI_Win rma_win; /* RMA window object */ MPI_Info rma_winfo; /* info for window */ MPI_Group world_group, origin_group, target_group; From 1955fded1e17c1974f47f3cf67d23a369c855366 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:19:01 -0800 Subject: [PATCH 29/51] remove unused variables --- MPIRMA/Stencil/stencil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MPIRMA/Stencil/stencil.c b/MPIRMA/Stencil/stencil.c index 1fefed85a..a27b1de8d 100755 --- a/MPIRMA/Stencil/stencil.c +++ b/MPIRMA/Stencil/stencil.c @@ -115,7 +115,7 @@ int main(int argc, char ** argv) { DTYPE *left_buf_in; /* " " */ int root = 0; int n, width, height;/* linear global and local grid dimension */ - int i, j, ii, jj, kk, it, jt, iter, leftover; /* dummies */ + int i, j, ii, jj, kk, iter, leftover; /* dummies */ int istart, iend; /* bounds of grid tile assigned to calling rank */ int jstart, jend; /* bounds of grid tile assigned to calling rank */ DTYPE norm, /* L1 norm of solution */ From 123c2274c5013f67bd8c45af5fbe838c3e187676 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:25:54 -0800 Subject: [PATCH 30/51] protect sometimes unused variables --- OPENMP/RefCount_shared/shared.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OPENMP/RefCount_shared/shared.c b/OPENMP/RefCount_shared/shared.c index 3958c60e3..e511101b7 100644 --- a/OPENMP/RefCount_shared/shared.c +++ b/OPENMP/RefCount_shared/shared.c @@ -89,11 +89,15 @@ int main(int argc, char ** argv) { long iterations; /* total number of reference pair counter updates */ long stream_size; /* length of stream triad creating private work */ +#ifdef VERBOSE int page_fit; /* indicates that counters fit on different pages */ +#endif size_t store_size; /* amount of space reserved for counters */ double *pcounter1, *pcounter2; /* pointers to counters */ +#ifdef DEPENDENT double cosa, sina; /* cosine and sine of rotation angle */ +#endif double *counter_space; /* pointer to space reserved for counters */ double refcounter1, refcounter2; /* reference values for counters */ @@ -138,14 +142,18 @@ int main(int argc, char ** argv) /* initialize shared counters; we put them on different pages, if possible. If the page size equals the whole memory, this will fail, and we reduce the space required */ +#ifdef VERBOSE page_fit = 1; +#endif store_size = (size_t) getpagesize(); #ifdef VERBOSE printf("Page size = %d\n", getpagesize()); #endif counter_space = (double *) malloc(store_size+sizeof(double)); while (!counter_space && store_size>2*sizeof(double)) { +#ifdef VERBOSE page_fit=0; +#endif store_size/=2; counter_space = (double *) malloc(store_size+sizeof(double)); @@ -166,8 +174,10 @@ int main(int argc, char ** argv) COUNTER1 = 1.0; COUNTER2 = 0.0; +#ifdef DEPENDENT cosa = cos(1.0); sina = sin(1.0); +#endif /* initialize the lock on which we will be pounding */ omp_init_lock(&counter_lock); @@ -175,7 +185,9 @@ int main(int argc, char ** argv) #pragma omp parallel { long iter, j; /* dummies */ +#ifdef DEPENDENT double tmp1; /* local copy of previous value of COUNTER1 */ +#endif double *a, *b, *c;/* private vectors */ int num_error=0;/* errors in private stream execution */ double aj, bj, cj; From 1ef29ab6dfbb19aff7485e5211226eda71d8c66d Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:31:43 -0800 Subject: [PATCH 31/51] silence unused; use C99 in OPENMP/RefCount_private/private.c --- OPENMP/RefCount_private/private.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/OPENMP/RefCount_private/private.c b/OPENMP/RefCount_private/private.c index 90a33208e..d154b9465 100755 --- a/OPENMP/RefCount_private/private.c +++ b/OPENMP/RefCount_private/private.c @@ -71,8 +71,10 @@ HISTORY: Written by Rob Van der Wijngaart, January 2006. int main(int argc, char ** argv) { int iterations; /* number of reference counter updates per thread */ - int iter, thread; + int thread; +#ifdef VERBOSE int line_fit; /* indicates that elements fit on different lines */ +#endif s64Int alloc_unit; /* amount of space reserved per element */ s64Int **pcounter1, **pcounter2; /* pointers to pointers to space for counters */ @@ -123,15 +125,19 @@ int main(int argc, char ** argv) } /* we try to put counter locks on different cache lines */ +#ifdef VERBOSE line_fit = 1; +#endif if (sizeof(omp_lock_t) > LINE_LENGTH) alloc_unit = (sizeof(omp_lock_t)/LINE_LENGTH+1)*LINE_LENGTH; else alloc_unit = LINE_LENGTH; lock_space = (omp_lock_t *) malloc(2*nthread_input*alloc_unit); - while (!lock_space && alloc_unit >= 2*sizeof(s64Int)) { + while (!lock_space && alloc_unit >= (s64Int)(2*sizeof(s64Int))) { +#ifdef VERBOSE line_fit = 0; +#endif alloc_unit/=2; lock_space = (omp_lock_t *)malloc(2*nthread_input*alloc_unit); } @@ -153,14 +159,18 @@ int main(int argc, char ** argv) exit(EXIT_FAILURE); } +#ifdef VERBOSE line_fit = 1; +#endif if (sizeof(s64Int) > LINE_LENGTH) alloc_unit = (sizeof(s64Int)/LINE_LENGTH+1)*LINE_LENGTH; else alloc_unit = LINE_LENGTH; counter_space = malloc(2*nthread_input*alloc_unit); - while (!counter_space && alloc_unit >= 2*sizeof(s64Int)) { + while (!counter_space && alloc_unit >= (s64Int)(2*sizeof(s64Int))) { +#ifdef VERBOSE line_fit = 0; +#endif alloc_unit/=2; counter_space = malloc(2*nthread_input*alloc_unit); } @@ -178,7 +188,6 @@ int main(int argc, char ** argv) { int my_ID; /* Thread ID */ - int iter; /* dummy */ my_ID = omp_get_thread_num(); @@ -220,7 +229,7 @@ int main(int argc, char ** argv) } #pragma omp for - for (iter=0; iter Date: Fri, 15 Jan 2016 11:33:09 -0800 Subject: [PATCH 32/51] unused variable fixing --- OPENMP/Stencil/stencil.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OPENMP/Stencil/stencil.c b/OPENMP/Stencil/stencil.c index 1ac87e3d4..1d765c94b 100755 --- a/OPENMP/Stencil/stencil.c +++ b/OPENMP/Stencil/stencil.c @@ -86,7 +86,7 @@ HISTORY: - Written by Rob Van der Wijngaart, November 2006. int main(int argc, char ** argv) { long n; /* linear grid dimension */ - int i, j, ii, jj, it, jt, iter; /* dummies */ + int i, j, ii, jj, iter; /* dummies */ DTYPE norm, /* L1 norm of solution */ reference_norm; DTYPE f_active_points; /* interior of grid with respect to stencil */ @@ -187,7 +187,7 @@ int main(int argc, char ** argv) { norm = (DTYPE) 0.0; f_active_points = (DTYPE) (n-2*RADIUS)*(DTYPE) (n-2*RADIUS); - #pragma omp parallel private(i, j, ii, jj, it, jt, iter) + #pragma omp parallel private(i, j, ii, jj, iter) { #pragma omp master @@ -233,6 +233,8 @@ int main(int argc, char ** argv) { } #endif + stencil_time = 0.0; /* silence compiler warning */ + /* intialize the input and output arrays */ #ifdef PARALLELFOR #pragma omp parallel for private(i) From c359d732d171f74dbf9994aaa53586b5d27758fe Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 11:34:49 -0800 Subject: [PATCH 33/51] fix compiler warnings --- OPENMP/Random/random.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/OPENMP/Random/random.c b/OPENMP/Random/random.c index a57abdf1b..eb1d53b56 100644 --- a/OPENMP/Random/random.c +++ b/OPENMP/Random/random.c @@ -179,7 +179,17 @@ HISTORY: Written by Rob Van der Wijngaart, June 2006. #endif static u64Int PRK_starts(s64Int); -static int poweroftwo(int); + +#ifdef UNUSED +/* utility routine that tests whether an integer is a power of two */ +static int poweroftwo(int n) { + int log2n = 0; + + while ((1< Date: Fri, 15 Jan 2016 11:35:24 -0800 Subject: [PATCH 34/51] fix compiler warnings --- OPENMP/Sparse/sparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OPENMP/Sparse/sparse.c b/OPENMP/Sparse/sparse.c index 61a9322a2..0ebecbe45 100755 --- a/OPENMP/Sparse/sparse.c +++ b/OPENMP/Sparse/sparse.c @@ -282,7 +282,9 @@ int main(int argc, char **argv){ #pragma omp for for (row=0; row Date: Fri, 15 Jan 2016 11:37:12 -0800 Subject: [PATCH 35/51] silence more compiler warnings --- OPENMP/Sparse/sparse.c | 6 +++--- OPENMP/Synch_global/global.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OPENMP/Sparse/sparse.c b/OPENMP/Sparse/sparse.c index 0ebecbe45..7bb861e19 100755 --- a/OPENMP/Sparse/sparse.c +++ b/OPENMP/Sparse/sparse.c @@ -175,7 +175,7 @@ int main(int argc, char **argv){ nent = size2*stencil_size; matrix_space = nent*sizeof(double); - if (matrix_space/sizeof(double) != nent) { + if ((s64Int)(matrix_space/sizeof(double)) != nent) { printf("ERROR: Cannot represent space for matrix: %lu\n", matrix_space); exit(EXIT_FAILURE); } @@ -187,7 +187,7 @@ int main(int argc, char **argv){ } vector_space = 2*size2*sizeof(double); - if (vector_space/sizeof(double) != 2*size2) { + if ((s64Int)(vector_space/sizeof(double)) != 2*size2) { printf("ERROR: Cannot represent space for vectors: %lu\n", vector_space); exit(EXIT_FAILURE); } @@ -200,7 +200,7 @@ int main(int argc, char **argv){ result = vector + size2; index_space = nent*sizeof(s64Int); - if (index_space/sizeof(s64Int) != nent) { + if ((s64Int)(index_space/sizeof(s64Int)) != nent) { printf("ERROR: Cannot represent space for column indices: %lu\n", index_space); exit(EXIT_FAILURE); } diff --git a/OPENMP/Synch_global/global.c b/OPENMP/Synch_global/global.c index 894d418bf..502701b14 100755 --- a/OPENMP/Synch_global/global.c +++ b/OPENMP/Synch_global/global.c @@ -227,7 +227,7 @@ int main(int argc, char ** argv) basesum=0; for (i=0; i Date: Fri, 15 Jan 2016 11:39:13 -0800 Subject: [PATCH 36/51] silence more compiler warnings --- OPENMP/Branch/branch.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/OPENMP/Branch/branch.c b/OPENMP/Branch/branch.c index 3b1f0498b..40bccc750 100755 --- a/OPENMP/Branch/branch.c +++ b/OPENMP/Branch/branch.c @@ -199,7 +199,6 @@ int main(int argc, char ** argv) #pragma omp parallel private(i, my_ID, iter, aux, nfunc, rank) reduction(+:total) { int * RESTRICT vector; int * RESTRICT index; - int factor = -1; #pragma omp master { @@ -253,13 +252,17 @@ int main(int argc, char ** argv) case VECTOR_STOP: /* condition vector[index[i]]>0 inhibits vectorization */ for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -271,13 +274,17 @@ int main(int argc, char ** argv) case VECTOR_GO: /* condition aux>0 allows vectorization */ for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -289,13 +296,17 @@ int main(int argc, char ** argv) case NO_VECTOR: /* condition aux>0 allows vectorization, but indirect indexing inbibits it */ for (iter=0; iter0) vector[i] -= 2*vector[index[i]]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[index[i]]; @@ -331,7 +342,9 @@ int main(int argc, char ** argv) case VECTOR_STOP: case VECTOR_GO: for (iter=0; iter Date: Fri, 15 Jan 2016 11:58:14 -0800 Subject: [PATCH 37/51] silence compiler warnings by initializing to trivial values --- Makefile | 2 +- SHMEM/Stencil/stencil.c | 4 ++-- SHMEM/Synch_p2p/p2p.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index ee5a7752b..d9b66d2fb 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ ifndef PRK_FLAGS PRK_FLAGS=-O3 endif -default: allserial allopenmp allmpi allshmem +default: help help: @echo "Usage: \"make all\" (re-)builds all targets" diff --git a/SHMEM/Stencil/stencil.c b/SHMEM/Stencil/stencil.c index 13d9c4ba3..f2bb6bfd4 100644 --- a/SHMEM/Stencil/stencil.c +++ b/SHMEM/Stencil/stencil.c @@ -103,7 +103,7 @@ int main(int argc, char ** argv) { DTYPE *left_buf_out; /* " " */ DTYPE *left_buf_in[2]; /* " " */ int root = 0; - int n, width, height;/* linear global and local grid dimension */ + int n=0, width, height;/* linear global and local grid dimension */ int i, j, ii, jj, kk, iter, leftover; /* dummies */ int istart, iend; /* bounds of grid tile assigned to calling rank */ int jstart, jend; /* bounds of grid tile assigned to calling rank */ @@ -111,7 +111,7 @@ int main(int argc, char ** argv) { DTYPE f_active_points; /* interior of grid with respect to stencil */ int stencil_size; /* number of points in the stencil */ DTYPE flops; /* floating point ops per iteration */ - int iterations; /* number of times to run the algorithm */ + int iterations=0; /* number of times to run the algorithm */ double avgtime, /* timing parameters */ *local_stencil_time, *stencil_time; DTYPE * RESTRICT in; /* input grid values */ diff --git a/SHMEM/Synch_p2p/p2p.c b/SHMEM/Synch_p2p/p2p.c index 11ef1fd16..c05dc5e47 100644 --- a/SHMEM/Synch_p2p/p2p.c +++ b/SHMEM/Synch_p2p/p2p.c @@ -81,7 +81,7 @@ int main(int argc, char ** argv) double epsilon = 1.e-8; /* error tolerance */ double corner_val; /* verification value at top right corner of grid */ int i, j, iter, ID; /* dummies */ - int iterations; /* number of times to run the pipeline algorithm */ + int iterations=0; /* number of times to run the pipeline algorithm */ int *start, *end; /* starts and ends of grid slices */ long segment_size; /* x-dimension of grid slice owned by calling rank */ int error=0; /* error flag */ @@ -94,8 +94,8 @@ int main(int argc, char ** argv) #endif double *dst; /* target address of communication */ double *src; /* source address of communication */ - long *pSync; /* work space for SHMEM collectives */ - double *pWrk; /* work space for SHMEM collectives */ + long *pSync=NULL; /* work space for SHMEM collectives */ + double *pWrk=NULL; /* work space for SHMEM collectives */ /********************************************************************************* ** Initialize the SHMEM environment From b37be927e76f1701d9b853f2c3461948a44555fc Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 12:02:16 -0800 Subject: [PATCH 38/51] initialize variables to trivial values to silence compiler warnings --- SHMEM/Transpose/transpose.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SHMEM/Transpose/transpose.c b/SHMEM/Transpose/transpose.c index 5101006f3..76affe944 100644 --- a/SHMEM/Transpose/transpose.c +++ b/SHMEM/Transpose/transpose.c @@ -124,12 +124,12 @@ int main(int argc, char ** argv) int Tile_order=32; /* default Tile order */ int tiling; /* boolean: true if tiling is used */ int Num_procs; /* number of ranks */ - int order; /* order of overall matrix */ + int order=0; /* order of overall matrix */ int send_to, recv_from; /* ranks with which to communicate */ long bytes; /* combined size of matrices */ int my_ID; /* rank */ int root=0; /* rank of root */ - int iterations; /* number of times to do the transpose */ + int iterations=0; /* number of times to do the transpose */ long i, j, it, jt, istart;/* dummies */ int iter; /* index of iteration */ int phase; /* phase inside staged communication */ @@ -137,8 +137,8 @@ int main(int argc, char ** argv) int error; /* error flag */ double *A_p; /* original matrix column block */ double *B_p; /* transposed matrix column block */ - double **Work_in_p; /* workspace for the transpose function */ - double *Work_out_p; /* workspace for the transpose function */ + double **Work_in_p=NULL; /* workspace for the transpose function */ + double *Work_out_p=NULL; /* workspace for the transpose function */ double epsilon = 1.e-8; /* error tolerance */ double avgtime; /* timing parameters */ long *pSync_bcast; /* work space for collectives */ @@ -148,7 +148,7 @@ int main(int argc, char ** argv) *trans_time; /* timing parameters */ double *abserr, *abserr_tot; /* local and aggregate error */ - int *recv_flag; /* synchronization flags */ + int *recv_flag=NULL; /* synchronization flags */ int *arguments; /* command line arguments */ /********************************************************************* From 38ffbad30bc1690eb31b0c3f6dc55da022f6e486 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 12:25:31 -0800 Subject: [PATCH 39/51] abs->fabs --- OPENMP/Synch_p2p/p2p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OPENMP/Synch_p2p/p2p.c b/OPENMP/Synch_p2p/p2p.c index 6fb556a80..184efe0ef 100755 --- a/OPENMP/Synch_p2p/p2p.c +++ b/OPENMP/Synch_p2p/p2p.c @@ -305,7 +305,7 @@ int main(int argc, char ** argv) { /* verify correctness, using top right value; */ corner_val = (double)((iterations+1)*(n+m-2)); - if (abs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { + if (fabs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(m-1,n-1), corner_val); exit(EXIT_FAILURE); From 16b14347e9e3c0bad35c9a19d690c0d4af35085c Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 12:26:57 -0800 Subject: [PATCH 40/51] abs->fabs --- AMPI/Synch_p2p/p2p.c | 2 +- FG_MPI/Synch_p2p/p2p.c | 2 +- MPI1/Synch_p2p/p2p.c | 2 +- MPIOPENMP/Synch_p2p/p2p.c | 2 +- MPIRMA/Synch_p2p/p2p.c | 2 +- MPISHM/Synch_p2p/p2p.c | 2 +- UPC/Synch_p2p/p2p.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AMPI/Synch_p2p/p2p.c b/AMPI/Synch_p2p/p2p.c index 034217d53..fad286738 100755 --- a/AMPI/Synch_p2p/p2p.c +++ b/AMPI/Synch_p2p/p2p.c @@ -292,7 +292,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end,n-1), corner_val); error = 1; diff --git a/FG_MPI/Synch_p2p/p2p.c b/FG_MPI/Synch_p2p/p2p.c index 111ab07c0..201f608f2 100755 --- a/FG_MPI/Synch_p2p/p2p.c +++ b/FG_MPI/Synch_p2p/p2p.c @@ -295,7 +295,7 @@ int mymain(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end,n-1), corner_val); error = 1; diff --git a/MPI1/Synch_p2p/p2p.c b/MPI1/Synch_p2p/p2p.c index e91d169c4..249dcb08e 100755 --- a/MPI1/Synch_p2p/p2p.c +++ b/MPI1/Synch_p2p/p2p.c @@ -292,7 +292,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end,n-1), corner_val); error = 1; diff --git a/MPIOPENMP/Synch_p2p/p2p.c b/MPIOPENMP/Synch_p2p/p2p.c index 5eea3c758..70bbce473 100755 --- a/MPIOPENMP/Synch_p2p/p2p.c +++ b/MPIOPENMP/Synch_p2p/p2p.c @@ -388,7 +388,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end,n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end,n-1), corner_val); error = 1; diff --git a/MPIRMA/Synch_p2p/p2p.c b/MPIRMA/Synch_p2p/p2p.c index cfdc02cae..34e9abb4f 100755 --- a/MPIRMA/Synch_p2p/p2p.c +++ b/MPIRMA/Synch_p2p/p2p.c @@ -297,7 +297,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end[my_ID],n-1)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end[my_ID],n-1)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end[my_ID],n-1), corner_val); error = 1; diff --git a/MPISHM/Synch_p2p/p2p.c b/MPISHM/Synch_p2p/p2p.c index 29c519360..6a3664919 100644 --- a/MPISHM/Synch_p2p/p2p.c +++ b/MPISHM/Synch_p2p/p2p.c @@ -308,7 +308,7 @@ int main(int argc, char ** argv) /* verify correctness, using top right value */ corner_val = (double) ((iterations+1)*(m+n-2)); if (my_ID == final) { - if (abs(ARRAY(end[my_ID],n-1,start[my_ID],offset,width)-corner_val)/corner_val >= epsilon) { + if (fabs(ARRAY(end[my_ID],n-1,start[my_ID],offset,width)-corner_val)/corner_val >= epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(end[my_ID],n-1,start[my_ID],offset,width), corner_val); error = 1; diff --git a/UPC/Synch_p2p/p2p.c b/UPC/Synch_p2p/p2p.c index 565e6a257..65bc4efa6 100644 --- a/UPC/Synch_p2p/p2p.c +++ b/UPC/Synch_p2p/p2p.c @@ -344,7 +344,7 @@ int main(int argc, char ** argv) { /* verify correctness, using top right value; */ if( MYTHREAD == THREADS - 1){ corner_val = (double)((iterations+1)*(n+m-2)); - if (abs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { + if (fabs(ARRAY(m-1,n-1)-corner_val)/corner_val > epsilon) { printf("ERROR: checksum %lf does not match verification value %lf\n", ARRAY(m-1, n-1), corner_val); exit(EXIT_FAILURE); From 9d94b8d832348a8208a165bc47c3734011918db4 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 12:30:22 -0800 Subject: [PATCH 41/51] silent compiler warnings --- MPI1/Sparse/sparse.c | 4 +++- MPI1/Stencil/stencil.c | 4 ++-- MPI1/Synch_p2p/p2p.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MPI1/Sparse/sparse.c b/MPI1/Sparse/sparse.c index c853334b4..51df51766 100755 --- a/MPI1/Sparse/sparse.c +++ b/MPI1/Sparse/sparse.c @@ -103,7 +103,7 @@ int main(int argc, char **argv){ int radius, /* stencil parameters */ stencil_size; s64Int row, col, first, last; /* dummies */ - u64Int i, j; /* dummies */ + int i, j; /* dummies */ int iterations; /* number of times the multiplication is done */ s64Int elm; /* sequence number of matrix nonzero */ @@ -358,7 +358,9 @@ int main(int argc, char **argv){ /* do the actual matrix multiplication */ for (row=0; row Date: Fri, 15 Jan 2016 12:31:23 -0800 Subject: [PATCH 42/51] silent compiler warnings --- MPI1/DGEMM/dgemm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MPI1/DGEMM/dgemm.c b/MPI1/DGEMM/dgemm.c index 80cb384fe..07133a1ec 100755 --- a/MPI1/DGEMM/dgemm.c +++ b/MPI1/DGEMM/dgemm.c @@ -368,8 +368,7 @@ MPI_Comm comm_row, /* Communicator for this row of nodes */ comm_col; /* Communicator for this column of nodes */ { int myrow, mycol, /* my row and column index */ - nprow, npcol, /* number of node rows and columns */ - i, j, kk, updt, /* misc. index variables */ + kk, updt, /* misc. index variables */ currow, curcol, /* index of row and column that hold current row and column, resp., for rank-1 update*/ ii, jj; /* local index (on currow and curcol, resp.) From 2489363116afe17aab672cd82403bfc401ae7270 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 12:36:17 -0800 Subject: [PATCH 43/51] silence compiler warnings --- MPI1/Branch/branch.c | 19 ++++++++++++++++++- MPI1/Nstream/nstream.c | 4 ++++ MPI1/Random/random.c | 3 +-- MPIRMA/Stencil/stencil.c | 2 +- MPIRMA/Transpose/transpose.c | 2 -- MPISHM/Stencil/stencil.c | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/MPI1/Branch/branch.c b/MPI1/Branch/branch.c index e67a25b37..21ee503b9 100755 --- a/MPI1/Branch/branch.c +++ b/MPI1/Branch/branch.c @@ -150,7 +150,6 @@ int main(int argc, char ** argv) total_ref; /* computed and stored verification values */ int btype; int * RESTRICT vector, * RESTRICT index; - int factor = -1; /********************************************************************* ** Initialize the MPI environment @@ -239,13 +238,17 @@ int main(int argc, char ** argv) case VECTOR_STOP: for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -256,13 +259,17 @@ int main(int argc, char ** argv) case VECTOR_GO: for (iter=0; iter0) vector[i] -= 2*vector[i]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[i]; @@ -273,13 +280,17 @@ int main(int argc, char ** argv) case NO_VECTOR: for (iter=0; iter0) vector[i] -= 2*vector[index[i]]; else vector[i] -= 2*aux; } +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (i=0; i0) vector[i] -= 2*vector[index[i]]; @@ -311,7 +322,9 @@ int main(int argc, char ** argv) case VECTOR_STOP: case VECTOR_GO: for (iter=0; iter Date: Fri, 15 Jan 2016 14:45:38 -0800 Subject: [PATCH 44/51] C99-ification; promote a lot of int to size_t --- MPISHM/Transpose/transpose.c | 53 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/MPISHM/Transpose/transpose.c b/MPISHM/Transpose/transpose.c index fc94d9521..20b2017ff 100644 --- a/MPISHM/Transpose/transpose.c +++ b/MPISHM/Transpose/transpose.c @@ -85,7 +85,7 @@ int main(int argc, char ** argv) size_t Block_order; size_t Block_size; size_t Colblock_size; - int Tile_order=32; + size_t Tile_order=32; int tiling; int Num_procs; /* Number of ranks */ size_t order; /* overall matrix order */ @@ -94,7 +94,6 @@ int main(int argc, char ** argv) int my_ID; /* rank */ int root=0; /* root rank of a communicator */ int iterations; /* number of times to run the pipeline algorithm */ - int i, j, it, jt, ID;/* dummies */ int iter; /* index of iteration */ int phase; /* phase in the staged communication */ size_t colstart; /* sequence number of first column owned by calling rank */ @@ -170,7 +169,7 @@ int main(int argc, char ** argv) } order = atol(*++argv); - if (order < Num_procs) { + if (order < (size_t)Num_procs) { printf("ERROR: matrix order %ld should at least # procs %d\n", order, Num_procs); error = 1; goto ENDOFTESTS; @@ -200,7 +199,7 @@ int main(int argc, char ** argv) printf("Matrix order = %ld\n", order); printf("Number of iterations = %d\n", iterations); if ((Tile_order > 0) && (Tile_order < order)) - printf("Tile size = %d\n", Tile_order); + printf("Tile size = %zu\n", Tile_order); else printf("Untiled\n"); #ifndef SYNCHRONOUS printf("Non-"); @@ -307,20 +306,20 @@ int main(int argc, char ** argv) /* Fill the original column matrix */ istart = 0; - int chunk_size = Block_order/group_size; + size_t chunk_size = Block_order/group_size; if (tiling) { - for (j=shm_ID*chunk_size;j<(shm_ID+1)*chunk_size;j+=Tile_order) { - for (i=0;i Date: Fri, 15 Jan 2016 14:57:12 -0800 Subject: [PATCH 45/51] more warning silence --- MPI1/Sparse/sparse.c | 2 +- MPIOPENMP/Nstream/nstream.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MPI1/Sparse/sparse.c b/MPI1/Sparse/sparse.c index 51df51766..bb6a8c3c0 100755 --- a/MPI1/Sparse/sparse.c +++ b/MPI1/Sparse/sparse.c @@ -248,7 +248,7 @@ int main(int argc, char **argv){ matrix = (double *) malloc(matrix_space); if (!matrix) { - printf("ERROR: rank %d could not allocate space for sparse matrix: "FSTR64U"\n", + printf("ERROR: rank %d could not allocate space for sparse matrix: %zu\n", my_ID, matrix_space); error = 1; } diff --git a/MPIOPENMP/Nstream/nstream.c b/MPIOPENMP/Nstream/nstream.c index 2c36c3676..8a99a70c9 100755 --- a/MPIOPENMP/Nstream/nstream.c +++ b/MPIOPENMP/Nstream/nstream.c @@ -150,15 +150,14 @@ int main(int argc, char **argv) double scalar; /* constant used in Triad operation */ int iterations; /* number of times vector loop gets repeated */ long length, /* vector length per rank */ - total_length, /* total vector length */ + total_length=0,/* total vector length */ offset; /* offset between vectors a and b, and b and c */ double bytes; /* memory IO size */ size_t space; /* memory used for a single vector */ double local_nstream_time,/* timing parameters */ nstream_time, avgtime; - int nthread_input, /* thread parameters */ - nthread; + int nthread_input; /* thread parameters */ int Num_procs, /* number of ranks */ my_ID, /* rank of calling rank */ root=0; /* ID of master rank */ @@ -253,7 +252,9 @@ int main(int argc, char **argv) } #pragma omp parallel for +#ifdef __INTEL_COMPILER #pragma vector always +#endif for (j=0; j Date: Fri, 15 Jan 2016 14:59:04 -0800 Subject: [PATCH 46/51] more warning silence --- MPI1/Sparse/sparse.c | 4 ++-- MPI1/Transpose/transpose.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MPI1/Sparse/sparse.c b/MPI1/Sparse/sparse.c index bb6a8c3c0..6f80edb7c 100755 --- a/MPI1/Sparse/sparse.c +++ b/MPI1/Sparse/sparse.c @@ -99,7 +99,7 @@ int main(int argc, char **argv){ int lsize; /* logarithmic linear size of grid */ int lsize2; /* logarithmic size of grid */ int size; /* linear size of grid */ - s64Int size2; /* matrix order (=total # points in grid) */ + u64Int size2; /* matrix order (=total # points in grid) */ int radius, /* stencil parameters */ stencil_size; s64Int row, col, first, last; /* dummies */ @@ -112,7 +112,7 @@ int main(int argc, char **argv){ jend, nrows, row_offset; - s64Int nent; /* number of nonzero entries */ + u64Int nent; /* number of nonzero entries */ double sparsity; /* fraction of non-zeroes in matrix */ double local_sparse_time,/* timing parameters */ sparse_time, diff --git a/MPI1/Transpose/transpose.c b/MPI1/Transpose/transpose.c index 246d1853e..3facc2e60 100755 --- a/MPI1/Transpose/transpose.c +++ b/MPI1/Transpose/transpose.c @@ -153,8 +153,8 @@ int main(int argc, char ** argv) int error; /* error flag */ double *A_p; /* original matrix column block */ double *B_p; /* transposed matrix column block */ - double *Work_in_p; /* workspace for the transpose function */ - double *Work_out_p; /* workspace for the transpose function */ + double *Work_in_p=NULL; /* workspace for the transpose function */ + double *Work_out_p=NULL; /* workspace for the transpose function */ double abserr, /* absolute error */ abserr_tot; /* aggregate absolute error */ double epsilon = 1.e-8; /* error tolerance */ @@ -326,7 +326,7 @@ int main(int argc, char ** argv) for (it=i; it Date: Fri, 15 Jan 2016 15:01:34 -0800 Subject: [PATCH 47/51] more warning silence --- MPIOPENMP/Stencil/stencil.c | 9 ++++----- MPIOPENMP/Synch_p2p/p2p.c | 1 - MPIOPENMP/Transpose/transpose.c | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/MPIOPENMP/Stencil/stencil.c b/MPIOPENMP/Stencil/stencil.c index fcd5a9c44..813bd8ed5 100644 --- a/MPIOPENMP/Stencil/stencil.c +++ b/MPIOPENMP/Stencil/stencil.c @@ -98,7 +98,7 @@ HISTORY: - Written by Rob Van der Wijngaart, November 2006. int main(int argc, char ** argv) { int Num_procs; /* number of ranks */ - int Num_procsx, Num_procsy; /* number of ranks in each coord direction */ + int Num_procsx=0, Num_procsy=0; /* number of ranks in each coord direction */ int my_ID; /* MPI rank */ int my_IDx, my_IDy; /* coordinates of rank in rank grid */ int right_nbr; /* global rank of right neighboring tile */ @@ -116,7 +116,7 @@ int main(int argc, char ** argv) { int root = 0; int n, width, height;/* linear global and local grid dimension */ long nsquare; /* total number of grid points */ - int i, j, ii, jj, kk, it, jt, iter, leftover; /* dummies */ + int i, j, ii, jj, kk, iter, leftover; /* dummies */ int istart, iend; /* bounds of grid tile assigned to calling rank */ int jstart, jend; /* bounds of grid tile assigned to calling rank */ DTYPE norm, /* L1 norm of solution */ @@ -129,8 +129,7 @@ int main(int argc, char ** argv) { stencil_time, avgtime; int stencil_size; /* number of points in stencil */ - int nthread_input, /* thread parameters */ - nthread; + int nthread_input; /* thread parameters */ DTYPE * RESTRICT in; /* input grid values */ DTYPE * RESTRICT out; /* output grid values */ long total_length_in; /* total required length to store input array */ @@ -298,7 +297,7 @@ int main(int argc, char ** argv) { bail_out(error); total_length_in = (width+2*RADIUS)*(height+2*RADIUS)*sizeof(DTYPE); - if (total_length_in/(height+2*RADIUS) != (width+2*RADIUS)*sizeof(DTYPE)) { + if (total_length_in/(height+2*RADIUS) != (width+2*RADIUS)*((signed)sizeof(DTYPE))) { printf("ERROR: Space for %d x %d input array cannot be represented\n", width+2*RADIUS, height+2*RADIUS); error = 1; diff --git a/MPIOPENMP/Synch_p2p/p2p.c b/MPIOPENMP/Synch_p2p/p2p.c index 70bbce473..9ce358923 100755 --- a/MPIOPENMP/Synch_p2p/p2p.c +++ b/MPIOPENMP/Synch_p2p/p2p.c @@ -94,7 +94,6 @@ int main(int argc, char ** argv) int nthread; /* number of threads */ int error=0; /* error flag */ int Num_procs; /* Number of ranks */ - char *name; /* MPI threading mode suffix name */ long total_length; /* total required length to store grid values */ MPI_Status status; /* completion status of message */ int provided; /* MPI level of thread support */ diff --git a/MPIOPENMP/Transpose/transpose.c b/MPIOPENMP/Transpose/transpose.c index df0186f1c..727051377 100755 --- a/MPIOPENMP/Transpose/transpose.c +++ b/MPIOPENMP/Transpose/transpose.c @@ -150,8 +150,7 @@ int main(int argc, char ** argv) int iter; /* index of iteration */ int phase; /* phase inside staged communication */ int colstart; /* starting column for owning rank */ - int nthread_input, /* thread parameters */ - nthread; + int nthread_input; /* thread parameters */ int error; /* error flag */ int concurrency; /* number of threads that can be active */ double *A_p; /* original matrix column block */ From cb53541d023d99f8649f2ef553bffa24a8da4ac1 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 15:09:28 -0800 Subject: [PATCH 48/51] more warning silence --- MPI1/Branch/branch.c | 4 +++- MPI1/Nstream/nstream.c | 2 +- MPI1/Random/random.c | 4 ++-- MPI1/Stencil/stencil.c | 16 ++++++++-------- MPIRMA/Transpose/transpose.c | 4 ++-- MPISHM/Synch_p2p/p2p.c | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/MPI1/Branch/branch.c b/MPI1/Branch/branch.c index 21ee503b9..439370ace 100755 --- a/MPI1/Branch/branch.c +++ b/MPI1/Branch/branch.c @@ -126,6 +126,7 @@ HISTORY: Written by Rob Van der Wijngaart, May 2006. #define INS_HEAVY 99 #define WITH_BRANCHES 1 #define WITHOUT_BRANCHES 0 +#define MONKEY_BANANA -1 extern int fill_vec(int *vector, int vector_length, int iterations, int branch, int *nfunc, int *rank); @@ -144,7 +145,7 @@ int main(int argc, char ** argv) int iterations; /* number of times the branching loop is executed */ int i, iter, aux; /* dummies */ int error = 0; /* error flag */ - char *branch_type; + char *branch_type=""; int total=0, total_sum, total_ref; /* computed and stored verification values */ @@ -196,6 +197,7 @@ int main(int argc, char ** argv) printf("Wrong branch type: %s; choose vector_stop, vector_go, ", branch_type); printf("no_vector, or ins_heavy\n"); error = 1; + btype = MONKEY_BANANA; goto ENDOFTESTS; } ENDOFTESTS:; diff --git a/MPI1/Nstream/nstream.c b/MPI1/Nstream/nstream.c index 6bf139490..ade08df48 100755 --- a/MPI1/Nstream/nstream.c +++ b/MPI1/Nstream/nstream.c @@ -129,7 +129,7 @@ int main(int argc, char **argv) double scalar; /* constant used in Triad operation */ int iterations; /* number of times vector loop gets repeated */ long int length, /* vector length per rank */ - total_length, /* total vector length */ + total_length=0, /* total vector length */ offset; /* offset between vectors a and b, and b and c */ double bytes; /* memory IO size */ size_t space; /* memory used for a single vector */ diff --git a/MPI1/Random/random.c b/MPI1/Random/random.c index b799499e2..5054b710e 100644 --- a/MPI1/Random/random.c +++ b/MPI1/Random/random.c @@ -180,7 +180,7 @@ int main(int argc, char **argv) { int *senddispls; /* successive displacements in send buffer */ int *recvdispls; /* successive dispalcemetns in receive buffer */ u64Int * RESTRICT Table; /* (pseudo-)randomly accessed array */ - double random_time; /* timing parameters */ + double random_time=0.0; /* timing parameters */ int Num_procs, /* rank parameters */ my_ID, /* rank of calling rank */ root=0; /* ID of master rank */ @@ -287,7 +287,7 @@ int main(int argc, char **argv) { /* even though the table size can be represented, computing the space required for the table may lead to overflow */ tablespace = (size_t) loctablesize*sizeof(u64Int); - if ((tablespace/sizeof(u64Int)) != loctablesize || tablespace <=0) { + if ((tablespace/((signed)sizeof(u64Int))) != loctablesize || tablespace <=0) { printf("ERROR: Cannot represent space for table on this system; "); printf("reduce log2 tablesize\n"); error = 1; diff --git a/MPI1/Stencil/stencil.c b/MPI1/Stencil/stencil.c index 14efbbdcf..a317dd087 100644 --- a/MPI1/Stencil/stencil.c +++ b/MPI1/Stencil/stencil.c @@ -105,14 +105,14 @@ int main(int argc, char ** argv) { int left_nbr; /* global rank of left neighboring tile */ int top_nbr; /* global rank of top neighboring tile */ int bottom_nbr; /* global rank of bottom neighboring tile */ - DTYPE *top_buf_out; /* communication buffer */ - DTYPE *top_buf_in; /* " " */ - DTYPE *bottom_buf_out; /* " " */ - DTYPE *bottom_buf_in; /* " " */ - DTYPE *right_buf_out; /* " " */ - DTYPE *right_buf_in; /* " " */ - DTYPE *left_buf_out; /* " " */ - DTYPE *left_buf_in; /* " " */ + DTYPE *top_buf_out=NULL; /* communication buffer */ + DTYPE *top_buf_in=NULL; /* " " */ + DTYPE *bottom_buf_out=NULL; /* " " */ + DTYPE *bottom_buf_in=NULL; /* " " */ + DTYPE *right_buf_out=NULL; /* " " */ + DTYPE *right_buf_in=NULL; /* " " */ + DTYPE *left_buf_out=NULL; /* " " */ + DTYPE *left_buf_in=NULL; /* " " */ int root = 0; int n, width, height;/* linear global and local grid dimension */ long nsquare; /* total number of grid points */ diff --git a/MPIRMA/Transpose/transpose.c b/MPIRMA/Transpose/transpose.c index f8cd7c70c..2967da707 100644 --- a/MPIRMA/Transpose/transpose.c +++ b/MPIRMA/Transpose/transpose.c @@ -148,8 +148,8 @@ int main(int argc, char ** argv) int error; /* error flag */ double *A_p; /* original matrix column block */ double *B_p; /* transposed matrix column block */ - double *Work_in_p; /* workspace for the transpose function */ - double *Work_out_p; /* workspace for the transpose function */ + double *Work_in_p=NULL; /* workspace for the transpose function */ + double *Work_out_p=NULL; /* workspace for the transpose function */ double abserr, /* absolute error */ abserr_tot; /* aggregate absolute error */ double epsilon = 1.e-8; /* error tolerance */ diff --git a/MPISHM/Synch_p2p/p2p.c b/MPISHM/Synch_p2p/p2p.c index 6a3664919..22713b410 100644 --- a/MPISHM/Synch_p2p/p2p.c +++ b/MPISHM/Synch_p2p/p2p.c @@ -99,9 +99,9 @@ int main(int argc, char ** argv) int source_disp; /* ignored */ double *source_ptr; /* pointer to left neighbor's shared memory window */ int p2pbuf; /* dummy buffer used for empty synchronization message */ - long width, nbr_width;/* size of first dimension of 2D array of grid values of + long width, nbr_width=0;/* size of first dimension of 2D array of grid values of target and neighbor ranks, including ghost point */ - int offset, nbr_offset;/* space reserved for ghost point, if present */ + int offset, nbr_offset=0;/* space reserved for ghost point, if present */ int skip; /* grid point to be skipped (only leftmost global rank) */ /********************************************************************************* From 7833c82916ecd96eefd96ffce3f70669a86e969d Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 15:29:43 -0800 Subject: [PATCH 49/51] disable unused vars --- MPISHM/Stencil/stencil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MPISHM/Stencil/stencil.c b/MPISHM/Stencil/stencil.c index 369b924c6..729ab3d19 100755 --- a/MPISHM/Stencil/stencil.c +++ b/MPISHM/Stencil/stencil.c @@ -169,8 +169,10 @@ int main(int argc, char ** argv) { int group_sizex, group_sizey; /* number of ranks in block in each coord direction */ int my_ID; /* MPI rank */ +#ifdef UNUSED int my_global_IDx, my_global_IDy; /* coordinates of rank in overall rank grid */ +#endif int my_local_IDx, my_local_IDy; /* coordinates of rank within shared memory block */ int right_nbr; /* global rank of right neighboring tile */ @@ -368,8 +370,10 @@ int main(int argc, char ** argv) { my_group_IDy = my_group/Num_groupsx; my_local_IDx = my_ID%group_sizex; my_local_IDy = (my_ID%group_size)/group_sizex; +#ifdef UNUSED my_global_IDx = my_group_IDx*group_sizex+my_local_IDx; my_global_IDy = my_group_IDy*group_sizey+my_local_IDy; +#endif /* set all neighboring ranks to -1 (no communication with those ranks) */ left_nbr = right_nbr = top_nbr = bottom_nbr = -1; From 4e7db87c87ac207aca29ccb4bb594cfb9d24c7e8 Mon Sep 17 00:00:00 2001 From: Jeff Hammond Date: Fri, 15 Jan 2016 16:09:29 -0800 Subject: [PATCH 50/51] C99-ify transpose --- MPIOPENMP/Transpose/transpose.c | 72 +++++++++++++++++---------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/MPIOPENMP/Transpose/transpose.c b/MPIOPENMP/Transpose/transpose.c index 727051377..54a8bfd3c 100755 --- a/MPIOPENMP/Transpose/transpose.c +++ b/MPIOPENMP/Transpose/transpose.c @@ -146,7 +146,6 @@ int main(int argc, char ** argv) int my_ID; /* rank */ int root=0; /* ID of root rank */ int iterations; /* number of times to do the transpose */ - int i, j, it, jt, istart;/* dummies */ int iter; /* index of iteration */ int phase; /* phase inside staged communication */ int colstart; /* starting column for owning rank */ @@ -293,26 +292,26 @@ int main(int argc, char ** argv) } /* Fill the original column matrix */ - istart = 0; + int istart = 0; if (tiling) { #ifdef COLLAPSE - #pragma omp parallel for private (i,it,jt) collapse(2) + #pragma omp parallel for collapse(2) #else - #pragma omp parallel for private (i,it,jt) + #pragma omp parallel for #endif - for (j=0; j Date: Sun, 17 Jan 2016 16:42:58 -0800 Subject: [PATCH 51/51] silence uninit --- MPISHM/Stencil/stencil.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MPISHM/Stencil/stencil.c b/MPISHM/Stencil/stencil.c index 729ab3d19..e3e2725c1 100755 --- a/MPISHM/Stencil/stencil.c +++ b/MPISHM/Stencil/stencil.c @@ -158,22 +158,22 @@ HISTORY: - Written by Rob Van der Wijngaart, November 2006. int main(int argc, char ** argv) { int Num_procs; /* number of ranks */ - int Num_procsx, - Num_procsy; /* number of ranks in each coord direction */ - int Num_groupsx, - Num_groupsy; /* number of blocks in each coord direction */ + int Num_procsx=0, + Num_procsy=0; /* number of ranks in each coord direction */ + int Num_groupsx=0, + Num_groupsy=0; /* number of blocks in each coord direction */ int my_group; /* sequence number of shared memory block */ int my_group_IDx, my_group_IDy; /* coordinates of block within block grid */ int group_size; /* number of ranks in shared memory group */ - int group_sizex, - group_sizey; /* number of ranks in block in each coord direction */ + int group_sizex=0, + group_sizey=0; /* number of ranks in block in each coord direction */ int my_ID; /* MPI rank */ #ifdef UNUSED - int my_global_IDx, + int my_global_IDx, my_global_IDy; /* coordinates of rank in overall rank grid */ #endif - int my_local_IDx, + int my_local_IDx, my_local_IDy; /* coordinates of rank within shared memory block */ int right_nbr; /* global rank of right neighboring tile */ int left_nbr; /* global rank of left neighboring tile */