Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more cleanups in NAS
[simgrid.git] / examples / smpi / NAS / EP / ep.c
index 961422a..569c2f2 100644 (file)
@@ -6,7 +6,7 @@
 #include "mpi.h"
 #include "npbparams.h"
 
-#include "randlc.h"
+#include "simgrid/instr.h" //TRACE_
 
 #ifndef CLASS
 #define CLASS 'S'
@@ -15,7 +15,6 @@
 #define true 1
 #define false 0
 
-
 //---NOTE : all the timers function have been modified to
 //          avoid global timers (privatize these). 
       // ----------------------- timers ---------------------
       double *x = (double *) malloc (2*nk*sizeof(double));
       double *q = (double *) malloc (nq*sizeof(double));
 
+      TRACE_smpi_set_category ("start");
+
       MPI_Init( &argc, &argv );
       MPI_Comm_size( MPI_COMM_WORLD, &no_nodes);
       MPI_Comm_rank( MPI_COMM_WORLD, &node);
            *   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);
     */
         MPI_Barrier( MPI_COMM_WORLD );
 
+        TRACE_smpi_set_category ("ep");
+
         timer_clear(&(elapsed[1]));
         timer_clear(&(elapsed[2]));
         timer_clear(&(elapsed[3]));
     timer_stop(2,elapsed,start);
       }
 
+    TRACE_smpi_set_category ("finalize");
+
       //int MPI_Allreduce(void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)   
   MPI_Allreduce(&sx, x, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
   sx = x[0]; //FIXME :  x[0] or x[1] => x[0] because fortran starts with 1
     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,"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,"%d\t %ld\n",i,q[i]);
+      fprintf(stdout,"%d\t %ld\n",i,(long) q[i]);
     }
 
     /*