Beispiel #1
0
    def run(self, classname, funcname, hosts='all', **kwargs):
        """  Runs tasks in serial or parallel on specified hosts
        """
        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            # run on all available nodes
            unix.run('srun '
                    + '--wait=0 '
                    + join(findpath('seisflows.system'), 'wrappers/run ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname)

        elif hosts == 'head':
            # run on head node
            unix.run('srun '
                    + '--wait=0 '
                    + join(findpath('seisflows.system'), 'wrappers/run_head ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname)

        else:
            raise(KeyError('Hosts parameter not set/recognized.'))
    def run(self, classname, funcname, hosts='all', **kwargs):
        """  Runs tasks in serial or parallel on specified hosts
        """
        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            # run on all available nodes
            unix.run('pbsdsh '
                    + join(findpath('system'), 'wrapper/export_paths.sh ')
                    + os.getenv('PATH') + ' '
                    + os.getenv('LD_LIBRARY_PATH') + ' '
                    + join(findpath('system'), 'wrapper/run_pbsdsh ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname + ' '
                    + dirname(findpath('seisflows')))

        elif hosts == 'head':
            # run on head node
            unix.run('pbsdsh '
                    + join(findpath('system'), 'wrapper/export_paths.sh ')
                    + os.getenv('PATH') + ' '
                    + os.getenv('LD_LIBRARY_PATH') + ' '
                    + join(findpath('system'), 'wrapper/run_pbsdsh_head ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname + ' '
                    + dirname(findpath('seisflows')))
Beispiel #3
0
    def run(self, classname, funcname, hosts='all', **kwargs):
        """  Runs tasks in serial or parallel on specified hosts
        """
        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            unix.run(
                findpath('seisflows.system') + '/' + 'wrappers/dsh2 ' +
                str(PAR.NTASK) + ' ' + findpath('seisflows.system') + '/' +
                'wrappers/run ' + PATH.OUTPUT + ' ' + classname + ' ' +
                funcname + ' ' + PAR.ENVIRONS)

#            call('srun '
#                    + '--wait=0 '
#         + '--exclusive '
#        + join(findpath('seisflows.system'), 'wrappers/run ')
#       + PATH.OUTPUT + ' '
#      + classname + ' '
#     + funcname + ' '
#    + PAR.ENVIRONS)

        elif hosts == 'head':
            # run on head node
            unix.run(
                findpath('seisflows.system') + '/' + 'wrappers/run ' +
                PATH.OUTPUT + ' ' + classname + ' ' + funcname + ' ' +
                PAR.ENVIRONS)
    def submit(self, workflow):
        """Submits job
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        # save current state
        self.checkpoint()

        # construct resource list
        nodes = int(PAR.NTASK / PAR.NODESIZE)
        cores = PAR.NTASK % PAR.NODESIZE
        hours = int(PAR.WALLTIME / 60)
        minutes = PAR.WALLTIME % 60
        resources = 'walltime=%02d:%02d:00'%(hours, minutes)
        if nodes == 0:
            resources += ',mem=%dgb,nodes=1:ppn=%d'%(PAR.MEMORY, cores)
        elif cores == 0:
            resources += ',mem=%dgb,nodes=%d:ppn=%d'%(PAR.MEMORY, nodes, PAR.NODESIZE)
        else:
            resources += ',mem=%dgb,nodes=%d:ppn=%d+1:ppn=%d'%(PAR.MEMORY, nodes, PAR.NODESIZE, cores)

        # construct arguments list
        unix.run('qsub '
                + '-N %s '%PAR.TITLE
                + '-o %s '%(PATH.SUBMIT +'/'+ 'output.log')
                + '-l %s '%resources
                + '-j %s '%'oe'
                + findpath('system') +'/'+ 'wrappers/submit '
                + '-F %s '%PATH.OUTPUT)
Beispiel #5
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)
        unix.mkdir(PATH.SUBMIT+'/'+'output.pbs')

        self.checkpoint()

        hours = PAR.WALLTIME/60
        minutes = PAR.WALLTIME%60
        walltime = 'walltime=%02d:%02d:00 ' % (hours, minutes)

        ncpus = PAR.NODESIZE
        mpiprocs = PAR.NODESIZE

        # prepare qsub arguments
        unix.run( 'qsub '
                + '%s ' % PAR.PBSARGS
                + '-l select=1:ncpus=%d:mpiprocs=%d ' % (ncpus, mpiprocs)
                + '-l %s ' % walltime
                + '-N %s ' % PAR.TITLE
                + '-j %s '%'oe'
                + '-o %s ' % (PATH.SUBMIT+'/'+'output.log')
                + '-V '
                + ' -- ' + findpath('seisflows.system') +'/'+ 'wrappers/submit '
                + PATH.OUTPUT)
Beispiel #6
0
    def submit(self, workflow):
        """Submits job
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        # save current state
        self.checkpoint()

        # construct resource list
        nodes = PAR.NTASK/PAR.NODESIZE
        cores = PAR.NTASK%PAR.NODESIZE
        hours = PAR.WALLTIME/60
        minutes = PAR.WALLTIME%60
        resources = 'walltime=%02d:%02d:00 '%(hours, minutes)
        if nodes == 0:
            resources += ',nodes=1:ppn=%d'%cores
        elif cores == 0:
            resources += ',nodes=%d:ppn=16'%nodes
        else:
            resources += ',nodes=%d:ppn=16+1:ppn=%d'%(nodes, cores)

        # construct arguments list
        unix.run('qsub '
                + '-N %s '%PAR.TITLE
                + '-o %s '%(PATH.SUBMIT +'/'+ 'output.log')
                + '-l %s '%resources
                + '-j %s '%'oe'
                + findpath('system') +'/'+ 'pbs/wrapper_qsub '
                + PATH.OUTPUT,
                shell=True)
Beispiel #7
0
    def run(self, classname, funcname, hosts='all', **kwargs):
        """  Runs tasks in serial or parallel on specified hosts
        """
        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            # run on all available nodes
            unix.run('srun '
                    + '--wait=0 '
                    + join(findpath('system'), 'slurm/wrapper_pbsdsh ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname)

        elif hosts == 'head':
            # run on head node
            unix.run('srun '
                    + '--wait=0 '
                    + join(findpath('system'), 'slurm/wrapper_pbsdsh_head ')
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname + ' '
                    + findpath('seisflows'),
                    shell=True)
Beispiel #8
0
    def submit(self, workflow):
        """Submits job
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        # save current state
        self.checkpoint()

        # construct resource list
        nodes = PAR.NTASK / PAR.NODESIZE
        cores = PAR.NTASK % PAR.NODESIZE
        hours = PAR.WALLTIME / 60
        minutes = PAR.WALLTIME % 60
        resources = 'walltime=%02d:%02d:00 ' % (hours, minutes)
        if nodes == 0:
            resources += ',nodes=1:ppn=%d' % cores
        elif cores == 0:
            resources += ',nodes=%d:ppn=16' % nodes
        else:
            resources += ',nodes=%d:ppn=16+1:ppn=%d' % (nodes, cores)

        # construct arguments list
        unix.run('qsub ' + '-N %s ' % PAR.TITLE + '-o %s ' %
                 (PATH.SUBMIT + '/' + 'output.log') + '-l %s ' % resources +
                 '-j %s ' % 'oe' + findpath('system') + '/' +
                 'pbs/wrapper_qsub ' + PATH.OUTPUT,
                 shell=True)
Beispiel #9
0
    def run(self, classname, funcname, hosts='all', **kwargs):
        """ Runs tasks in serial or parallel on specified hosts
        """

        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            unix.cd(join(findpath('seisflows.system'), 'wrappers'))
            unix.run('mpiexec -n {} '.format(PAR.NTASK)
                    + PAR.MPIARGS + ' '
                    + 'run_mpi' + ' '
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname)

        elif hosts == 'head':
            unix.cd(join(findpath('seisflows.system'), 'wrappers'))
            unix.run('mpiexec -n 1 '
                    + PAR.MPIARGS + ' '
                    + 'run_mpi_head' + ' '
                    + PATH.OUTPUT + ' '
                    + classname + ' '
                    + funcname)

        else:
            raise(KeyError('Hosts parameter not set/recognized.'))
Beispiel #10
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)
        unix.mkdir(PATH.SUBMIT + '/' + 'output.slurm')

        self.checkpoint()

        # prepare sbatch arguments
        unix.run('sbatch ' + '--job-name=%s ' % PAR.SUBTITLE + '--output %s ' %
                 (PATH.SUBMIT + '/' + 'output.log') +
                 '--ntasks-per-node=%d ' % PAR.NODESIZE + '--nodes=%d ' % 1 +
                 '--time=%d ' % PAR.WALLTIME + findpath('system') + '/' +
                 'slurm/wrapper_sbatch ' + PATH.OUTPUT)
Beispiel #11
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        self.checkpoint()

        # submit workflow
        unix.run('sbatch ' + '--job-name=%s ' % PAR.SUBTITLE + '--output=%s ' %
                 (PATH.SUBMIT + '/' + 'output.log') +
                 '--cpus-per-task=%d ' % PAR.NPROC +
                 '--ntasks=%d ' % PAR.NTASK + '--time=%d ' % PAR.WALLTIME +
                 findpath('system') + '/' + 'slurm/wrapper_sbatch ' +
                 PATH.OUTPUT)
Beispiel #12
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        self.checkpoint()

        # submit workflow
        unix.run('sbatch '
                + '--job-name=%s '%PAR.SUBTITLE
                + '--output=%s '%(PATH.SUBMIT +'/'+ 'output.log')
                + '--cpus-per-task=%d '%PAR.NPROC
                + '--ntasks=%d '%PAR.NTASK
                + '--time=%d '%PAR.WALLTIME
                + findpath('system') +'/'+ 'wrappers/submit '
                + PATH.OUTPUT)
Beispiel #13
0
    def run(self, classname, funcname, hosts='all', **kwargs):
        """  Runs tasks in serial or parallel on specified hosts
        """
        self.checkpoint()
        self.save_kwargs(classname, funcname, kwargs)

        if hosts == 'all':
            # run on all available nodes
            unix.run('srun ' + '--wait=0 ' +
                     join(findpath('system'), 'slurm/wrapper_srun ') +
                     PATH.OUTPUT + ' ' + classname + ' ' + funcname)

        elif hosts == 'head':
            # run on head node
            unix.run('srun ' + '--wait=0 ' +
                     join(findpath('system'), 'slurm/wrapper_srun_head ') +
                     PATH.OUTPUT + ' ' + classname + ' ' + funcname)
Beispiel #14
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)
        unix.mkdir(PATH.SUBMIT+'/'+'output.slurm')

        self.checkpoint()

        # prepare sbatch arguments
        unix.run('sbatch '
                + '--job-name=%s ' % PAR.SUBTITLE
                + '--output %s ' % (PATH.SUBMIT+'/'+'output.log')
                + '--ntasks-per-node=%d ' % PAR.NODESIZE
                + '--nodes=%d ' % 1
                + '--time=%d ' % PAR.WALLTIME
                + findpath('system') +'/'+ 'slurm/wrapper_sbatch '
                + PATH.OUTPUT)
Beispiel #15
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)

        self.checkpoint()

        #        if not exists(PATH.SUBMIT + '/' + 'scratch'):
        #           unix.ln(PATH.SCRATCH, PATH.SUBMIT + '/' + 'scratch')
        node = 1  #PAR.NTASK/4
        ntask_per_node = 4
        unix.run('sbatch ' + '%s ' % PAR.SLURMARGS +
                 '--job-name=%s ' % PAR.TITLE + '--output=%s ' %
                 (PATH.WORKDIR + '/' + 'output.log') + '--nodes %d ' % node +
                 '--ntasks-per-node=%d ' % ntask_per_node +
                 '--gres=gpu:%d ' % PAR.NGPU + '--time=%d ' % PAR.WALLTIME +
                 findpath('seisflows.system') + '/' + 'wrappers/submit ' +
                 PATH.OUTPUT)
Beispiel #16
0
    def submit(self, workflow):
        """ Submits workflow
        """
        unix.mkdir(PATH.OUTPUT)
        unix.cd(PATH.OUTPUT)
        unix.mkdir(PATH.SUBMIT+'/'+'output.lsf')

        self.checkpoint()

        # prepare bsub arguments
        unix.run('bsub '
                + '%s ' % PAR.LSFARGS
                + '-J %s ' % PAR.TITLE
                + '-o %s ' % (PATH.SUBMIT+'/'+'output.log')
                + '-n %d ' % PAR.NTASK
                + '-e %s ' % (PATH.SUBMIT+'/'+'error.log')
                + '-W %d:00 ' % PAR.WALLTIME
                + findpath('seisflows.system') +'/'+ 'wrappers/submit '
                + PATH.OUTPUT)
Beispiel #17
0
    def hostlist(self):
        with open(PATH.SYSTEM + '/' + 'hostlist', 'w') as f:
            unix.run('scontrol show hostname $SLURM_JOB_NODEFILE', stdout=f)

        with open(PATH.SYSTEM + '/' + 'hostlist', 'r') as f:
            return [line.strip() for line in f.readlines()]