Merge commit 'v2.0.2-890-g2cbeb34c'
This commit is contained in:
commit
9c9836d7a9
|
@ -55,20 +55,19 @@ class Marc(Solver):
|
|||
import subprocess,shlex
|
||||
|
||||
if len(release) == 0: release = self.version()
|
||||
|
||||
|
||||
damaskEnv = damask.environment.Environment()
|
||||
|
||||
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc') # first guess, might be updated in the following lines
|
||||
user = 'not found'
|
||||
|
||||
if compile:
|
||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.f90'%release)):
|
||||
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s'%release)
|
||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.f90'.format(release))):
|
||||
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release))
|
||||
else:
|
||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.marc'%release)):
|
||||
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s'%release)
|
||||
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}.marc'.format(release))):
|
||||
user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release))
|
||||
|
||||
# Define options [see Marc Installation and Operation Guide, pp 23]
|
||||
script = 'run_damask_%smp'%({False:'',True:optimization}[optimization!=''])
|
||||
script = 'run_damask_{}mp'.format(optimization)
|
||||
|
||||
cmd = os.path.join(self.toolsPath(release),script) + \
|
||||
' -jid ' + model + '_' + job + \
|
||||
|
@ -77,24 +76,24 @@ class Marc(Solver):
|
|||
if compile: cmd += ' -u ' + user+'.f90' + ' -save y'
|
||||
else: cmd += ' -prog ' + user
|
||||
|
||||
print('job submission with%s compilation: %s'%({False:'out',True:''}[compile],user))
|
||||
print('job submission with{} compilation: {}'.format({False:'out',True:''}[compile],user))
|
||||
if logfile:
|
||||
log = open(logfile, 'w')
|
||||
print(cmd)
|
||||
self.p = subprocess.Popen(shlex.split(cmd),stdout = log,stderr = subprocess.STDOUT)
|
||||
process = subprocess.Popen(shlex.split(cmd),stdout = log,stderr = subprocess.STDOUT)
|
||||
log.close()
|
||||
self.p.wait()
|
||||
process.wait()
|
||||
|
||||
#--------------------------
|
||||
def exit_number_from_outFile(self,outFile=None):
|
||||
import string
|
||||
exitnumber = -1
|
||||
fid_out = open(outFile,'r')
|
||||
for ln in fid_out:
|
||||
if (string.find(ln,'tress iteration') is not -1):
|
||||
print(ln)
|
||||
elif (string.find(ln,'Exit number') is not -1):
|
||||
substr = ln[string.find(ln,'Exit number'):len(ln)]
|
||||
for line in fid_out:
|
||||
if (string.find(line,'tress iteration') is not -1):
|
||||
print(line)
|
||||
elif (string.find(line,'Exit number') is not -1):
|
||||
substr = line[string.find(line,'Exit number'):len(line)]
|
||||
exitnumber = int(substr[12:16])
|
||||
|
||||
fid_out.close()
|
||||
|
|
Loading…
Reference in New Issue