Changeset 25758 for issm/trunk-jpl/src/m/solve/solve.py
- Timestamp:
- 11/16/20 13:22:37 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/solve/solve.py
r25499 r25758 1 import datetime1 from datetime import datetime 2 2 import os 3 3 import shutil … … 16 16 Usage: 17 17 md = solve(md, solutionstring, varargin) 18 where varargin is a list of paired arguments of string OR enums 18 19 where varargin is a list of paired arguments of string OR enums 19 20 20 solution types available comprise:21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 21 Solution types available comprise: 22 - 'Stressbalance' or 'sb' 23 - 'Masstransport' or 'mt' 24 - 'Thermal' or 'th' 25 - 'Steadystate' or 'ss' 26 - 'Transient' or 'tr' 27 - 'Balancethickness' or 'mc' 28 - 'Balancevelocity' or 'bv' 29 - 'BedSlope' or 'bsl' 30 - 'SurfaceSlope' or 'ssl' 31 - 'Hydrology' or 'hy' 32 - 'DamageEvolution' or 'da' 33 - 'Gia' or 'gia' 34 - 'Esa' or 'esa' 35 - 'Sealevelrise' or 'slr' 36 - 'Love' or 'lv' 36 37 37 extra options: 38 - loadonly : does not solve. only load results 39 - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures 40 checks on consistency of model 41 - restart : 'directory name (relative to the execution 42 directory) where the restart file is located 38 Extra options: 39 - loadonly : does not solve. only load results 40 - runtimename : true or false (default is true), makes name unique 41 - checkconsistency : 'yes' or 'no' (default is 'yes'), ensures checks on 42 consistency of model 43 - restart : directory name (relative to the execution directory) 44 where the restart file is located 43 45 44 46 Examples: … … 47 49 """ 48 50 49 # recover and process solve options51 # Recover and process solve options 50 52 if solutionstring.lower() == 'sb' or solutionstring.lower() == 'stressbalance': 51 53 solutionstring = 'StressbalanceSolution' … … 82 84 options = pairoptions('solutionstring', solutionstring, *args) 83 85 84 # recover some fields86 # Recover some fields 85 87 md.private.solution = solutionstring 86 88 cluster = md.cluster … … 90 92 batch = 0 91 93 92 # check model consistency94 # Check model consistency 93 95 if options.getfieldvalue('checkconsistency', 'yes') == 'yes': 94 96 if md.verbose.solution: … … 96 98 ismodelselfconsistent(md) 97 99 98 # First, build a runtime name that is unique100 # First, build a runtime name that is unique 99 101 restart = options.getfieldvalue('restart', '') 100 102 if restart == 1: 101 pass # do nothing103 pass # do nothing 102 104 else: 103 105 if restart: … … 105 107 else: 106 108 if options.getfieldvalue('runtimename', True): 107 c = datetime. datetime.now()109 c = datetime.now() 108 110 md.private.runtimename = "%s-%02i-%02i-%04i-%02i-%02i-%02i-%i" % (md.miscellaneous.name, c.month, c.day, c.year, c.hour, c.minute, c.second, os.getpid()) 109 111 else: 110 112 md.private.runtimename = md.miscellaneous.name 111 113 112 # if running qmu analysis, some preprocessing of dakota files using models113 # fields needs to be carried out.114 # If running QMU analysis, some preprocessing of Dakota files using models 115 # fields needs to be carried out 114 116 if md.qmu.isdakota: 115 117 md = preqmu(md, options) 116 118 117 # Do we load results only?119 # Do we load results only? 118 120 if options.getfieldvalue('loadonly', False): 119 121 md = loadresultsfromcluster(md) 120 122 return md 121 123 122 # Write all input files123 marshall(md) 124 md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits') 125 cluster.BuildQueueScript(md.private.runtimename, md.miscellaneous.name, md.private.solution, md.settings.io_gather, md.debug.valgrind, md.debug.gprof, md.qmu.isdakota, md.transient.isoceancoupling) 124 # Write all input files 125 marshall(md) # bin file 126 md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits') # toolkits file 127 cluster.BuildQueueScript(md.private.runtimename, md.miscellaneous.name, md.private.solution, md.settings.io_gather, md.debug.valgrind, md.debug.gprof, md.qmu.isdakota, md.transient.isoceancoupling) # queue file 126 128 127 # Stop here if batch mode129 # Stop here if batch mode 128 130 if options.getfieldvalue('batch', 'no') == 'yes': 129 131 print('batch mode requested: not launching job interactively') … … 131 133 return md 132 134 133 # Upload all required files:135 # Upload all required files: 134 136 modelname = md.miscellaneous.name 135 137 filelist = [modelname + '.bin ', modelname + '.toolkits ', modelname + '.queue '] … … 140 142 cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist) 141 143 142 # Launch job144 # Launch job 143 145 cluster.LaunchQueueJob(md.miscellaneous.name, md.private.runtimename, filelist, restart, batch) 144 146 145 # wait on lock147 # Wait on lock 146 148 if md.settings.waitonlock > 0: 147 #we wait for the done file148 149 islock = waitonlock(md) 149 if islock == 0: # no results to be loaded150 if islock == 0: # no results to be loaded 150 151 print('The results must be loaded manually with md = loadresultsfromcluster(md).') 151 else: # load results152 else: # load results 152 153 if md.verbose.solution: 153 154 print('loading results from cluster') 154 155 md = loadresultsfromcluster(md) 156 155 157 return md
Note:
See TracChangeset
for help on using the changeset viewer.