← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2031: Fix setting # of OpenMP threads via -j switch

 

------------------------------------------------------------
revno: 2031
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-02-16 20:52:56 +0100
message:
  Fix setting # of OpenMP threads via -j switch
modified:
  core/main/main.py.in


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2010-02-12 01:28:18 +0000
+++ core/main/main.py.in	2010-02-16 19:52:56 +0000
@@ -29,8 +29,13 @@
 
 opts,args=par.parse_args()
 # c++ boot code checks for YADE_DEBUG at some places; debug verbosity is equivalent
+# do this early, to have debug messages in the boot code (plugin registration etc)
 if opts.verbosity>1: os.environ['YADE_DEBUG']='1'
 
+# this must be done before loading yade libs ("import yade" below)
+# has no effeect after libgomp initializes
+if opts.threads: os.environ['OMP_NUM_THREADS']=str(opts.threads)
+
 sys.stderr.write('Welcome to Yade '+version+'\n')
 
 try:
@@ -64,8 +69,6 @@
 
 # continue option processing
 
-if opts.threads:
-	os.environ['OMP_NUM_THREADS']=str(opts.threads)
 if opts.nice:
 	os.nice(opts.nice)
 if yade.config.debug and opts.noGdb: