Ejemplo n.º 1
0
    def run(self, strong_scaled=1, autoterminate=True, queue='high', walltime=1440):
        pipelines = set()
        input_data = list()

        for protocol in self._protocols:
            gen_pipeline = protocol.generate_pipeline()
            pipelines.add(gen_pipeline)
            input_data.extend(protocol.input_data)
            self.ids[protocol.id()] = gen_pipeline
            # protocol.id is the uuid, gen_pipeline.uid is the pipeline

            self.total_replicas += protocol.replicas

        self._cores = self._cores * self.total_replicas
        print 'Running on', self._cores, 'cores.'

        res_dict = {'resource': 'ncsa.bw_aprun',
                    'walltime': walltime,
                    'cores': int(self._cores*strong_scaled),
                    'project': 'bamm',
                    'queue': queue,
                    'access_schema': 'gsissh'}

        # Create Resource Manager object with the above resource description
        resource_manager = ResourceManager(res_dict)
        resource_manager.shared_data = input_data

        # Create Application Manager
        self.app_manager = AppManager(hostname=self._hostname, port=self._port, autoterminate=autoterminate)
        self.app_manager.resource_manager = resource_manager
        self.app_manager.assign_workflow(pipelines)

        self._prof.prof('execution_run')
        print 'Running...'
        self.app_manager.run()    # this method is blocking until all pipelines show state = completed
Ejemplo n.º 2
0
    pipes_set.add(get_pipeline(num_tasks))

    # Create a dictionary describe four mandatory keys:
    # resource, walltime, cores and project
    # resource is 'local.localhost' to execute locally
    res_dict = {

            'resource': res_name,
            'walltime': res_coll[res_name]['walltime'],
            'cores': num_tasks,
            'project': res_coll[res_name]['project'],
            'queue': res_coll[res_name]['queue'],
            'access_schema': res_coll[res_name]['schema']
    }

    # Create Resource Manager object with the above resource description
    rman = ResourceManager(res_dict)

    # Create Application Manager
    appman = AppManager()

    # Assign resource manager to the Application Manager
    appman.resource_manager = rman

    # Assign the workflow as a set of Pipelines to the Application Manager
    appman.assign_workflow(pipes_set)

    # Run the Application Manager
    appman.run()
                'resource': Kconfig.REMOTE_HOST,
                'walltime': Kconfig.WALLTIME,
                'cores': Kconfig.PILOTSIZE,
                'cpus': Kconfig.PILOTSIZE,
                'cpu_processes': Kconfig.num_CUs_per_MD_replica,  #PILOTSIZE,
                'gpus': Kconfig.PILOTSIZE / 16,
                'project': Kconfig.ALLOCATION,
                'queue': Kconfig.QUEUE,
                'access_schema': 'gsissh'
            }
        else:
            print("use_gpus not recognized")

        print res_dict
        # Create Resource Manager object with the above resource description
        rman = ResourceManager(res_dict)
        # Data common to multiple tasks -- transferred only once to common staging area
        rman.shared_data = [
            Kconfig.md_input_file,
            Kconfig.md_run_file,
            Kconfig.lsdm_config_file,
            '%s/spliter.py' % Kconfig.helper_scripts,
            '%s/gro.py' % Kconfig.helper_scripts,
            #'%s/run.py' % Kconfig.helper_scripts,
            #'%s/run_openmm.py' % Kconfig.helper_scripts,
            #'%s/pre_analyze.py' % Kconfig.helper_scripts,
            '%s/pre_analyze_openmm.py' % Kconfig.helper_scripts,
            '%s/post_analyze.py' % Kconfig.helper_scripts,
            #'%s/selection.py' % Kconfig.helper_scripts,
            '%s/selection-cluster.py' % Kconfig.helper_scripts,
            '%s/reweighting.py' % Kconfig.helper_scripts
Ejemplo n.º 4
0
                'resource': Kconfig.REMOTE_HOST,
                'walltime': Kconfig.WALLTIME,
                #'cores': Kconfig.PILOTSIZE,
                'cpus': Kconfig.NODESIZE * Kconfig.CPUs_per_NODE,
                #'cpu_processes': Kconfig.num_CUs_per_MD_replica,#PILOTSIZE,
                'gpus': Kconfig.NODESIZE,
                'project': Kconfig.ALLOCATION,
                'queue': Kconfig.QUEUE,
                'access_schema': 'gsissh'
            }
        else:
            print("use_gpus not recognized")

        print res_dict
        # Create Resource Manager object with the above resource description
        rman = ResourceManager(res_dict)
        # Data common to multiple tasks -- transferred only once to common staging area
        rman.shared_data = [
            Kconfig.md_dir + Kconfig.md_input_file,
            Kconfig.md_dir + Kconfig.md_run_file,
            args.Kconfig,
            #'%s > %s/%s' % (args.Kconfig, combined_path, args.Kconfig),
            #Kconfig.lsdm_config_file,
            #'%s/spliter-tica.py' % Kconfig.helper_scripts,
            '%s/run-tica-msm.py' % Kconfig.helper_scripts,
            #'%s/run.py' % Kconfig.helper_scripts,
            #'%s/run_openmm.py' % Kconfig.helper_scripts,
            #'%s/pre_analyze.py' % Kconfig.helper_scripts,
            #'%s/pre_analyze_openmm.py' % Kconfig.helper_scripts,
            #'%s/post_analyze.py' % Kconfig.helper_scripts,
            #'%s/selection.py' % Kconfig.helper_scripts,
def generate_pipeline(name, stages):  #Generate Pipeline for Stream Extraction/Morphological Thinning
    
    # Create a Pipeline object
    p = Pipeline()
    p.name = 'p1'

    for s_cnt in range(stages):
        
    # Create a Stage object, Stream Extraction
    s1 = Stage()
    s1.name = ‘Stage 1’

    # Create a Stage object, Morphological Thinning
    s2 = Stage()
    s2.name = ‘Stage 2’

    
    # Create Task 1, Stream Extraction
    t1 = Task()
    t1.name = 'Task 1'
    t1.executable = ['sbatch']   # Assign executable to the task
    t1.arguments = ['$SCRATCH/ashk96/StreamExtraction.bat'] # Assign arguments for the StreamExtraction

    # Add Task 1 to Stage 1
    s1.add_tasks(t1)
    
    # Add Stage 1 to the Pipeline
    p.add_stages(s1)
   
    # Create Task 2, Morphological Thinning
    t2 = Task()
    t2.name = 'Task 2'
    t2.executable = ['sbatch']   # Assign executable to the task
    t2.arguments = ['$SCRATCH/ashk96/Thin_Multi.bat'] # Assign arguments for the task executable
                    

    # Add Task 2 to Stage 2
    s2.add_tasks(t2)
    
    # Add Stage 2 to the Pipeline
    p.add_stages(s2)

    return p


if __name__ == '__main__':
    
      
    p1 = generate_pipeline(name='Stream Extraction', stages=2)
    res_dict = {
        
            'resource': 'xsede.bridges',
            'walltime': 02:00:00,
            'cores': 2,
            'project': 'TG-MCB090174',
            'queue': '',
            'schema': 'ssh'

}
    # Create Resource Manager object with the above resource description
    rman = ResourceManager(res_dict)
    
    # Create Application Manager
    appman = AppManager()
    
    # Assign resource manager to the Application Manager
    appman.resource_manager = rman
    
    # Execute pipeline
    appman.assign_workflow(p1)
    
    # Run the Application Manager
    appman.run()
Ejemplo n.º 6
0
    # resource is 'local.localhost' to execute locally
    res_dict = {
        'resource': 'xsede.stampede',
        'walltime': 15,
        'cores': total_cores,
        'project': 'TG-MCB090174',
        'access_schema': 'gsissh'
    }

    # Download analysis file from MobleyLab repo
    os.system(
        'curl -O https://raw.githubusercontent.com/MobleyLab/alchemical-analysis/master/alchemical_analysis/alchemical_analysis.py'
    )

    # Create Resource Manager object with the above resource description
    rman = ResourceManager(res_dict)
    # Data common to multiple tasks -- transferred only once to common staging area
    rman.shared_data = [
        './CB7G3.gro', './CB7G3.ndx', './CB7G3.top', './CB7G3_template.mdp',
        './analysis_1.py', './analysis_2.py', './determine_convergence.py',
        './alchemical_analysis.py', './3atomtypes.itp', './3_GMX.itp',
        './cucurbit_7_uril_GMX.itp'
    ]

    # Create Application Manager
    appman = AppManager()
    #appman = AppManager(port=) # if using docker, specify port here.

    # Assign resource manager to the Application Manager
    appman.resource_manager = rman
Ejemplo n.º 7
0
    print pilot_cores

    # Create a dictionary describe four mandatory keys:
    # resource, walltime, cores and project
    # resource is 'local.localhost' to execute locally
    res_dict = {
        'resource': res_name,
        'walltime': res_coll[res_name]['walltime'],
        'cores': pilot_cores,
        'project': res_coll[res_name]['project'],
        'access_schema': res_coll[res_name]['schema']
    }

    # Create Resource Manager object with the above resource description
    rman = ResourceManager(res_dict)
    rman.shared_data = [
        './ip_data/input.gro', './ip_data/grompp.mdp', './ip_data/topol.top'
    ]

    # Create Application Manager
    appman = AppManager(port=32769)

    # Assign resource manager to the Application Manager
    appman.resource_manager = rman

    # Assign the workflow as a set of Pipelines to the Application Manager
    appman.assign_workflow(pipes_set)

    # Run the Application Manager
    appman.run()
Ejemplo n.º 8
0
    def run(self, resource=None, walltime=None, strong_scaled=1, queue=None, access_schema=None, dry_run=False):
        """Run protocols.

        Parameters
        ----------
        resource: str
            The specific resource and sub-resource you want to use.
        walltime: int
            Wall time in minutes.
        strong_scaled: float
            For testing strong scaling. Number of cores will be multiplied by this number before execution.
        queue: str
            Name of the queue. If there is a default for your resource that will be used.
        access_schema: str
            One of ssh, gsissh, local
        dry_run: bool
            Whether to execute the `.run` command or not.
        """

        pipelines = set()
        shared_data = set()
        cores = 0

        max_cu_count = self.resource.get('max_cu_count', 0)

        for protocol in self._protocols:
            gen_pipeline = protocol.generate_pipeline()

            cu_count = len(gen_pipeline.stages[0].tasks)
            if max_cu_count and cu_count > max_cu_count:
                raise ValueError('Resource allows up to {} concurrent CUs. You have {}.'.format(max_cu_count, cu_count))

            pipelines.add(gen_pipeline)
            shared_data.update(protocol.shared_data)
            cores += protocol.cores

        cores *= strong_scaled
        cores += self.resource.get('agent_cores', 0)

        self.resource['resource_dictionary']['cores'] = cores

        if resource:
            self.resource['resource_dictionary']['resource'] = resource
        if walltime:
            self.resource['resource_dictionary']['walltime'] = walltime
        if queue:
            self.resource['resource_dictionary']['queue'] = queue
        if access_schema:
            self.resource['resource_dictionary']['access_schema'] = access_schema

        logger.info('Using total number of cores: {}.'.format(cores))
        logger.info('Resource dictionary:\n{}'.format(pprint.pformat(self.resource['resource_dictionary'])))

        # Create Resource Manager object with the above resource description
        resource_manager = ResourceManager(self.resource['resource_dictionary'])
        resource_manager.shared_data = list(shared_data)

        # Create Application Manager
        self._app_manager.resource_manager = resource_manager
        self._app_manager.assign_workflow(pipelines)

        logger.info("\n".join("Stage {}: {}*{} cores.".
                              format(i, len(s.tasks), next(iter(s.tasks)).cores)
                              for i, s in enumerate(next(iter(pipelines)).stages)))

        self._prof.prof('execution_run')
        logger.info('Running workflow.')

        if not dry_run:
            self._app_manager.run()    # this method is blocking until all pipelines show state = completed