Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
have the two versions of EP together
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 1 Feb 2016 12:18:06 +0000 (13:18 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 1 Feb 2016 12:18:06 +0000 (13:18 +0100)
 + avoid replication
 + solve some casting issues too

examples/smpi/NAS/EP-sampling/Makefile [deleted file]
examples/smpi/NAS/EP-sampling/README [deleted file]
examples/smpi/NAS/EP-sampling/randlc.c [deleted file]
examples/smpi/NAS/EP-sampling/randlc.h [deleted file]
examples/smpi/NAS/EP/Makefile
examples/smpi/NAS/EP/ep-sampling.c [moved from examples/smpi/NAS/EP-sampling/ep.c with 98% similarity]
examples/smpi/NAS/EP/ep.c
examples/smpi/NAS/Makefile

diff --git a/examples/smpi/NAS/EP-sampling/Makefile b/examples/smpi/NAS/EP-sampling/Makefile
deleted file mode 100644 (file)
index 6205cb4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-SHELL=/bin/sh
-BENCHMARK=ep
-BENCHMARKU=EP
-
-include ../config/make.def
-
-#OBJS = ep.o ${COMMON}/print_results.o ${COMMON}/${RAND}.o ${COMMON}/timers.o
-OBJS = ep.o randlc.o
-
-include ../sys/make.common
-
-${PROGRAM}: config ${OBJS}
-#      ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB}
-       ${CLINK} ${CLINKFLAGS} -o ${PROGRAM} ${OBJS} ${CMPI_LIB}
-
-
-#ep.o:         ep.f  mpinpb.h npbparams.h
-#      ${FCOMPILE} ep.f
-
-ep.o:  ep.c randlc.c ../EP/mpinpb.h npbparams.h
-       ${CCOMPILE} ep.c
-
-clean:
-       - rm -f *.o *~ 
-       - rm -f npbparams.h core
-
-
-
diff --git a/examples/smpi/NAS/EP-sampling/README b/examples/smpi/NAS/EP-sampling/README
deleted file mode 100644 (file)
index 6eb3657..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-This code implements the random-number generator described in the
-NAS Parallel Benchmark document RNR Technical Report RNR-94-007.
-The code is "embarrassingly" parallel in that no communication is
-required for the generation of the random numbers itself. There is
-no special requirement on the number of processors used for running
-the benchmark.
diff --git a/examples/smpi/NAS/EP-sampling/randlc.c b/examples/smpi/NAS/EP-sampling/randlc.c
deleted file mode 100644 (file)
index 4de6c93..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
- *    FUNCTION RANDLC (X, A)
- *
- *  This routine returns a uniform pseudorandom double precision number in the
- *  range (0, 1) by using the linear congruential generator
- *
- *  x_{k+1} = a x_k  (mod 2^46)
- *
- *  where 0 < x_k < 2^46 and 0 < a < 2^46.  This scheme generates 2^44 numbers
- *  before repeating.  The argument A is the same as 'a' in the above formula,
- *  and X is the same as x_0.  A and X must be odd double precision integers
- *  in the range (1, 2^46).  The returned value RANDLC is normalized to be
- *  between 0 and 1, i.e. RANDLC = 2^(-46) * x_1.  X is updated to contain
- *  the new seed x_1, so that subsequent calls to RANDLC using the same
- *  arguments will generate a continuous sequence.
- *
- *  This routine should produce the same results on any computer with at least
- *  48 mantissa bits in double precision floating point data.  On Cray systems,
- *  double precision should be disabled.
- *
- *  David H. Bailey     October 26, 1990
- *
- *     IMPLICIT DOUBLE PRECISION (A-H, O-Z)
- *     SAVE KS, R23, R46, T23, T46
- *     DATA KS/0/
- *
- *  If this is the first call to RANDLC, compute R23 = 2 ^ -23, R46 = 2 ^ -46,
- *  T23 = 2 ^ 23, and T46 = 2 ^ 46.  These are computed in loops, rather than
- *  by merely using the ** operator, in order to insure that the results are
- *  exact on all systems.  This code assumes that 0.5D0 is represented exactly.
- */
-
-
-/*****************************************************************/
-/*************           R  A  N  D  L  C             ************/
-/*************                                        ************/
-/*************    portable random number generator    ************/
-/*****************************************************************/
-
-double  randlc( double *X, double *A )
-{
-      static int        KS=0;
-      static double  R23, R46, T23, T46;
-      double    T1, T2, T3, T4;
-      double    A1;
-      double    A2;
-      double    X1;
-      double    X2;
-      double    Z;
-      int         i, j;
-
-      if (KS == 0) 
-      {
-        R23 = 1.0;
-        R46 = 1.0;
-        T23 = 1.0;
-        T46 = 1.0;
-    
-        for (i=1; i<=23; i++)
-        {
-          R23 = 0.50 * R23;
-          T23 = 2.0 * T23;
-        }
-        for (i=1; i<=46; i++)
-        {
-          R46 = 0.50 * R46;
-          T46 = 2.0 * T46;
-        }
-        KS = 1;
-      }
-
-/*  Break A into two parts such that A = 2^23 * A1 + A2 and set X = N.  */
-
-      T1 = R23 * *A;
-      j  = T1;
-      A1 = j;
-      A2 = *A - T23 * A1;
-
-/*  Break X into two parts such that X = 2^23 * X1 + X2, compute
-    Z = A1 * X2 + A2 * X1  (mod 2^23), and then
-    X = 2^23 * Z + A2 * X2  (mod 2^46).                            */
-
-      T1 = R23 * *X;
-      j  = T1;
-      X1 = j;
-      X2 = *X - T23 * X1;
-      T1 = A1 * X2 + A2 * X1;
-      
-      j  = R23 * T1;
-      T2 = j;
-      Z = T1 - T23 * T2;
-      T3 = T23 * Z + A2 * X2;
-      j  = R46 * T3;
-      T4 = j;
-      *X = T3 - T46 * T4;
-      return(R46 * *X);
-} 
-
-
-
-/*****************************************************************/
-/************   F  I  N  D  _  M  Y  _  S  E  E  D    ************/
-/************                                         ************/
-/************ returns parallel random number seq seed ************/
-/*****************************************************************/
-
diff --git a/examples/smpi/NAS/EP-sampling/randlc.h b/examples/smpi/NAS/EP-sampling/randlc.h
deleted file mode 100644 (file)
index aff84d3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-double      randlc( double *X, double *A );
-
index 217f57d..3387d73 100644 (file)
@@ -5,18 +5,22 @@ BENCHMARKU=EP
 include ../config/make.def
 
 OBJS = ep.o randlc.o
 include ../config/make.def
 
 OBJS = ep.o randlc.o
+OBJS-S = ep-sampling.o randlc.o
 
 include ../sys/make.common
 
 
 include ../sys/make.common
 
-${PROGRAM}: config ${OBJS}
-       ${CLINK} ${CLINKFLAGS} -o ${PROGRAM} ${OBJS} ${CMPI_LIB}
+${PROGRAM}: config ${OBJS} ${OBJS-S}
+       ${CLINK} ${CLINKFLAGS} -o ${PROGRAM} ${OBJS} ${CMPI_LIB} -lm
+       ${CLINK} ${CLINKFLAGS} -o ${PROGRAM}-sampling ${OBJS-S} ${CMPI_LIB} -lm
 
 ep.o:  ep.c randlc.c mpinpb.h npbparams.h
        ${CCOMPILE} ep.c
 
 ep.o:  ep.c randlc.c mpinpb.h npbparams.h
        ${CCOMPILE} ep.c
+ep-sampling.o: ep-sampling.c randlc.c mpinpb.h npbparams.h
+       ${CCOMPILE} ep-sampling.c
 
 clean:
        - rm -f *.o *~ 
 
 clean:
        - rm -f *.o *~ 
-       - rm -f npbparams.h core
+       - rm -f npbparams.h
 
 
 
 
 
 
similarity index 98%
rename from examples/smpi/NAS/EP-sampling/ep.c
rename to examples/smpi/NAS/EP/ep-sampling.c
index 940c1b9..01bd4c7 100644 (file)
            *   point print statement (internal file)
            */
           fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark");
            *   point print statement (internal file)
            */
           fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark");
-          sprintf(size,"%d",pow(2,m+1));
+          sprintf(size,"%d",(int) pow(2,m+1));
           //size = size.replace('.', ' ');
           fprintf(stdout," Number of random numbers generated: %s\n",size);
           fprintf(stdout," Number of active processes: %d\n",no_nodes);
           //size = size.replace('.', ' ');
           fprintf(stdout," Number of random numbers generated: %s\n",size);
           fprintf(stdout," Number of active processes: %d\n",no_nodes);
     Mops = (pow(2.0, m+1))/tm/1000;
 
     fprintf(stdout,"EP Benchmark Results:\n");
     Mops = (pow(2.0, m+1))/tm/1000;
 
     fprintf(stdout,"EP Benchmark Results:\n");
-    fprintf(stdout,"CPU Time=%d\n",tm);
+    fprintf(stdout,"CPU Time=%d\n",(int) tm);
     fprintf(stdout,"N = 2^%d\n",m);
     fprintf(stdout,"N = 2^%d\n",m);
-    fprintf(stdout,"No. Gaussain Pairs =%d\n",gc);
-    fprintf(stdout,"Sum = %f %ld\n",sx,sy);
+    fprintf(stdout,"No. Gaussain Pairs =%d\n",(int) gc);
+    fprintf(stdout,"Sum = %f %ld\n",sx,(long) sy);
     fprintf(stdout,"Count:");
     for(i = 0; i < nq; i++) {
     fprintf(stdout,"Count:");
     for(i = 0; i < nq; i++) {
-      fprintf(stdout,"%d\t %ld\n",i,q[i]);
+      fprintf(stdout,"%d\t %ld\n",i,(long) q[i]);
     }
 
     /*
     }
 
     /*
index 5cf9d5f..685fdca 100644 (file)
@@ -17,7 +17,6 @@
 #define true 1
 #define false 0
 
 #define true 1
 #define false 0
 
-
 //---NOTE : all the timers function have been modified to
 //          avoid global timers (privatize these). 
       // ----------------------- timers ---------------------
 //---NOTE : all the timers function have been modified to
 //          avoid global timers (privatize these). 
       // ----------------------- timers ---------------------
            *   point print statement (internal file)
            */
           fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark");
            *   point print statement (internal file)
            */
           fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark");
-          sprintf(size,"%d",pow(2,m+1));
+          sprintf(size,"%d",(int)pow(2,m+1));
           //size = size.replace('.', ' ');
           fprintf(stdout," Number of random numbers generated: %s\n",size);
           fprintf(stdout," Number of active processes: %d\n",no_nodes);
           //size = size.replace('.', ' ');
           fprintf(stdout," Number of random numbers generated: %s\n",size);
           fprintf(stdout," Number of active processes: %d\n",no_nodes);
     Mops = (pow(2.0, m+1))/tm/1000;
 
     fprintf(stdout,"EP Benchmark Results:\n");
     Mops = (pow(2.0, m+1))/tm/1000;
 
     fprintf(stdout,"EP Benchmark Results:\n");
-    fprintf(stdout,"CPU Time=%d\n",tm);
+    fprintf(stdout,"CPU Time=%d\n",(int) tm);
     fprintf(stdout,"N = 2^%d\n",m);
     fprintf(stdout,"N = 2^%d\n",m);
-    fprintf(stdout,"No. Gaussain Pairs =%d\n",gc);
-    fprintf(stdout,"Sum = %f %ld\n",sx,sy);
+    fprintf(stdout,"No. Gaussain Pairs =%d\n",(int) gc);
+    fprintf(stdout,"Sum = %f %ld\n",sx,(long) sy);
     fprintf(stdout,"Count:");
     for(i = 0; i < nq; i++) {
     fprintf(stdout,"Count:");
     for(i = 0; i < nq; i++) {
-      fprintf(stdout,"%d\t %ld\n",i,q[i]);
+      fprintf(stdout,"%d\t %ld\n",i,(long) q[i]);
     }
 
     /*
     }
 
     /*
index 0452400..ae04d5e 100644 (file)
@@ -17,10 +17,6 @@ EP: ep
 ep: header
        cd EP; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS)
 
 ep: header
        cd EP; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS)
 
-EP-sampling: ep-sampling
-ep-sampling: header
-       cd EP-sampling; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS)
-
 DT: dt
 dt: header
        cd DT; $(MAKE) CLASS=$(CLASS)
 DT: dt
 dt: header
        cd DT; $(MAKE) CLASS=$(CLASS)