def moab_launcher(kdict={}): #FIXME: update """ prepare launch for moab submission using srun, mpirun, aprun, or serial syntax: echo \"srun -n(nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"%(mpirun)s -np (nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"aprun -n (nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"(python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) NOTES: run non-python commands with: {'python':'', ...} fine-grained resource utilization with: {'nodes':'4:ppn=1,partition=xx', ...} """ mydict = defaults.copy() mydict.update(kdict) from .schedulers import moab_scheduler moab = moab_scheduler() #FIXME: hackery if mydict['scheduler'] == moab.mpirun: mydict['tasks'] = mpirun_tasks(mydict['nodes']) str = """ echo \"%(mpirun)s -np %(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict elif mydict['scheduler'] == moab.srun: mydict['tasks'] = srun_tasks(mydict['nodes']) str = """ echo \"srun -n%(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict elif mydict['scheduler'] == moab.aprun: mydict['tasks'] = aprun_tasks(mydict['nodes']) str = """ echo \"aprun -n %(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict else: # non-mpi launch str = """ echo \"%(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict return str
def moab_launcher(kdict={}): #FIXME: update """ prepare launch for moab submission using srun, mpirun, aprun, or serial syntax: echo \"srun -n(nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"%(mpirun)s -np (nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"aprun -n (nodes) (python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) syntax: echo \"(python) (program) (progargs)\" | msub -l nodes=(nodes) -l walltime=(timelimit) -o (outfile) -e (errfile) -q (queue) NOTES: run non-python commands with: {'python':'', ...} fine-grained resource utilization with: {'nodes':'4:ppn=1,partition=xx', ...} """ mydict = defaults.copy() mydict.update(kdict) from schedulers import moab_scheduler moab = moab_scheduler() #FIXME: hackery if mydict['scheduler'] == moab.mpirun: mydict['tasks'] = mpirun_tasks(mydict['nodes']) str = """ echo \"%(mpirun)s -np %(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict elif mydict['scheduler'] == moab.srun: mydict['tasks'] = srun_tasks(mydict['nodes']) str = """ echo \"srun -n%(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict elif mydict['scheduler'] == moab.aprun: mydict['tasks'] = aprun_tasks(mydict['nodes']) str = """ echo \"aprun -n %(tasks)s %(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict else: # non-mpi launch str = """ echo \"%(python)s %(program)s %(progargs)s\" | msub -l nodes=%(nodes)s -l walltime=%(timelimit)s -o %(outfile)s -e %(errfile)s -q %(queue)s &> %(jobfile)s""" % mydict return str
def __settings(self): """fetch the settings for the map (from defaults and self.__dict__)""" env = defaults.copy() [ env.update({k: v}) for (k, v) in self.__dict__.items() if k in defaults ] [ env.update({'nodes': v}) for (k, v) in self.__dict__.items() if k.endswith('nodes') ] # deal with self.__nodes return env
def lsfgm_launcher(kdict={}): #FIXME: update """ prepare launch for Myrinet / LSF submission of parallel python using mpich_gm syntax: bsub -K -W(timelimit) -n (nodes) -o (outfile) -a mpich_gm -q (queue) -J (progname) gmmpirun_wrapper (python) (program) (progargs) NOTES: run non-python commands with: {'python':'', ...} """ mydict = defaults.copy() mydict.update(kdict) #str = """ bsub -K -W%(timelimit)s -n %(nodes)s -o ./%%J.out -a mpich_gm -q %(queue)s -J %(progname)s gmmpirun_wrapper %(python)s %(program)s %(progargs)s""" % mydict str = """ bsub -K -W%(timelimit)s -n %(nodes)s -o %(outfile)s -a mpich_gm -q %(queue)s -J %(progname)s gmmpirun_wrapper %(python)s %(program)s %(progargs)s""" % mydict return str
def __settings(self): """fetch the settings for the map (from defaults and self.__dict__)""" env = defaults.copy() [env.update({k:v}) for (k,v) in self.__dict__.items() if k in defaults] [env.update({'nodes':v}) for (k,v) in self.__dict__.items() if k.endswith('nodes')] # deal with self.__nodes return env