Merge commit 'v2.0.2-890-g2cbeb34c'

This commit is contained in:
Test User 2018-11-16 19:07:21 +01:00
commit 9c9836d7a9
2 changed files with 16 additions and 17 deletions

View File

@ -1 +1 @@
v2.0.2-883-ga1f99f4a v2.0.2-889-g47650e94

View File

@ -55,20 +55,19 @@ class Marc(Solver):
import subprocess,shlex import subprocess,shlex
if len(release) == 0: release = self.version() if len(release) == 0: release = self.version()
damaskEnv = damask.environment.Environment() 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 compile:
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.f90'%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%s'%release) user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release))
else: else:
if os.path.isfile(os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc%s.marc'%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%s'%release) user = os.path.join(damaskEnv.relPath('src/'),'DAMASK_marc{}'.format(release))
# Define options [see Marc Installation and Operation Guide, pp 23] # 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) + \ cmd = os.path.join(self.toolsPath(release),script) + \
' -jid ' + model + '_' + job + \ ' -jid ' + model + '_' + job + \
@ -77,24 +76,24 @@ class Marc(Solver):
if compile: cmd += ' -u ' + user+'.f90' + ' -save y' if compile: cmd += ' -u ' + user+'.f90' + ' -save y'
else: cmd += ' -prog ' + user 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: if logfile:
log = open(logfile, 'w') log = open(logfile, 'w')
print(cmd) 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() log.close()
self.p.wait() process.wait()
#-------------------------- #--------------------------
def exit_number_from_outFile(self,outFile=None): def exit_number_from_outFile(self,outFile=None):
import string import string
exitnumber = -1 exitnumber = -1
fid_out = open(outFile,'r') fid_out = open(outFile,'r')
for ln in fid_out: for line in fid_out:
if (string.find(ln,'tress iteration') is not -1): if (string.find(line,'tress iteration') is not -1):
print(ln) print(line)
elif (string.find(ln,'Exit number') is not -1): elif (string.find(line,'Exit number') is not -1):
substr = ln[string.find(ln,'Exit number'):len(ln)] substr = line[string.find(line,'Exit number'):len(line)]
exitnumber = int(substr[12:16]) exitnumber = int(substr[12:16])
fid_out.close() fid_out.close()