Skip to content
Snippets Groups Projects

params/mirrors cleaning + usable test suite (issues #11 and #10)

Merged Boman Romain requested to merge testsuite into master
3 files
+ 38
104
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 37
46
@@ -90,25 +90,33 @@ def findbins(dirB=['build','wavesB']): # changer wavesB en autre chose !
def initMKL(nthreads):
import os
#os.environ['MKL_NUM_THREADS'] = '%d' % nthreads
#os.environ['MKL_DOMAIN_NUM_THREADS'] = 'MKL_BLAS=%d' % nthreads
#os.environ['OMP_NUM_THREADS'] = '1' # tjs 1!
#os.environ['MKL_DYNAMIC'] = 'FALSE'
#os.environ['OMP_DYNAMIC'] = 'FALSE'
#print "nthreads(MKL)=%d" % nthreads
print "OMP environement"
print os.system('env | grep OMP')
print "MKL environement"
print os.system('env | grep MKL')
print "KMP environement"
print os.system('env | grep KMP')
# we try to have full control over the threading environment
# => set MKL/OMP variables if (and only if) they are not set!
if not 'MKL_NUM_THREADS' in os.environ:
os.environ['MKL_NUM_THREADS'] = '%d' % nthreads
if not 'MKL_DOMAIN_NUM_THREADS' in os.environ:
os.environ['MKL_DOMAIN_NUM_THREADS'] = 'MKL_BLAS=%d' % nthreads
if not 'OMP_NUM_THREADS' in os.environ:
os.environ['OMP_NUM_THREADS'] = '1'
if not 'MKL_DYNAMIC' in os.environ:
os.environ['MKL_DYNAMIC'] = 'FALSE'
if not 'OMP_DYNAMIC' in os.environ:
os.environ['OMP_DYNAMIC'] = 'FALSE'
# display variables
for s in ['OMP_', 'MKL', 'KMP']:
print '* %s environment:' % s
for key, value in os.environ.iteritems():
if s in key:
print '\t%s = %s' % (key, value)
# ------------------------------------------------------------------------------
def mpi_setupwdir(testname):
def setupwdir(testname):
"""
creates a working folder for each test
creates a single working folder for the given test
"""
try:
# are we using MPI?
import mpi4py.MPI as mpi
comm = mpi.COMM_WORLD
rank = comm.rank
@@ -120,51 +128,34 @@ def mpi_setupwdir(testname):
rank = 0
siz = 1
name = "noname"
import os, os.path
# builds the name of the workspace folder
#print "__file__=",__file__
dir1=os.path.abspath(os.path.dirname(__file__)+os.sep+"..")+os.sep
#print "dir1=",dir1
#print "testname=",testname
print "dir1=",dir1
print "testname=",testname
common = os.path.commonprefix( (testname, dir1) )
#print "common=", common
resdir = testname[len(common):].replace(os.sep,"_")
resdir = os.path.splitext(resdir)[0] # remove ".py"
#print "resdir=", resdir
wdir=os.path.join('workspace', resdir)
if rank == 0:
#if not os.path.isdir('workspace'):
# os.makedirs('workspace')
if rank == 0:
# rank0 is in charge of creating the folder...
if not os.path.isdir(wdir):
print "creating", wdir
os.makedirs(wdir)
for i in range(1,siz):
comm.send(1, dest=i, tag=11)
if siz>1: # if multiple process => send sync to slaves.
for i in range(1,siz):
comm.send(1, dest=i, tag=11)
else:
data = comm.recv(source=0, tag=11)
os.chdir(wdir)
# ------------------------------------------------------------------------------
def setupwdir(testname):
"""
creates a working folder for each test
"""
import os, os.path
#print "__file__=",__file__
dir1=os.path.abspath(os.path.dirname(__file__)+os.sep+"..")+os.sep
print "dir1=",dir1
print "testname=",testname
common = os.path.commonprefix( (testname, dir1) )
#print "common=", common
resdir = testname[len(common):].replace(os.sep,"_")
resdir = os.path.splitext(resdir)[0] # remove ".py"
#print "resdir=", resdir
wdir=os.path.join('workspace', resdir)
if not os.path.isdir(wdir):
print "creating", wdir
os.makedirs(wdir)
# the others block and wait for rank0 ([RB] why not "mpi_barrier"????)
data = comm.recv(source=0, tag=11)
# we can now safely go into the new folder
os.chdir(wdir)
# ------------------------------------------------------------------------------
Loading