Changeset 215
- Timestamp:
- 03/28/10 19:24:19 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pyina/pyina/launchers.py
r213 r215 18 18 19 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 """ 20 def mpirun_tasks(nodes): 21 """ 22 compute mpirun task_string from node string of pattern = N[:TYPE][:ppn=P] 23 For example, mpirun_tasks("3:core4:ppn=2") yields 6 24 """ 23 25 nodestr = str(nodes) 26 nodestr = nodestr.split(",")[0] # remove appended -l expressions 24 27 nodelst = nodestr.split(":") 25 28 n = int(nodelst[0]) … … 33 36 34 37 38 def srun_tasks(nodes): 39 """ 40 compute srun task_string from node string of pattern = N[:ppn=P][,partition=X] 41 For example, srun_tasks("3:ppn=2,partition=foo") yields '3 -N2' 42 """ 43 nodestr = str(nodes) 44 nodestr = nodestr.split(",")[0] # remove appended -l expressions 45 nodelst = nodestr.split(":") 46 n = int(nodelst[0]) 47 nodelst = nodestr.split("ppn=") 48 if len(nodelst) > 1: 49 ppn = nodelst[1] 50 ppn = int(ppn.split(":")[0]) 51 tasks = "%s -N%s" % (n, ppn) 52 else: 53 tasks = "%s" % n 54 return tasks 55 56 35 57 def serial_launcher(kdict={}): 36 58 """ … … 38 60 syntax: (python) (file) (progargs) 39 61 40 NOTE: run non-python commands with: {'python':'', ...} 62 NOTES: 63 - run non-python commands with: {'python':'', ...} 41 64 """ 42 65 mydict = defaults.copy() … … 51 74 syntax: mpirun -np (nodes) (python) (file) (progargs) 52 75 53 NOTE: run non-python commands with: {'python':'', ...} 76 NOTES: 77 - run non-python commands with: {'python':'', ...} 54 78 """ 55 79 mydict = defaults.copy() 56 80 mydict.update(kdict) 57 81 str = """ mpirun -np %(nodes)s %(python)s %(file)s %(progargs)s""" % mydict 82 return str 83 84 85 def srun_launcher(kdict={}): 86 """ 87 prepare launch for parallel execution using srun 88 syntax: srun -n(nodes) (python) (file) (progargs) 89 90 NOTES: 91 - run non-python commands with: {'python':'', ...} 92 - fine-grained resource utilization with: {'nodes':'4 -N1', ...} 93 """ 94 mydict = defaults.copy() 95 mydict.update(kdict) 96 str = """ srun -n%(nodes)s %(python)s %(file)s %(progargs)s""" % mydict 58 97 return str 59 98 … … 64 103 syntax: echo \"mpirun -np (nodes) (python) (file) (progargs)\" | qsub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) 65 104 66 NOTE: run non-python commands with: {'python':'', ...} 67 """ 68 mydict = defaults.copy() 69 mydict.update(kdict) 70 mydict['tasks'] = tasks(mydict['nodes']) 105 NOTES: 106 - run non-python commands with: {'python':'', ...} 107 - fine-grained resource utilization with: {'nodes':'4:nodetype:ppn=1', ...} 108 """ 109 mydict = defaults.copy() 110 mydict.update(kdict) 111 mydict['tasks'] = mpirun_tasks(mydict['nodes']) 71 112 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 113 return str 114 115 116 def moab_launcher(kdict={}): 117 """ 118 prepare launch for moab submission using srun 119 syntax: echo \"srun -n(nodes) (python) (file) (progargs)\" | qsub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) 120 121 NOTES: 122 - run non-python commands with: {'python':'', ...} 123 - fine-grained resource utilization with: {'nodes':'4:ppn=1,partition=xx', ...} 124 """ 125 mydict = defaults.copy() 126 mydict.update(kdict) 127 mydict['tasks'] = srun_tasks(mydict['nodes']) 128 str = """ echo \"srun -n%(tasks)s %(python)s %(file)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict 72 129 return str 73 130 … … 78 135 syntax: bsub -K -W(timelimit) -n (nodes) -o (outfile) -a mpich_mx -q (queue) -J (progname) mpich_mx_wrapper (python) (file) (progargs) 79 136 80 NOTE: run non-python commands with: {'python':'', ...} 137 NOTES: 138 - run non-python commands with: {'python':'', ...} 81 139 """ 82 140 mydict = defaults.copy() … … 92 150 syntax: bsub -K -W(timelimit) -n (nodes) -o (outfile) -a mpich_gm -q (queue) -J (progname) gmmpirun_wrapper (python) (file) (progargs) 93 151 94 NOTE: run non-python commands with: {'python':'', ...} 152 NOTES: 153 - run non-python commands with: {'python':'', ...} 95 154 """ 96 155 mydict = defaults.copy()
Note: See TracChangeset
for help on using the changeset viewer.