Index: Pi/XPU/PiXpuMPI.py
===================================================================
--- Pi/XPU/PiXpuMPI.py	(revision 126)
+++ Pi/XPU/PiXpuMPI.py	(revision 127)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 #
 # Pi-by-MonteCarlo using PyCUDA/PyOpenCL
@@ -81,7 +81,7 @@
         try:
             opts, args = getopt.getopt(sys.argv[1:],"hocg:i:b:e:s:f:l:t:r:d:m:v:",["gpustyle=","iterations=","blocksBegin=","blocksEnd=","blocksStep=","threadsFirst=","threadsLast=","threadssTep=","redo=","device=","marsaglia=","valuetype="])
         except getopt.GetoptError:
-            print HowToUse % sys.argv[0]
+            print(HowToUse % sys.argv[0])
             sys.exit(2)
 
         # List of Devices
@@ -90,9 +90,9 @@
         
         for opt, arg in opts:
             if opt == '-h':
-                print HowToUse % sys.argv[0]
+                print(HowToUse % 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
@@ -100,12 +100,12 @@
                     for platform in cl.get_platforms():
                         for device in platform.get_devices():
                             deviceType=cl.device_type.to_string(device.type)
-                            print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip())
+                            print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip()))
                             Id=Id+1
 
                     print
                 except:
-                    print "Your platform does not seem to support OpenCL"
+                    print("Your platform does not seem to support OpenCL")
 
                 # For PyCUDA import
                 try:
@@ -113,10 +113,10 @@
                     cuda.init()
                     for Id in range(cuda.Device.count()):
                         device=cuda.Device(Id)
-                        print "Device #%i of type GPU : %s" % (Id,device.name())
+                        print("Device #%i of type GPU : %s" % (Id,device.name()))
                     print
                 except:
-                    print "Your platform does not seem to support CUDA"
+                    print("Your platform does not seem to support CUDA")
         
                 sys.exit()
                     
@@ -150,19 +150,19 @@
             elif opt in ("-r", "--redo"):
                 Redo = int(arg)
 
-        print "Devices Identification : %s" % Devices
-        print "GpuStyle used : %s" % GpuStyle
-        print "Iterations : %s" % Iterations
-        print "Number of Blocks on begin : %s" % BlocksBegin
-        print "Number of Blocks on end : %s" % BlocksEnd
-        print "Step on Blocks : %s" % BlocksStep
-        print "Number of Threads on begin : %s" % ThreadsBegin
-        print "Number of Threads on end : %s" % ThreadsEnd
-        print "Step on Threads : %s" % ThreadsStep
-        print "Number of redo : %s" % Redo
-        print "Metrology done out of XPU : %r" % OutMetrology
-        print "Type of Marsaglia RNG used : %s" % RNG
-        print "Type of variable : %s" % ValueType
+        print("Devices Identification : %s" % Devices)
+        print("GpuStyle used : %s" % GpuStyle)
+        print("Iterations : %s" % Iterations)
+        print("Number of Blocks on begin : %s" % BlocksBegin)
+        print("Number of Blocks on end : %s" % BlocksEnd)
+        print("Step on Blocks : %s" % BlocksStep)
+        print("Number of Threads on begin : %s" % ThreadsBegin)
+        print("Number of Threads on end : %s" % ThreadsEnd)
+        print("Step on Threads : %s" % ThreadsStep)
+        print("Number of redo : %s" % Redo)
+        print("Metrology done out of XPU : %r" % OutMetrology)
+        print("Type of Marsaglia RNG used : %s" % RNG)
+        print("Type of variable : %s" % ValueType)
 
         if GpuStyle=='CUDA':
             try:
@@ -172,7 +172,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:
@@ -182,19 +182,19 @@
                 for platform in cl.get_platforms():
                     for device in platform.get_devices():
                         deviceType=cl.device_type.to_string(device.type)
-                        print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip())
+                        print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip()))
 
                         if Id in Devices:
                             # Set the Alu as detected Device Type
                             Alu[Id]=deviceType
                         Id=Id+1
             except ImportError:
-                print "Platform does not seem to support OpenCL"
+                print("Platform does not seem to support OpenCL")
 
-        print Devices,Alu
+        print(Devices,Alu)
             
-        BlocksList=xrange(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
-        ThreadsList=xrange(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
+        BlocksList=range(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
+        ThreadsList=range(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
     
         ExploredJobs=numpy.array([]).astype(numpy.uint32)
         ExploredBlocks=numpy.array([]).astype(numpy.uint32)
@@ -228,7 +228,7 @@
                         try:
                             Inside,NewIterations,DurationItem=MetropolisCuda(circle,Iterations,1,Blocks,Threads,RNG,ValueType)
                         except:
-                            print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                            print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
                     elif GpuStyle=='OpenCL':
                         try:
                             MetroParamCL={}
@@ -242,7 +242,7 @@
                             
                             OutputCL=MetropolisOpenCL(MetroParamCL)
                         except:
-                            print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            
+                            print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
                     Duration=numpy.append(Duration,time.time()-start)
                     Rate=numpy.append(Rate,NewIterations/Duration[-1])
             else:
@@ -250,7 +250,7 @@
                     try:
                         Inside,NewIterations,Duration=MetropolisCuda(circle,Iterations,Redo,Blocks,Threads,RNG,ValueType)
                     except:
-                        print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                        print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
                 elif GpuStyle=='OpenCL':
                     try:
                         IterationsMPI=numpy.uint64(Iterations/len(Devices))
@@ -268,30 +268,30 @@
                         InputCL['RNG']=RNG
                         InputCL['ValueType']=ValueType
                         for Device in Devices[1:]:
-                            print "Send to device %i on rank %i" % (Device,r)
+                            print("Send to device %i on rank %i" % (Device,r))
                             InputCL['Device']=Device
                             comm.send('CONTINUE',dest=r,tag=11)
                             comm.send(InputCL,dest=r,tag=11)
                             r+=1
 
                         # Compute on rank 0
-                        print "Compute on rank 0"
+                        print("Compute on rank 0")
                         InputCL['Device']=Devices[0]
                         OutputCL=MetropolisOpenCL(InputCL)
                         Inside=OutputCL['Inside']
                         NewIterations=OutputCL['NewIterations']
                             
-                        for slave in xrange(1,len(Devices)):
-                            print "Get OutputCL from %i" % slave
+                        for slave in range(1,len(Devices)):
+                            print("Get OutputCL from %i" % slave)
                             OutputCL=comm.recv(source=slave,tag=11)
-                            print OutputCL
+                            print(OutputCL)
                             NewIterations+=OutputCL['NewIterations']
                             Inside+=OutputCL['Inside']
 
                         Duration=time.time()-time_start
-                        print "Pi estimation %.8f" % (4./NewIterations*Inside)
+                        print("Pi estimation %.8f" % (4./NewIterations*Inside))
                     except:
-                        print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)
+                        print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
             #Duration=OutputCL['Duration']
             #NewIterations=OutputCL['NewIterations']
             Rate=NewIterations/Duration
@@ -307,7 +307,7 @@
             minR=numpy.append(minR,numpy.min(Rate))
             maxR=numpy.append(maxR,numpy.max(Rate))
 
-            print "%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1])
+            print("%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1]))
         
             numpy.savez("Pi_%s_%s_%s_%s_%s_%s_%s_%s_%.8i_Device%i_%s_%s" % (ValueType,RNG,Alu[Devices[0]],GpuStyle,BlocksBegin,BlocksEnd,ThreadsBegin,ThreadsEnd,Iterations,Devices[0],Metrology,gethostname()),(ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR))
             ToSave=[ ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR ]
@@ -316,7 +316,7 @@
             if Fit:
                 FitAndPrint(ExploredJobs,median,Curves)
         # Send MPI exit tag
-        for slave in xrange(1,RankSize):
+        for slave in range(1,RankSize):
             comm.send('BREAK',dest=slave,tag=11)
             
     else:
@@ -325,14 +325,14 @@
             if Signal=='CONTINUE':
                 # Receive information from Master
                 InputCL=comm.recv(source=0,tag=11)
-                print "Parameters retreive for rank %s of %s on %s from master:" % (rank,RankSize,gethostname())
-                print "Input CL:" % InputCL
+                print("Parameters retreive for rank %s of %s on %s from master:" % (rank,RankSize,gethostname()))
+                print("Input CL:" % InputCL)
                 # Execute on slave
                 OutputCL=MetropolisOpenCL(InputCL)
-                print "Output CL:" % OutputCL
+                print("Output CL:" % OutputCL)
                 # Send information to Master
                 comm.send(OutputCL,dest=0,tag=11)
-                print "Data sent to master"
+                print("Data sent to master")
             else:
-                print 'Exit signal from Master'
+                print('Exit signal from Master')
                 break
Index: Pi/XPU/PiXpuThreads.py
===================================================================
--- Pi/XPU/PiXpuThreads.py	(revision 126)
+++ Pi/XPU/PiXpuThreads.py	(revision 127)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 #
 # Pi-by-MonteCarlo using PyCUDA/PyOpenCL
@@ -33,16 +33,14 @@
 class threadWithReturn(Thread):
     def __init__(self, *args, **kwargs):
         super(threadWithReturn, self).__init__(*args, **kwargs)
-
         self._return = None
 
     def run(self):
-        if self._Thread__target is not None:
-            self._return = self._Thread__target(*self._Thread__args, **self._Thread__kwargs)
+        if self._target is not None:
+            self._return = self._target(*self._args, **self._kwargs)
 
     def join(self, *args, **kwargs):
         super(threadWithReturn, self).join(*args, **kwargs)
-
         return self._return
 
 if __name__=='__main__':
@@ -86,7 +84,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:],"hocg:i:b:e:s:f:l:t:r:d:m:v:",["gpustyle=","iterations=","blocksBegin=","blocksEnd=","blocksStep=","threadsFirst=","threadsLast=","threadssTep=","redo=","device=","marsaglia=","valuetype="])
     except getopt.GetoptError:
-        print HowToUse % sys.argv[0]
+        print(HowToUse % sys.argv[0])
         sys.exit(2)
 
     # List of Devices
@@ -95,9 +93,9 @@
         
     for opt, arg in opts:
         if opt == '-h':
-            print HowToUse % sys.argv[0]
+            print(HowToUse % 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
@@ -105,13 +103,13 @@
                 for platform in cl.get_platforms():
                     for device in platform.get_devices():
                         deviceType=cl.device_type.to_string(device.type)
-                        print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip())
+                        print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip()))
                         Id=Id+1
 
                 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
@@ -143,19 +141,19 @@
         elif opt in ("-r", "--redo"):
             Redo = int(arg)
 
-    print "Devices Identification : %s" % Devices
-    print "GpuStyle used : %s" % GpuStyle
-    print "Iterations : %s" % Iterations
-    print "Number of Blocks on begin : %s" % BlocksBegin
-    print "Number of Blocks on end : %s" % BlocksEnd
-    print "Step on Blocks : %s" % BlocksStep
-    print "Number of Threads on begin : %s" % ThreadsBegin
-    print "Number of Threads on end : %s" % ThreadsEnd
-    print "Step on Threads : %s" % ThreadsStep
-    print "Number of redo : %s" % Redo
-    print "Metrology done out of XPU : %r" % OutMetrology
-    print "Type of Marsaglia RNG used : %s" % RNG
-    print "Type of variable : %s" % ValueType
+    print("Devices Identification : %s" % Devices)
+    print("GpuStyle used : %s" % GpuStyle)
+    print("Iterations : %s" % Iterations)
+    print("Number of Blocks on begin : %s" % BlocksBegin)
+    print("Number of Blocks on end : %s" % BlocksEnd)
+    print("Step on Blocks : %s" % BlocksStep)
+    print("Number of Threads on begin : %s" % ThreadsBegin)
+    print("Number of Threads on end : %s" % ThreadsEnd)
+    print("Step on Threads : %s" % ThreadsStep)
+    print("Number of redo : %s" % Redo)
+    print("Metrology done out of XPU : %r" % OutMetrology)
+    print("Type of Marsaglia RNG used : %s" % RNG)
+    print("Type of variable : %s" % ValueType)
 
     if GpuStyle=='CUDA':
         try:
@@ -165,7 +163,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:
@@ -175,19 +173,19 @@
             for platform in cl.get_platforms():
                 for device in platform.get_devices():
                     deviceType=cl.device_type.to_string(device.type)
-                    print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip())
+                    print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip()))
 
                     if Id in Devices:
                     # Set the Alu as detected Device Type
                         Alu[Id]=deviceType
                     Id=Id+1
         except ImportError:
-            print "Platform does not seem to support OpenCL"
+            print("Platform does not seem to support OpenCL")
 
-    print Devices,Alu
+    print(Devices,Alu)
             
-    BlocksList=xrange(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
-    ThreadsList=xrange(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
+    BlocksList=range(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
+    ThreadsList=range(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
     
     ExploredJobs=numpy.array([]).astype(numpy.uint32)
     ExploredBlocks=numpy.array([]).astype(numpy.uint32)
@@ -234,14 +232,14 @@
                         try:
                             MyThread=threadWithReturn(target=MetropolisCUDA, args=(InputCL,))
                         except:
-                            print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                            print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
                     elif GpuStyle=='OpenCL':
                         try:
                             MyThread=threadWithReturn(target=MetropolisOpenCL, args=(InputCL,))
                         except:
-                            print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            
+                            print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            )
                     
-                    print "Start on #%i device..." % Device
+                    print("Start on #%i device..." % Device)
                     MyThread.start()
                     MyThreads.append(MyThread)
 
@@ -251,7 +249,7 @@
                     OutputCL=MyThread.join()
                     NewIterations+=OutputCL['NewIterations']
                     Inside+=OutputCL['Inside']
-                print "Pi equals:",4./NewIterations*Inside
+                print("Pi equals:",4./NewIterations*Inside)
 
                 Duration=numpy.append(Duration,time.time()-time_start)
                 Rate=numpy.append(Rate,NewIterations/Duration[-1])
@@ -271,14 +269,14 @@
                     try:
                         MyThread=threadWithReturn(target=MetropolisCUDA, args=(InputCL,))
                     except:
-                        print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                        print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
                 elif GpuStyle=='OpenCL':
                     try:
                         MyThread=threadWithReturn(target=MetropolisOpenCL, args=(InputCL,))
                     except:
-                        print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            
+                        print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
                     
-                print "Start on #%i device..." % Device
+                print("Start on #%i device..." % Device)
                 MyThread.start()
                 MyThreads.append(MyThread)
 
@@ -289,7 +287,7 @@
                 NewIterations+=OutputCL['NewIterations']
                 Inside+=OutputCL['Inside']
             Duration=time.time()-time_start
-            print "Pi equals:",4./NewIterations*Inside
+            print("Pi equals:",4./NewIterations*Inside)
             Rate=1./Duration*NewIterations
             
         avgD=numpy.append(avgD,numpy.average(Duration))
@@ -303,7 +301,7 @@
         minR=numpy.append(minR,numpy.min(Rate))
         maxR=numpy.append(maxR,numpy.max(Rate))
 
-        print "%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1])
+        print("%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1]))
         
         numpy.savez("Pi_%s_%s_%s_%s_%s_%s_%s_%s_%.8i_Device%i_%s_%s" % (ValueType,RNG,Alu[Devices[0]],GpuStyle,BlocksBegin,BlocksEnd,ThreadsBegin,ThreadsEnd,Iterations,Devices[0],Metrology,gethostname()),(ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR))
         ToSave=[ ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR ]
Index: Pi/XPU/PiXPU.py
===================================================================
--- Pi/XPU/PiXPU.py	(revision 126)
+++ Pi/XPU/PiXPU.py	(revision 127)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 #
 # Pi-by-MonteCarlo using PyCUDA/PyOpenCL
@@ -39,7 +39,7 @@
         self.Max=numpy.max(Data)
         self.Min=numpy.min(Data)
     def display(self):
-        print "%s %s %s %s %s" % (self.Avg,self.Med,self.Std,self.Min,self.Max)
+        print("%s %s %s %s %s" % (self.Avg,self.Med,self.Std,self.Min,self.Max))
 
 class Experience:
     """Metrology for experiences"""
@@ -63,8 +63,8 @@
     def Metrology(self,Data):
         Duration=PenStacle(Data)
         Rate=PenStacle(Iterations/Data)
-        print "Duration %s" % Duration
-        print "Rate %s" % Rate
+        print("Duration %s" % Duration)
+        print("Rate %s" % Rate)
 
 
         
@@ -401,7 +401,7 @@
     
 def MetropolisCuda(InputCU):
 
-    print "Inside ",InputCU
+    print("Inside ",InputCU)
     
     iterations=InputCU['Iterations']
     steps=InputCU['Steps']
@@ -422,7 +422,7 @@
         for Id in range(cuda.Device.count()):
             if Id==Device:
                 XPU=cuda.Device(Id)
-                print "GPU selected %s" % (XPU.name())
+                print("GPU selected %s" % XPU.name())
         print
 
 #        import pycuda.driver as cuda
@@ -430,7 +430,7 @@
 #        import pycuda.autoinit
 
     except ImportError:
-        print "Platform does not seem to support CUDA"
+        print("Platform does not seem to support CUDA")
 
     Context=XPU.make_context()
     circle=numpy.zeros(blocks*threads).astype(numpy.uint64)  
@@ -441,7 +441,7 @@
     try:
         mod = SourceModule(KernelCodeCuda(),options=['--compiler-options','-DTRNG=%i -DTYPE=%s' % (Marsaglia[RNG],Computing[ValueType])])
     except:
-        print "Compilation seems to broke"
+        print("Compilation seems to broke")
   
     MetropolisBlocksCU=mod.get_function("MainLoopBlocks")
     MetropolisThreadsCU=mod.get_function("MainLoopThreads")
@@ -465,15 +465,15 @@
                                numpy.uint32(nprnd(2**32)),
                                grid=(blocks,1),block=(threads,1,1))
         except:
-            print "Crash during CUDA call"
+            print("Crash during CUDA call")
 
         elapsed = time.time()-start_time
-        print "(Blocks/Threads)=(%i,%i) method done in %.2f s..." % (blocks,threads,elapsed)
+        print("(Blocks/Threads)=(%i,%i) method done in %.2f s..." % (blocks,threads,elapsed))
 
         MyDuration[i]=elapsed
 
     OutputCU={'Inside':sum(circle),'NewIterations':numpy.uint64(iterationsCU*jobs),'Duration':MyDuration}
-    print OutputCU
+    print(OutputCU)
     
     Context.detach()
     return(OutputCU)
@@ -482,7 +482,7 @@
 
     import pyopencl as cl
 
-    print "Inside ",InputCL
+    print("Inside ",InputCL)
     
     iterations=InputCL['Iterations']
     steps=InputCL['Steps']
@@ -501,12 +501,12 @@
         for device in platform.get_devices():
             if Id==Device:
                 XPU=device
-                print "CPU/GPU selected: ",device.name.lstrip()
+                print("CPU/GPU selected: ",device.name.lstrip())
                 HasXPU=True
             Id+=1
 
     if HasXPU==False:
-        print "No XPU #%i found in all of %i devices, sorry..." % (Device,Id-1)
+        print("No XPU #%i found in all of %i devices, sorry..." % (Device,Id-1))
         sys.exit()              
 
     # Je cree le contexte et la queue pour son execution
@@ -514,7 +514,7 @@
         ctx = cl.Context([XPU])
         queue = cl.CommandQueue(ctx,properties=cl.command_queue_properties.PROFILING_ENABLE)
     except:
-        print "Crash during context creation"
+        print("Crash during context creation")
 
     # Je recupere les flag possibles pour les buffers
     mf = cl.mem_flags
@@ -551,7 +551,7 @@
         cl.enqueue_copy(queue, circle, circleCL).wait()
 
         elapsed = time.time()-start_time
-        print "(Blocks/Threads)=(%i,%i) method done in %.2f s..." % (blocks,threads,elapsed)
+        print("(Blocks/Threads)=(%i,%i) method done in %.2f s..." % (blocks,threads,elapsed))
             
         # Elapsed method based on CLLaunch doesn't work for Beignet OpenCL
         # elapsed = 1e-9*(CLLaunch.profile.end - CLLaunch.profile.start)
@@ -565,7 +565,7 @@
     circleCL.release()
 
     OutputCL={'Inside':sum(circle),'NewIterations':numpy.uint64(iterationsCL*jobs),'Duration':MyDuration}
-    print OutputCL
+    print(OutputCL)
     return(OutputCL)
 
 
@@ -581,10 +581,9 @@
         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)
@@ -592,12 +591,10 @@
         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)
@@ -606,14 +603,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)
@@ -623,12 +620,10 @@
         # 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")
@@ -639,7 +634,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()
@@ -685,7 +680,7 @@
     try:
         opts, args = getopt.getopt(sys.argv[1:],"hocg:i:b:e:s:f:l:t:r:d:m:v:",["gpustyle=","iterations=","blocksBegin=","blocksEnd=","blocksStep=","threadsFirst=","threadsLast=","threadssTep=","redo=","device=","marsaglia=","valuetype="])
     except getopt.GetoptError:
-        print HowToUse % sys.argv[0]
+        print(HowToUse % sys.argv[0])
         sys.exit(2)
 
     # List of Devices
@@ -694,9 +689,9 @@
         
     for opt, arg in opts:
         if opt == '-h':
-            print HowToUse % sys.argv[0]
+            print(HowToUse % sys.argv[0])
 
-            print "\nInformations about devices detected under OpenCL API:"
+            print("\nInformations about devices detected under OpenCL API:")
             # For PyOpenCL import
             try:
                 import pyopencl as cl
@@ -704,23 +699,23 @@
                 for platform in cl.get_platforms():
                     for device in platform.get_devices():
                         deviceType=cl.device_type.to_string(device.type)
-                        print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip())
+                        print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip(),deviceType,device.name.lstrip()))
                         Id=Id+1
 
             except:
-                print "Your platform does not seem to support OpenCL"
+                print("Your platform does not seem to support OpenCL")
 
-            print "\nInformations about devices detected under CUDA API:"
+            print("\nInformations about devices detected under CUDA API:")
             # For PyCUDA import
             try:
                 import pycuda.driver as cuda
                 cuda.init()
                 for Id in range(cuda.Device.count()):
                     device=cuda.Device(Id)
-                    print "Device #%i of type GPU : %s" % (Id,device.name())
+                    print("Device #%i of type GPU : %s" % (Id,device.name()))
                 print
             except:
-                print "Your platform does not seem to support CUDA"
+                print("Your platform does not seem to support CUDA")
         
             sys.exit()
         
@@ -755,19 +750,19 @@
         elif opt in ("-r", "--redo"):
             Redo = int(arg)
 
-    print "Devices Identification : %s" % Devices
-    print "GpuStyle used : %s" % GpuStyle
-    print "Iterations : %s" % Iterations
-    print "Number of Blocks on begin : %s" % BlocksBegin
-    print "Number of Blocks on end : %s" % BlocksEnd
-    print "Step on Blocks : %s" % BlocksStep
-    print "Number of Threads on begin : %s" % ThreadsBegin
-    print "Number of Threads on end : %s" % ThreadsEnd
-    print "Step on Threads : %s" % ThreadsStep
-    print "Number of redo : %s" % Redo
-    print "Metrology done out of XPU : %r" % OutMetrology
-    print "Type of Marsaglia RNG used : %s" % RNG
-    print "Type of variable : %s" % ValueType
+    print("Devices Identification : %s" % Devices)
+    print("GpuStyle used : %s" % GpuStyle)
+    print("Iterations : %s" % Iterations)
+    print("Number of Blocks on begin : %s" % BlocksBegin)
+    print("Number of Blocks on end : %s" % BlocksEnd)
+    print("Step on Blocks : %s" % BlocksStep)
+    print("Number of Threads on begin : %s" % ThreadsBegin)
+    print("Number of Threads on end : %s" % ThreadsEnd)
+    print("Step on Threads : %s" % ThreadsStep)
+    print("Number of redo : %s" % Redo)
+    print("Metrology done out of XPU : %r" % OutMetrology)
+    print("Type of Marsaglia RNG used : %s" % RNG)
+    print("Type of variable : %s" % ValueType)
 
     if GpuStyle=='CUDA':
         try:
@@ -777,12 +772,12 @@
             cuda.init()
             for Id in range(cuda.Device.count()):
                 device=cuda.Device(Id)
-                print "Device #%i of type GPU : %s" % (Id,device.name())
+                print("Device #%i of type GPU : %s" % (Id,device.name()))
                 if Id in Devices:
                     Alu[Id]='GPU'
             
         except ImportError:
-            print "Platform does not seem to support CUDA"
+            print("Platform does not seem to support CUDA")
 
     if GpuStyle=='OpenCL':
         try:
@@ -792,19 +787,19 @@
             for platform in cl.get_platforms():
                 for device in platform.get_devices():
                     deviceType=cl.device_type.to_string(device.type)
-                    print "Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip())
+                    print("Device #%i from %s of type %s : %s" % (Id,platform.vendor.lstrip().rstrip(),deviceType,device.name.lstrip().rstrip()))
 
                     if Id in Devices:
                     # Set the Alu as detected Device Type
                         Alu[Id]=deviceType
                     Id=Id+1
         except ImportError:
-            print "Platform does not seem to support OpenCL"
+            print("Platform does not seem to support OpenCL")
 
-    print Devices,Alu
+    print(Devices,Alu)
             
-    BlocksList=xrange(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
-    ThreadsList=xrange(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
+    BlocksList=range(BlocksBegin,BlocksEnd+BlocksStep,BlocksStep)
+    ThreadsList=range(ThreadsBegin,ThreadsEnd+ThreadsStep,ThreadsStep)
     
     ExploredJobs=numpy.array([]).astype(numpy.uint32)
     ExploredBlocks=numpy.array([]).astype(numpy.uint32)
@@ -849,7 +844,7 @@
                         NewIterations=OutputCU['NewIterations']
                         Duration=OutputCU['Duration']
                     except:
-                        print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                        print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
                 elif GpuStyle=='OpenCL':
                     try:
                         InputCL={}
@@ -865,7 +860,7 @@
                         NewIterations=OutputCL['NewIterations']
                         Duration=OutputCL['Duration']
                     except:
-                        print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            
+                        print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
                 Duration=numpy.append(Duration,time.time()-start)
                 Rate=numpy.append(Rate,NewIterations/Duration[-1])
         else:
@@ -884,7 +879,7 @@
                     NewIterations=OutputCU['NewIterations']
                     Duration=OutputCU['Duration']
                 except:
-                    print "Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads)
+                    print("Problem with (%i,%i) // computations on Cuda" % (Blocks,Threads))
             elif GpuStyle=='OpenCL':
                 try:
                     InputCL={}
@@ -900,7 +895,7 @@
                     NewIterations=OutputCL['NewIterations']
                     Duration=OutputCL['Duration']
                 except:
-                    print "Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads)            
+                    print("Problem with (%i,%i) // computations on OpenCL" % (Blocks,Threads))
             Rate=NewIterations/Duration
             
         avgD=numpy.append(avgD,numpy.average(Duration))
@@ -914,7 +909,7 @@
         minR=numpy.append(minR,numpy.min(Rate))
         maxR=numpy.append(maxR,numpy.max(Rate))
 
-        print "%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1])
+        print("%.2f %.2f %.2f %.2f %.2f %i %i %i %i %i" % (avgD[-1],medD[-1],stdD[-1],minD[-1],maxD[-1],avgR[-1],medR[-1],stdR[-1],minR[-1],maxR[-1]))
         
         numpy.savez("Pi_%s_%s_%s_%s_%s_%s_%s_%s_%.8i_Device%i_%s_%s" % (ValueType,RNG,Alu[Devices[0]],GpuStyle,BlocksBegin,BlocksEnd,ThreadsBegin,ThreadsEnd,Iterations,Devices[0],Metrology,gethostname()),(ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR))
         ToSave=[ ExploredBlocks,ExploredThreads,avgD,medD,stdD,minD,maxD,avgR,medR,stdR,minR,maxR ]
