Index: Splutter/GPU/SplutterGPU.py
===================================================================
--- Splutter/GPU/SplutterGPU.py	(revision 306)
+++ Splutter/GPU/SplutterGPU.py	(revision 307)
@@ -387,7 +387,7 @@
     start_time=time.time()
     Splutter[:]=0
     
-    print Splutter,len(Splutter)
+    print(Splutter,len(Splutter))
 
     SplutterCU = cuda.InOut(Splutter)
 
@@ -402,8 +402,8 @@
                          grid=(jobs,1),
                          block=(1,1,1))
         
-      print "%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
-            (Alu,jobs,1,ParaStyle)      
+      print("%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
+            (Alu,jobs,1,ParaStyle))
     elif ParaStyle=='Hybrid':
       threads=BestThreadsNumber(jobs)
       MetropolisHybridCU(SplutterCU,
@@ -413,8 +413,8 @@
                          numpy.uint32(nprnd(2**30/jobs)),
                          grid=(jobs,1),
                          block=(threads,1,1))
-      print "%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
-            (Alu,jobs/threads,threads,ParaStyle)
+      print("%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
+            (Alu,jobs/threads,threads,ParaStyle))
     else:
       MetropolisThreadsCU(SplutterCU,
                        numpy.uint32(len(Splutter)),
@@ -423,17 +423,17 @@
                        numpy.uint32(nprnd(2**30/jobs)),
                        grid=(1,1),
                        block=(jobs,1,1))
-      print "%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
-            (Alu,1,jobs,ParaStyle)
+      print("%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
+            (Alu,1,jobs,ParaStyle))
     stop.record()
     stop.synchronize()
                 
 #    elapsed = start.time_till(stop)*1e-3
     elapsed = time.time()-start_time
 
-    print Splutter,sum(Splutter)
+    print(Splutter,sum(Splutter))
     MySplutter[i]=numpy.median(Splutter)
-    print numpy.mean(Splutter),MySplutter[i],numpy.std(Splutter)
+    print(numpy.mean(Splutter),MySplutter[i],numpy.std(Splutter))
 
     MyDuration[i]=elapsed
 
@@ -442,7 +442,7 @@
     #print MyPi[i],numpy.std(AllPi),MyDuration[i]
 
 
-  print jobs,numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration)
+  print(jobs,numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration))
 
   return(numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration))
 
@@ -456,7 +456,7 @@
   MinMemoryXPU=0
 
   if Device==0:
-    print "Enter XPU selector based on ALU type: first selected"
+    print("Enter XPU selector based on ALU type: first selected")
     HasXPU=False
     # Default Device selection based on ALU Type
     for platform in cl.get_platforms():
@@ -469,12 +469,12 @@
           MinMemoryXPU=deviceMemory
         if not HasXPU:        
           XPU=device
-          print "XPU selected with Allocable Memory %i: %s" % (deviceMemory,device.name)
+          print("XPU selected with Allocable Memory %i: %s" % (deviceMemory,device.name))
           HasXPU=True
           MemoryXPU=deviceMemory
           
   else:
-    print "Enter XPU selector based on device number & ALU type"
+    print("Enter XPU selector based on device number & ALU type")
     Id=1
     HasXPU=False
     # Primary Device selection based on Device Id
@@ -488,16 +488,16 @@
           MinMemoryXPU=deviceMemory
         if Id==Device  and HasXPU==False:
           XPU=device
-          print "CPU/GPU selected with Allocable Memory %i: %s" % (deviceMemory,device.name)
+          print("CPU/GPU selected with Allocable Memory %i: %s" % (deviceMemory,device.name))
           HasXPU=True
           MemoryXPU=deviceMemory
         Id=Id+1
     if HasXPU==False:
-      print "No XPU #%i of type %s found in all of %i devices, sorry..." % \
-          (Device,Alu,Id-1)
+      print("No XPU #%i of type %s found in all of %i devices, sorry..." % \
+          (Device,Alu,Id-1))
       return(0,0,0)
 
-  print "Allocable Memory is %i, between %i and %i " % (MemoryXPU,MinMemoryXPU,MaxMemoryXPU)
+  print("Allocable Memory is %i, between %i and %i " % (MemoryXPU,MinMemoryXPU,MaxMemoryXPU))
 
   # Je cree le contexte et la queue pour son execution
   ctx = cl.Context([XPU])
@@ -520,7 +520,7 @@
   MySplutter=numpy.zeros(steps)
 
   MaxWorks=2**(int)(numpy.log2(MinMemoryXPU/4))
-  print MaxWorks,2**(int)(numpy.log2(MemoryXPU))
+  print(MaxWorks,2**(int)(numpy.log2(MemoryXPU)))
   
   #Splutter=numpy.zeros((MaxWorks/jobs)*jobs).astype(numpy.uint32)
   #Splutter=numpy.zeros(jobs*16).astype(numpy.uint32)
@@ -535,7 +535,7 @@
 
     Splutter[:]=0
 
-    print Splutter,len(Splutter)
+    print(Splutter,len(Splutter))
 
     h2d_time=time.time()
     SplutterCL = cl.Buffer(ctx, mf.WRITE_ONLY|mf.COPY_HOST_PTR,hostbuf=Splutter)
@@ -563,12 +563,12 @@
                                            numpy.uint32(nprnd(2**30/jobs)),
                                            numpy.uint32(nprnd(2**30/jobs)))
         
-      print "%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
-            (Alu,jobs,1,ParaStyle)
+      print("%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
+            (Alu,jobs,1,ParaStyle))
     elif ParaStyle=='Hybrid':
       #threads=BestThreadsNumber(jobs)
       threads=BestThreadsNumber(256)
-      print "print",threads      
+      print("print",threads)
       # en OpenCL, necessaire de mettre un Global_id identique au local_id
       CLLaunch=MetropolisCL.SplutterHybrid(queue,(jobs,),(threads,),
                                            SplutterCL,
@@ -577,8 +577,8 @@
                                            numpy.uint32(nprnd(2**30/jobs)),
                                            numpy.uint32(nprnd(2**30/jobs)))
         
-      print "%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
-            (Alu,jobs/threads,threads,ParaStyle)
+      print("%s with (WorkItems/Threads)=(%i,%i) %s method done" % \
+            (Alu,jobs/threads,threads,ParaStyle))
     else:
       # en OpenCL, necessaire de mettre un global_id identique au local_id
       CLLaunch=MetropolisCL.SplutterLocal(queue,(jobs,),(jobs,),
@@ -589,7 +589,7 @@
                                           numpy.uint32(nprnd(2**30/jobs)))
         
         
-      print "%s with %i %s done" % (Alu,jobs,ParaStyle)
+      print("%s with %i %s done" % (Alu,jobs,ParaStyle))
 
     CLLaunch.wait()
     d2h_time=time.time()
@@ -601,13 +601,13 @@
     print('Elapsed compute time %f' % elapsed)
 
     MyDuration[i]=elapsed
-    #print Splutter,sum(Splutter)
+    print(Splutter,sum(Splutter))
     #MySplutter[i]=numpy.median(Splutter)
-    #print numpy.mean(Splutter)*len(Splutter),MySplutter[i]*len(Splutter),numpy.std(Splutter)
+    #print(numpy.mean(Splutter)*len(Splutter),MySplutter[i]*len(Splutter),numpy.std(Splutter))
     
   SplutterCL.release()
 
-  print jobs,numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration)
+  print(jobs,numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration))
 	
   return(numpy.mean(MyDuration),numpy.median(MyDuration),numpy.std(MyDuration))
 
@@ -624,10 +624,10 @@
     coeffs_Amdahl[1]=coeffs_Amdahl[1]*coeffs_Amdahl[0]/D[0]
     coeffs_Amdahl[2]=coeffs_Amdahl[2]*coeffs_Amdahl[0]/D[0]
     coeffs_Amdahl[0]=D[0]
-    print "Amdahl Normalized: T=%.2f(%.6f+%.6f/N)" % \
-        (coeffs_Amdahl[0],coeffs_Amdahl[1],coeffs_Amdahl[2])
+    print("Amdahl Normalized: T=%.2f(%.6f+%.6f/N)" % \
+        (coeffs_Amdahl[0],coeffs_Amdahl[1],coeffs_Amdahl[2]))
   except:
-    print "Impossible to fit for Amdahl law : only %i elements" % len(D) 
+    print("Impossible to fit for Amdahl law : only %i elements" % len(D))
 
   try:
     coeffs_AmdahlR, matcov_AmdahlR = curve_fit(AmdahlR, N, D)
@@ -635,11 +635,11 @@
     D_AmdahlR=AmdahlR(N,coeffs_AmdahlR[0],coeffs_AmdahlR[1])
     coeffs_AmdahlR[1]=coeffs_AmdahlR[1]*coeffs_AmdahlR[0]/D[0]
     coeffs_AmdahlR[0]=D[0]
-    print "Amdahl Reduced Normalized: T=%.2f(%.6f+%.6f/N)" % \
-        (coeffs_AmdahlR[0],1-coeffs_AmdahlR[1],coeffs_AmdahlR[1])
+    print("Amdahl Reduced Normalized: T=%.2f(%.6f+%.6f/N)" % \
+        (coeffs_AmdahlR[0],1-coeffs_AmdahlR[1],coeffs_AmdahlR[1]))
 
   except:
-    print "Impossible to fit for Reduced Amdahl law : only %i elements" % len(D) 
+    print("Impossible to fit for Reduced Amdahl law : only %i elements" % len(D))
 
   try:
     coeffs_Mylq, matcov_Mylq = curve_fit(Mylq, N, D)
@@ -648,14 +648,14 @@
     # coeffs_Mylq[2]=coeffs_Mylq[2]*coeffs_Mylq[0]/D[0]
     coeffs_Mylq[3]=coeffs_Mylq[3]*coeffs_Mylq[0]/D[0]
     coeffs_Mylq[0]=D[0]
-    print "Mylq Normalized : T=%.2f(%.6f+%.6f/N)+%.6f*N" % (coeffs_Mylq[0],
+    print("Mylq Normalized : T=%.2f(%.6f+%.6f/N)+%.6f*N" % (coeffs_Mylq[0],
                                                             coeffs_Mylq[1],
                                                             coeffs_Mylq[3],
-                                                            coeffs_Mylq[2])
+                                                            coeffs_Mylq[2]))
     D_Mylq=Mylq(N,coeffs_Mylq[0],coeffs_Mylq[1],coeffs_Mylq[2],
                 coeffs_Mylq[3])
   except:
-    print "Impossible to fit for Mylq law : only %i elements" % len(D) 
+    print("Impossible to fit for Mylq law : only %i elements" % len(D))
 
   try:
     coeffs_Mylq2, matcov_Mylq2 = curve_fit(Mylq2, N, D)
@@ -665,12 +665,12 @@
     # coeffs_Mylq2[3]=coeffs_Mylq2[3]*coeffs_Mylq2[0]/D[0]
     coeffs_Mylq2[4]=coeffs_Mylq2[4]*coeffs_Mylq2[0]/D[0]
     coeffs_Mylq2[0]=D[0]
-    print "Mylq 2nd order Normalized: T=%.2f(%.6f+%.6f/N)+%.6f*N+%.6f*N^2" % \
-        (coeffs_Mylq2[0],coeffs_Mylq2[1],
-         coeffs_Mylq2[4],coeffs_Mylq2[2],coeffs_Mylq2[3])
+    print("Mylq 2nd order Normalized: T=%.2f(%.6f+%.6f/N)+%.6f*N+%.6f*N^2" % \
+          (coeffs_Mylq2[0],coeffs_Mylq2[1],
+           coeffs_Mylq2[4],coeffs_Mylq2[2],coeffs_Mylq2[3]))
 
   except:
-    print "Impossible to fit for 2nd order Mylq law : only %i elements" % len(D) 
+    print("Impossible to fit for 2nd order Mylq law : only %i elements" % len(D) )
 
   if Curves:
     plt.xlabel("Number of Threads/work Items")
@@ -681,7 +681,7 @@
       pAmdahl,=plt.plot(N,D_Amdahl,label="Loi de Amdahl")    
       pMylq,=plt.plot(N,D_Mylq,label="Loi de Mylq")
     except:
-      print "Fit curves seem not to be available"
+      print("Fit curves seem not to be available")
 
     plt.legend()
     plt.show()
@@ -721,14 +721,14 @@
   try:
     opts, args = getopt.getopt(sys.argv[1:],"hocfa:g:p:i:s:e:t:r:d:m:",["alu=","gpustyle=","parastyle=","iterations=","jobstart=","jobend=","jobstep=","redo=","device="])
   except getopt.GetoptError:
-    print '%s -o (Out of Core Metrology) -c (Print Curves) -f (Fit to Amdahl Law) -a <CPU/GPU/ACCELERATOR> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats> -m <MemoryRaw>' % sys.argv[0]
+    print('%s -o (Out of Core Metrology) -c (Print Curves) -f (Fit to Amdahl Law) -a <CPU/GPU/ACCELERATOR> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats> -m <MemoryRaw>' % sys.argv[0])
     sys.exit(2)
     
   for opt, arg in opts:
     if opt == '-h':
-      print '%s -o (Out of Core Metrology) -c (Print Curves) -f (Fit to Amdahl Law) -a <CPU/GPU/ACCELERATOR> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats> -m <MemoryRaw>' % sys.argv[0]
+      print('%s -o (Out of Core Metrology) -c (Print Curves) -f (Fit to Amdahl Law) -a <CPU/GPU/ACCELERATOR> -d <DeviceId> -g <CUDA/OpenCL> -p <Threads/Hybrid/Blocks> -i <Iterations> -s <JobStart> -e <JobEnd> -t <JobStep> -r <RedoToImproveStats> -m <MemoryRaw>' % sys.argv[0])
 
-      print "\nInformations about devices detected under OpenCL:"
+      print("\nInformations about devices detected under OpenCL:")
       # For PyOpenCL import
       try:
         import pyopencl as cl
@@ -737,13 +737,13 @@
           for device in platform.get_devices():
             #deviceType=cl.device_type.to_string(device.type)
             deviceMemory=device.max_mem_alloc_size
-            print "Device #%i from %s with memory %i : %s" % (Id,platform.vendor,deviceMemory,device.name.lstrip())
+            print("Device #%i from %s with memory %i : %s" % (Id,platform.vendor,deviceMemory,device.name.lstrip()))
             Id=Id+1
 
-        print
+        print()
         sys.exit()
       except ImportError:
-        print "Your platform does not seem to support OpenCL"
+        print("Your platform does not seem to support OpenCL")
         
     elif opt == '-o':
       OutMetrology=True
@@ -774,23 +774,23 @@
       Memory = int(arg)
 
   if Alu=='CPU' and GpuStyle=='CUDA':
-    print "Alu can't be CPU for CUDA, set Alu to GPU"
+    print("Alu can't be CPU for CUDA, set Alu to GPU")
     Alu='GPU'
 
   if ParaStyle not in ('Blocks','Threads','Hybrid'):
-    print "%s not exists, ParaStyle set as Threads !" % ParaStyle
+    print("%s not exists, ParaStyle set as Threads !" % ParaStyle)
     ParaStyle='Blocks'
 
-  print "Compute unit : %s" % Alu
-  print "Device Identification : %s" % Device
-  print "GpuStyle used : %s" % GpuStyle
-  print "Parallel Style used : %s" % ParaStyle
-  print "Iterations : %s" % Iterations
-  print "Number of threads on start : %s" % JobStart
-  print "Number of threads on end : %s" % JobEnd
-  print "Number of redo : %s" % Redo
-  print "Memory  : %s" % Memory
-  print "Metrology done out of CPU/GPU : %r" % OutMetrology
+  print("Compute unit : %s" % Alu)
+  print("Device Identification : %s" % Device)
+  print("GpuStyle used : %s" % GpuStyle)
+  print("Parallel Style used : %s" % ParaStyle)
+  print("Iterations : %s" % Iterations)
+  print("Number of threads on start : %s" % JobStart)
+  print("Number of threads on end : %s" % JobEnd)
+  print("Number of redo : %s" % Redo)
+  print("Memory  : %s" % Memory)
+  print("Metrology done out of CPU/GPU : %r" % OutMetrology)
 
   if GpuStyle=='CUDA':
     try:
@@ -800,7 +800,7 @@
       import pycuda.autoinit
       from pycuda.compiler import SourceModule
     except ImportError:
-      print "Platform does not seem to support CUDA"
+      print("Platform does not seem to support CUDA")
 
   if GpuStyle=='OpenCL':
     try:
@@ -810,13 +810,13 @@
       for platform in cl.get_platforms():
         for device in platform.get_devices():
           #deviceType=cl.device_type.to_string(device.type)
-          print "Device #%i : %s" % (Id,device.name)
+          print("Device #%i : %s" % (Id,device.name))
           if Id == Device:
             # Set the Alu as detected Device Type
             Alu='xPU'
           Id=Id+1
     except ImportError:
-      print "Platform does not seem to support CUDA"
+      print("Platform does not seem to support CUDA")
       
   average=numpy.array([]).astype(numpy.float32)
   median=numpy.array([]).astype(numpy.float32)
@@ -840,41 +840,41 @@
             a,m,s=MetropolisCuda(circle,Iterations,1,Jobs,ParaStyle,
                                  Memory)
           except:
-            print "Problem with %i // computations on Cuda" % Jobs
+            print("Problem with %i // computations on Cuda" % Jobs)
         elif GpuStyle=='OpenCL':
           try:
             a,m,s=MetropolisOpenCL(circle,Iterations,1,Jobs,ParaStyle,
                                    Alu,Device,Memory)
           except:
-            print "Problem with %i // computations on OpenCL" % Jobs            
+            print("Problem with %i // computations on OpenCL" % Jobs)
         duration=numpy.append(duration,time.time()-start)
       if (a,m,s) != (0,0,0):
         avg=numpy.mean(duration)
         med=numpy.median(duration)
         std=numpy.std(duration)
       else:
-        print "Values seem to be wrong..."
+        print("Values seem to be wrong...")
     else:
       if GpuStyle=='CUDA':
         try:
           avg,med,std=MetropolisCuda(circle,Iterations,Redo,
                                      Jobs,ParaStyle,Memory)
         except:
-          print "Problem with %i // computations on Cuda" % Jobs
+          print("Problem with %i // computations on Cuda" % Jobs)
       elif GpuStyle=='OpenCL':
         try:
           avg,med,std=MetropolisOpenCL(circle,Iterations,Redo,Jobs,
                                        ParaStyle,Alu,Device,Memory)
         except:
-          print "Problem with %i // computations on OpenCL" % Jobs            
+          print("Problem with %i // computations on OpenCL" % Jobs)           
 
     if (avg,med,std) != (0,0,0):
-      print "jobs,avg,med,std",Jobs,avg,med,std
+      print("jobs,avg,med,std",Jobs,avg,med,std)
       average=numpy.append(average,avg)
       median=numpy.append(median,med)
       stddev=numpy.append(stddev,std)
     else:
-      print "Values seem to be wrong..."
+      print("Values seem to be wrong...")
     #THREADS*=2
     if len(average)!=0:
       numpy.savez("Splutter_%s_%s_%s_%i_%i_%.8i_Device%i_%s_%s" % (Alu,GpuStyle,ParaStyle,JobStart,JobEnd,Iterations,Device,Metrology,gethostname()),(ExploredJobs,average,median,stddev))
