Changeset 213
- Timestamp:
- 03/18/10 16:28:02 (6 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UQ/math/examples/QSUB_surrogate_diam_batchgrid.py
r209 r213 62 62 63 63 # MPI config 64 nnodes = 4# = npop64 nnodes = '4:core4:ppn=1' # = npop 65 65 66 66 # QUEUE config 67 queue = ' normal'67 queue = 'weekdayQ' 68 68 timelimit = '00:10' 69 69 -
pyina/applications/ezrun.py
r198 r213 23 23 func = pickle.load(open(funcname,'r')) 24 24 else: # used ez_map 25 sys.path = [sys.argv[4]] + sys.path 25 26 module = __import__(funcname) 27 sys.path.pop(0) 26 28 func = module.FUNC 27 29 arglist = pickle.load(open(sys.argv[2],'r')) -
pyina/applications/ezrun2.py
r198 r213 23 23 func = pickle.load(open(funcname,'r')) 24 24 else: # used ez_map 25 sys.path = [sys.argv[4]] + sys.path 25 26 module = __import__(funcname) 27 sys.path.pop(0) 26 28 func = module.FUNC 27 29 arglist = pickle.load(open(sys.argv[2],'r')) -
pyina/examples_other/test_ezmap.py
r205 r213 8 8 return "Rank: %d -- %s" % (id, socket.gethostname()) 9 9 10 res = ez_map(host, range(5), nnodes=10, mapper=carddealer_mapper) 10 res = ez_map(host, range(10), nnodes=3, mapper=carddealer_mapper) 11 #res = ez_map(host, range(10), nnodes=3, mapper=equalportion_mapper) 11 12 #res = ez_map(host, range(5), nnodes=2, mapper=carddealer_mapper) 13 #res = ez_map(host, range(5), nnodes=2, mapper=equalportion_mapper) 14 #res = ez_map(host, range(5), nnodes=10, mapper=carddealer_mapper) 15 #res = ez_map(host, range(5), nnodes=10, mapper=equalportion_mapper) 16 #NOTE: bug? map algorithm performs correctly when nnodes > range ??? 12 17 13 18 print '\n'.join(res) -
pyina/pyina/differential_evolution_ezmap.py
r209 r213 431 431 self._launcher = None 432 432 self._nnodes = None 433 self._queue = None 434 self._timelimit = None 433 435 434 436 def SetMapper(self, mapper): -
pyina/pyina/ez_map.py
r212 r213 79 79 import dill as pickle #XXX: to address costfactories 80 80 import tempfile 81 # pickle.dump(src(func), file)82 file = tempfile.NamedTemporaryFile(suffix='.py', dir= '.')81 #XXX: assumes '.' is writable and on $PYTHONPATH 82 file = tempfile.NamedTemporaryFile(suffix='.py', dir=ezdefaults['tmpdir']) 83 83 file.write(''.join(src(func))) 84 84 file.write('FUNC = %s\n' % func.func_name) … … 100 100 'python' : '`which mpipython.exe`' , 101 101 'nodes' : '1', 102 'progargs' : '' 102 'progargs' : '', 103 'tmpdir' : '.' 103 104 } 104 105 … … 109 110 import dill as pickle 110 111 import tempfile 111 file = tempfile.NamedTemporaryFile(suffix=suffix, dir= '.')112 file = tempfile.NamedTemporaryFile(suffix=suffix, dir=ezdefaults['tmpdir']) 112 113 pickle.dump(arglist, file) 113 114 file.flush() … … 132 133 - queue -- string name of selected queue (e.g. 'normal') 133 134 """ 135 import dill as pickle 136 import os.path, tempfile, os 134 137 # mapper = None (allow for use of default mapper) 135 138 if kwds.has_key('mapper'): … … 146 149 if kwds.has_key('launcher'): launcher = kwds['launcher'] 147 150 else: launcher = mpirun_launcher #XXX: default = non_mpi? 148 149 import dill as pickle 150 import os.path, tempfile, os 151 # set scratch directory (most often required for queue launcher) 152 if kwds.has_key('tmpdir'): ezdefaults['tmpdir'] = kwds['tmpdir'] 153 else: 154 if launcher in [torque_launcher]: 155 ezdefaults['tmpdir'] = os.path.expanduser("~") 156 151 157 modfile = func_pickle(func) 152 158 argfile = arg_pickle(arglist) 153 resfilename = tempfile.mktemp(dir= '.')159 resfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 154 160 modname = os.path.splitext(os.path.basename(modfile.name))[0] 155 ezdefaults['progargs'] = ' '.join([modname, argfile.name, resfilename]) 161 ezdefaults['progargs'] = ' '.join([modname, argfile.name, resfilename, \ 162 ezdefaults['tmpdir']]) 156 163 #HOLD.append(modfile) 157 164 #HOLD.append(argfile) 158 165 159 166 if launcher == torque_launcher: 160 jobfilename = tempfile.mktemp(dir= '.')161 outfilename = tempfile.mktemp(dir= '.')162 errfilename = tempfile.mktemp(dir= '.')167 jobfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 168 outfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 169 errfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 163 170 ezdefaults['jobfile'] = jobfilename 164 171 ezdefaults['outfile'] = outfilename … … 194 201 same functionality as ez_map, however function 'func' and arguments 'arglist' 195 202 are stored and sent as pickled strings.""" 203 import dill as pickle 204 import os.path, tempfile, os 196 205 # mapper = None (allow for use of default mapper) 197 206 if kwds.has_key('mapper'): … … 208 217 if kwds.has_key('launcher'): launcher = kwds['launcher'] 209 218 else: launcher = mpirun_launcher #XXX: default = non_mpi? 210 211 import dill as pickle 212 import os.path, tempfile, os 219 # set scratch directory (most often required for queue launcher) 220 if kwds.has_key('tmpdir'): ezdefaults['tmpdir'] = kwds['tmpdir'] 221 else: 222 if launcher in [torque_launcher]: 223 ezdefaults['tmpdir'] = os.path.expanduser("~") 224 213 225 modfile = func_pickle2(func) 214 226 argfile = arg_pickle(arglist) 215 resfilename = tempfile.mktemp(dir='.') 216 ezdefaults['progargs'] = ' '.join([modfile.name, argfile.name, resfilename]) 227 resfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 228 ezdefaults['progargs'] = ' '.join([modfile.name,argfile.name,resfilename, \ 229 ezdefaults['tmpdir']]) 217 230 #HOLD.append(modfile) 218 231 #HOLD.append(argfile) 219 232 220 233 if launcher == torque_launcher: 221 jobfilename = tempfile.mktemp(dir= '.')222 outfilename = tempfile.mktemp(dir= '.')223 errfilename = tempfile.mktemp(dir= '.')234 jobfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 235 outfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 236 errfilename = tempfile.mktemp(dir=ezdefaults['tmpdir']) 224 237 ezdefaults['jobfile'] = jobfilename 225 238 ezdefaults['outfile'] = outfilename -
pyina/pyina/launchers.py
r212 r213 16 16 if error: raise IOError, "launch failed" 17 17 return error 18 18 19 20 def tasks(nodes): 21 """ compute # of tasks from node string of pattern = N[:TYPE][:ppn=P] 22 For example, tasks("3:core4:ppn=2") yields 6 """ 23 nodestr = str(nodes) 24 nodelst = nodestr.split(":") 25 n = int(nodelst[0]) 26 nodelst = nodestr.split("ppn=") 27 if len(nodelst) > 1: 28 ppn = nodelst[1] 29 ppn = int(ppn.split(":")[0]) 30 else: ppn = 1 31 tasks = n*ppn 32 return tasks 33 19 34 20 35 def serial_launcher(kdict={}): … … 53 68 mydict = defaults.copy() 54 69 mydict.update(kdict) 55 str = """ echo \"mpirun -np %(nodes)s %(python)s %(file)s %(progargs)s\" | qsub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict56 #XXX: would be nice to allow "-l nodes=x:ppn=y" in qsub70 mydict['tasks'] = tasks(mydict['nodes']) 71 str = """ echo \"mpirun -np %(tasks)s %(python)s %(file)s %(progargs)s\" | qsub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict 57 72 return str 58 73
Note: See TracChangeset
for help on using the changeset viewer.