Index: Pi/C/MPI/Makefile
===================================================================
--- Pi/C/MPI/Makefile	(revision 79)
+++ Pi/C/MPI/Makefile	(revision 80)
@@ -1,33 +1,21 @@
-EXECUTABLE=Pi_MPI_LONG Pi_MPI_INT Pi_MPI_LONG_TIME Pi_MPI_INT_TIME
+SOURCE=Pi_aMPI.c Pi_MPI.c
 
-SOURCE=Pi_MPI.c
+COMPUTING=INT32 INT64 FP32 FP64
 
+MARSAGLIA=SHR3 CONG MWC KISS
+
 CC=mpicc.openmpi
 CFLAGS=-Wall -O3 -std=c99
 LIBRARY=-lm
 
-all: $(EXECUTABLE)
+all: $(SOURCE)
 
-Pi_MPI_LONG_TIME: $(SOURCE)
+	$(foreach SRC,$(SOURCE),$(foreach TVAR,$(COMPUTING),$(foreach TRND,$(MARSAGLIA),$(CC) $(CFLAGS) -DT$(TVAR) -DT$(TRND) -DLONG -DTIME -o $(SRC:.c=)_$(TVAR)_$(TRND) $(SRC) $(LIBRARY); ) ) )
 
-	$(CC) $(CFLAGS) $(DIRECTIVES) -DLONG -DTIME -o $@ $< $(LIBRARY)
-
-Pi_MPI_INT_TIME: $(SOURCE)
-
-	$(CC) $(CFLAGS) $(DIRECTIVES) -DINTEGER -DTIME -o $@ $< $(LIBRARY)
-
-Pi_MPI_LONG: $(SOURCE)
-
-	$(CC) $(CFLAGS) $(DIRECTIVES) -DLONG -o $@ $< $(LIBRARY)
-
-Pi_MPI_INT: $(SOURCE)
-
-	$(CC) $(CFLAGS) $(DIRECTIVES) -DINTEGER -o $@ $< $(LIBRARY)
-
 .PHONY: clean check mrproper
 
 mrproper: 
-	rm -rf $(EXECUTABLE)
+	echo rm -rf $(foreach SRC,$(SOURCE),$(foreach TVAR,$(COMPUTING),$(foreach TRND,$(MARSAGLIA),$(SOURCE:.c=)_$(TVAR)_$(TRND) ) ) )
 	find . -name "*~" -exec rm {} \;
 
 clean:
@@ -35,4 +23,4 @@
 
 check: $(EXECUTABLE)
 
-	$(SOURCE:.c=)_SP_$(EXECUTABLE) 2 1
+	@echo "To be Defined"
Index: Pi/C/MPI/Pi_MPI.c
===================================================================
--- Pi/C/MPI/Pi_MPI.c	(revision 79)
+++ Pi/C/MPI/Pi_MPI.c	(revision 80)
@@ -82,8 +82,7 @@
 #endif
 
   MPI_Status Stat;
-  MPI_Request RequestSend, RequestRecv, RequestSend2, RequestRecv2;
-     
+
   rc = MPI_Init(&argc,&argv);
   if (rc != MPI_SUCCESS) {
     printf ("Error starting MPI program. Terminating.\n");
@@ -117,14 +116,13 @@
     for (i=1;i<numtasks;i++) {
       
 #ifdef LONG
-      rc = MPI_Isend(&part_iterations, 1, MPI_LONG_LONG, i, tag, 
-		     MPI_COMM_WORLD,&RequestSend);
+      rc = MPI_Send(&part_iterations, 1, MPI_LONG_LONG, i, tag, 
+                    MPI_COMM_WORLD);
 #else
-      rc = MPI_Isend(&part_iterations, 1, MPI_INT, i, tag, 
-		     MPI_COMM_WORLD,&RequestSend);
-#endif      
+      rc = MPI_Send(&part_iterations, 1, MPI_INT, i, tag, 
+                    MPI_COMM_WORLD);
+#endif
     }
-    MPI_Wait(&RequestSend, &Stat);
     
 #ifdef TIME
     gettimeofday(&start,(struct timezone *)0);
@@ -147,14 +145,12 @@
     // Join part of code
       for (i=1;i<numtasks;i++) {
 #ifdef LONG
-	rc = MPI_Irecv(&inside[i], 1, MPI_LONG_LONG, i, tag, 
-		      MPI_COMM_WORLD, &RequestRecv2);
+	rc = MPI_Recv(&inside[i], 1, MPI_LONG_LONG, i, tag, 
+		      MPI_COMM_WORLD, &Stat);
 #else
-	rc = MPI_Irecv(&inside[i], 1, MPI_INT, i, tag, 
-		      MPI_COMM_WORLD, &RequestRecv2);
+	rc = MPI_Recv(&inside[i], 1, MPI_INT, i, tag, 
+		      MPI_COMM_WORLD, &Stat);
 #endif
-	MPI_Wait(&RequestRecv2, &Stat);
-	
 	printf("\tReceive %lu inside from rank %i\n",(unsigned long)inside[i],i);
 	insides+=inside[i];
       }
@@ -169,13 +165,12 @@
     {
       // Receive information from master
 #ifdef LONG
-      rc = MPI_Irecv(&part_iterations, 1, MPI_LONG_LONG, 0, tag, 
-                    MPI_COMM_WORLD, &RequestRecv);
+      rc = MPI_Recv(&part_iterations, 1, MPI_LONG_LONG, 0, tag, 
+                    MPI_COMM_WORLD, &Stat);
 #else
-      rc = MPI_Irecv(&part_iterations, 1, MPI_INT, 0, tag, 
-                    MPI_COMM_WORLD, &RequestRecv);
+      rc = MPI_Recv(&part_iterations, 1, MPI_INT, 0, tag, 
+                    MPI_COMM_WORLD, &Stat);
 #endif
-      MPI_Wait(&RequestRecv, &Stat);
       
       printf("\tOn %s with rank %i, receive from master %lld\n",
              hostname,rank,(long long)part_iterations);
@@ -200,11 +195,10 @@
 #endif
       
 #ifdef LONG
-      rc = MPI_Isend(&part_inside, 1, MPI_LONG_LONG, 0, tag, MPI_COMM_WORLD,&RequestSend2);
+      rc = MPI_Send(&part_inside, 1, MPI_LONG_LONG, 0, tag, MPI_COMM_WORLD);
 #else
-      rc = MPI_Isend(&part_inside, 1, MPI_INT, 0, tag, MPI_COMM_WORLD,&RequestSend2);
+      rc = MPI_Send(&part_inside, 1, MPI_INT, 0, tag, MPI_COMM_WORLD);
 #endif
-      MPI_Wait(&RequestSend2, &Stat);
 
     }
   
Index: Pi/C/MPI/Pi_aMPI.c
===================================================================
--- Pi/C/MPI/Pi_aMPI.c	(revision 0)
+++ Pi/C/MPI/Pi_aMPI.c	(revision 80)
@@ -0,0 +1,285 @@
+//
+// Estimation of Pi using Monte Carlo exploration process
+// gcc -std=c99 -O3 -o Pi Pi.c -lm 
+// Emmanuel Quemener <emmanuel.quemener@ens-lyon.fr>
+
+// Needed for gethostname
+#define _BSD_SOURCE
+#include <sys/unistd.h>
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <mpi.h>
+
+#ifdef TIME
+#include <sys/time.h>
+#endif
+
+// Marsaglia RNG very simple implementation
+#define znew  ((z=36969*(z&65535)+(z>>16))<<16)
+#define wnew  ((w=18000*(w&65535)+(w>>16))&65535)
+#define MWC   (znew+wnew)
+#define SHR3  (jsr=(jsr=(jsr=jsr^(jsr<<17))^(jsr>>13))^(jsr<<5))
+#define CONG  (jcong=69069*jcong+1234567)
+#define KISS  ((MWC^CONG)+SHR3)
+
+#define MWCfp MWC * 2.328306435454494e-10f
+#define KISSfp KISS * 2.328306435454494e-10f
+#define SHR3fp SHR3 * 2.328306435454494e-10f
+#define CONGfp CONG * 2.328306435454494e-10f
+
+#define ITERATIONS 1000000000
+
+#ifdef LONG
+#define LENGTH long long
+#else
+#define LENGTH int
+#endif
+
+unsigned int rotl(unsigned int value, int shift) {
+    return (value << shift) | (value >> (sizeof(value) * CHAR_BIT - shift));
+}
+ 
+unsigned int rotr(unsigned int value, int shift) {
+    return (value >> shift) | (value << (sizeof(value) * CHAR_BIT - shift));
+}
+
+LENGTH MainLoopGlobal(LENGTH iterations,unsigned int seed_w,unsigned int seed_z)
+{
+#if defined TCONG
+   unsigned int jcong=seed_z;
+#elif defined TSHR3
+   unsigned int jsr=seed_w;
+#elif defined TMWC
+   unsigned int z=seed_z;
+   unsigned int w=seed_w;
+#elif defined TKISS
+   unsigned int jcong=seed_z;
+   unsigned int jsr=seed_w;
+   unsigned int z=seed_z;
+   unsigned int w=seed_w;
+#endif
+
+  LENGTH total=0;
+
+   for (LENGTH i=0;i<iterations;i++) {
+
+#if defined TINT32
+    #define THEONE 1073741824
+    #if defined TCONG
+        unsigned int x=CONG>>17 ;
+        unsigned int y=CONG>>17 ;
+    #elif defined TSHR3
+        unsigned int x=SHR3>>17 ;
+        unsigned int y=SHR3>>17 ;
+    #elif defined TMWC
+        unsigned int x=MWC>>17 ;
+        unsigned int y=MWC>>17 ;
+    #elif defined TKISS
+        unsigned int x=KISS>>17 ;
+        unsigned int y=KISS>>17 ;
+    #endif
+#elif defined TINT64
+    #define THEONE 4611686018427387904
+    #if defined TCONG
+        unsigned long x=(unsigned long)(CONG>>1) ;
+        unsigned long y=(unsigned long)(CONG>>1) ;
+    #elif defined TSHR3
+        unsigned long x=(unsigned long)(SHR3>>1) ;
+        unsigned long y=(unsigned long)(SHR3>>1) ;
+    #elif defined TMWC
+        unsigned long x=(unsigned long)(MWC>>1) ;
+        unsigned long y=(unsigned long)(MWC>>1) ;
+    #elif defined TKISS
+        unsigned long x=(unsigned long)(KISS>>1) ;
+        unsigned long y=(unsigned long)(KISS>>1) ;
+    #endif
+#elif defined TFP32
+    #define THEONE 1.0f
+    #if defined TCONG
+        float x=CONGfp ;
+        float y=CONGfp ;
+    #elif defined TSHR3
+        float x=SHR3fp ;
+        float y=SHR3fp ;
+    #elif defined TMWC
+        float x=MWCfp ;
+        float y=MWCfp ;
+    #elif defined TKISS
+      float x=KISSfp ;
+      float y=KISSfp ;
+    #endif
+#elif defined TFP64
+    #define THEONE 1.0f
+    #if defined TCONG
+        double x=(double)CONGfp ;
+        double y=(double)CONGfp ;
+    #elif defined TSHR3
+        double x=(double)SHR3fp ;
+        double y=(double)SHR3fp ;
+    #elif defined TMWC
+        double x=(double)MWCfp ;
+        double y=(double)MWCfp ;
+    #elif defined TKISS
+        double x=(double)KISSfp ;
+        double y=(double)KISSfp ;
+    #endif
+#endif
+
+      // Matching test
+      unsigned long inside=((x*x+y*y) < THEONE) ? 1:0;
+      total+=inside;
+   }
+  
+   return(total);
+
+}
+
+int main(int argc, char *argv[]) {
+
+  unsigned int seed_z=362436069,seed_w=52128862;
+  LENGTH iterations=ITERATIONS,inside[1024],insides,part_inside,part_iterations;
+  int numtasks,rank,rc,tag=1,i;
+  float pi;
+
+  char hostname[128];
+
+  gethostname(hostname, sizeof hostname);
+
+#ifdef TIME
+  struct timeval start,end;
+  long int useconds;
+#endif
+
+  MPI_Status Stat;
+  MPI_Request RequestSend, RequestRecv, RequestSend2, RequestRecv2;
+     
+  rc = MPI_Init(&argc,&argv);
+  if (rc != MPI_SUCCESS) {
+    printf ("Error starting MPI program. Terminating.\n");
+    MPI_Abort(MPI_COMM_WORLD, rc);
+  }
+
+  MPI_Comm_size(MPI_COMM_WORLD,&numtasks);
+  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
+
+  if (rank==0) {
+    
+    if (argc > 1) {
+      iterations=(LENGTH)atoll(argv[1]);
+    }
+    else {
+      printf("\n\tPi : Estimate Pi with Monte Carlo exploration\n\n");
+      printf("\t\t#1 : number of iterations (default 1 billion)\n\n");
+    }
+    
+    printf ("Sizeof int = %lld bytes.\n", (long long)sizeof(int));
+    printf ("Sizeof long = %lld bytes.\n", (long long)sizeof(long));
+    printf ("Sizeof long long = %lld bytes.\n", (long long)sizeof(long long));
+    
+    printf ("Max int = %u\n", INT_MAX);
+    printf ("Max long = %ld\n", LONG_MAX);
+    printf ("Max long long = %lld\n", LLONG_MAX);
+    
+    part_iterations=iterations/numtasks+1;
+    
+    // Split part of code
+    for (i=1;i<numtasks;i++) {
+      
+#ifdef LONG
+      rc = MPI_Isend(&part_iterations, 1, MPI_LONG_LONG, i, tag, 
+		     MPI_COMM_WORLD,&RequestSend);
+#else
+      rc = MPI_Isend(&part_iterations, 1, MPI_INT, i, tag, 
+		     MPI_COMM_WORLD,&RequestSend);
+#endif      
+    }
+    MPI_Wait(&RequestSend, &Stat);
+    
+#ifdef TIME
+    gettimeofday(&start,(struct timezone *)0);
+#endif
+    
+    insides=MainLoopGlobal(part_iterations,seed_w,seed_z);
+    
+#ifdef TIME
+    gettimeofday(&end,(struct timezone *)0);
+    useconds=(end.tv_sec-start.tv_sec)*1000000+end.tv_usec-start.tv_usec;
+    
+      printf("\tOn %s with rank %i, find %lld inside in %lu useconds.\n",
+	     hostname,rank,(long long)insides,useconds);
+#else
+      printf("\tOn %s with rank %i, find %lld inside\n",hostname,rank,
+	     (long long)insides);
+      
+#endif
+      
+    // Join part of code
+      for (i=1;i<numtasks;i++) {
+#ifdef LONG
+	rc = MPI_Irecv(&inside[i], 1, MPI_LONG_LONG, i, tag, 
+		      MPI_COMM_WORLD, &RequestRecv2);
+#else
+	rc = MPI_Irecv(&inside[i], 1, MPI_INT, i, tag, 
+		      MPI_COMM_WORLD, &RequestRecv2);
+#endif
+	MPI_Wait(&RequestRecv2, &Stat);
+	
+	printf("\tReceive %lu inside from rank %i\n",(unsigned long)inside[i],i);
+	insides+=inside[i];
+      }
+      
+      pi=4.*(float)insides/(float)((iterations/numtasks)*numtasks);
+      
+      printf("\n\tPi=%.40f\n\twith error %.40f\n\twith %lld iterations\n\n",pi,
+	     fabs(pi-4*atan(1.))/pi,(long long)iterations);
+
+  }
+  else
+    {
+      // Receive information from master
+#ifdef LONG
+      rc = MPI_Irecv(&part_iterations, 1, MPI_LONG_LONG, 0, tag, 
+                    MPI_COMM_WORLD, &RequestRecv);
+#else
+      rc = MPI_Irecv(&part_iterations, 1, MPI_INT, 0, tag, 
+                    MPI_COMM_WORLD, &RequestRecv);
+#endif
+      MPI_Wait(&RequestRecv, &Stat);
+      
+      printf("\tOn %s with rank %i, receive from master %lld\n",
+             hostname,rank,(long long)part_iterations);
+      
+#ifdef TIME
+      gettimeofday(&start,(struct timezone *)0);
+#endif
+
+      part_inside=MainLoopGlobal(part_iterations,rotr(seed_w,rank),rotl(seed_z,rank));
+      
+      
+#ifdef TIME
+      gettimeofday(&end,(struct timezone *)0);
+      useconds=(end.tv_sec-start.tv_sec)*1000000+end.tv_usec-start.tv_usec;
+      
+      printf("\tOn %s with rank %i, find %lld inside in %lu useconds.\n",
+	     hostname,rank,(long long)part_inside,useconds);
+#else
+      printf("\tOn %s with rank %i, find %lld inside\n",hostname,rank,
+	     (long long)part_inside);
+      
+#endif
+      
+#ifdef LONG
+      rc = MPI_Isend(&part_inside, 1, MPI_LONG_LONG, 0, tag, MPI_COMM_WORLD,&RequestSend2);
+#else
+      rc = MPI_Isend(&part_inside, 1, MPI_INT, 0, tag, MPI_COMM_WORLD,&RequestSend2);
+#endif
+      MPI_Wait(&RequestSend2, &Stat);
+
+    }
+  
+  MPI_Finalize();
+  
+}
