]> SALOME platform Git repositories - plugins/blsurfplugin.git/blobdiff - tests/multithread.py
Salome HOME
Merge V9_dev branch into master
[plugins/blsurfplugin.git] / tests / multithread.py
index e80692b63189597090121cc447a07c47cd9adf02..d5f893609b0e1ed64bf98f4a5fefa4458002b43d 100644 (file)
@@ -7,12 +7,11 @@ import time
 import multiprocessing
 
 salome.salome_init()
-theStudy = salome.myStudy
 
 cpu_count = multiprocessing.cpu_count()
 divider = min(4, cpu_count)/2.
 
-print "Running test on workstation with %d available cores" % cpu_count
+print ("Running test on workstation with %d available cores" % cpu_count)
 
 ###
 ### GEOM component
@@ -24,7 +23,7 @@ import math
 import SALOMEDS
 
 
-geompy = geomBuilder.New(theStudy)
+geompy = geomBuilder.New()
 
 O = geompy.MakeVertex(0, 0, 0)
 OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
@@ -44,7 +43,7 @@ geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
 import  SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 
-smesh = smeshBuilder.New(theStudy)
+smesh = smeshBuilder.New()
 
 Mesh_1 = smesh.Mesh(flight_solid_brep_1)
 MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
@@ -63,7 +62,7 @@ time1 = time.time()
 
 time_multithread = time1-time0
 
-print "Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread)
+print ("Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread))
 
 Mesh_2 = smesh.Mesh(flight_solid_brep_1)
 MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
@@ -81,10 +80,10 @@ isDone = Mesh_2.Compute()
 time3 = time.time()
 
 time_singlethread = time3-time2
-print "Time in single thread (1 proc): %.3s"%(time_singlethread)
+print ("Time in single thread (1 proc): %.3s"%(time_singlethread))
 
 if cpu_count == 1:
-    print "Warning: cannot validate test - only 1 cpu core is available"
+    print ("Warning: cannot validate test - only 1 cpu core is available")
 else:
     assert time_multithread < time_singlethread/divider