Skip to content

Instantly share code, notes, and snippets.

@AymenFJA
Created May 1, 2020 16:10
Show Gist options
  • Save AymenFJA/d5627a061d47584575a0bf06b9b0983b to your computer and use it in GitHub Desktop.
Save AymenFJA/d5627a061d47584575a0bf06b9b0983b to your computer and use it in GitHub Desktop.
import os
import radical.pilot as rp
from radical.entk import Pipeline, Stage, Task, AppManager
crop_size = int(360) #covnvert this to argument later
worker_root = r"/pylon5/mc3bggp/aymen/local_dir/datasets/polygon/" #convert this to argument later
weights_path = r"/pylon5/mc3bggp/aymen/local_dir/datasets/logs/ice_wedge_polygon20180823T1403/mask_rcnn_ice_wedge_polygon_0008.h5" #convert this to argument later
imgs_path = r"/pylon5/mc3bggp/aymen/local_dir/datasets/polygon/input_img/" #convert this to argument later
# ------------------------------------------------------------------------------
# Set default verbosity
if os.environ.get('RADICAL_ENTK_VERBOSE') == None:
os.environ['RADICAL_ENTK_REPORT'] = 'True'
hostname = os.environ.get('RMQ_HOSTNAME', 'two.radical-project.org')
port = int(os.environ.get('RMQ_PORT', 33235))
if __name__ == '__main__':
# Create a Pipeline object
p = Pipeline()
#---------------------------------------------------------
# Build Preprocessing level
# Create a Stage object
s = Stage()
# Create a Task object
t = Task()
t.pre_exec = ['module unload intel/19.5',
'module load intel/18.4',
'module list',
'mpirun -info',
'mpirun -x',
'mpirun -envlist',
'source activate polygons',
'export PYTHONPATH=/pylon5/mc3bggp/aymen/anaconda3/envs/polygons/lib/python3.6/site-packages:$PYTHONPATH',
'export PYTHONPATH=/pylon5/mc3bggp/aymen/local_dir/utils:$PYTHONPATH']
t.name = 'Preprocessing' # Assign a name to the task (optional, do not use ',' or '_')
t.executable = 'python' # Assign executable to the task
t.arguments = ['/pylon5/mc3bggp/aymen/local_dir/iwp_mpi_preprocessing.py', '%s' % imgs_path, '%s' % worker_root, '%s' % crop_size]
#t.arguments = ['/home/aymen/SummerRadical/which_mpi/contrsact_cmd.py']
t.cpu_reqs = {'processes': 28,
'process_type': 'MPI',
'thread_type': 'OpenMP',
'threads_per_process': 1}
# Add Task to the Stage
s.add_tasks(t)
# Add Stage to the Pipeline
p.add_stages(s)
# Create Application Manager
appman = AppManager(hostname=hostname, port=port, autoterminate=True, write_workflow=True)
# Create a dictionary describe four mandatory keys:
# resource, walltime, and cpus
# resource is 'local.localhost' to execute locally
res_dict = {
'resource' : 'xsede.bridges',
'walltime' : 60,
'cpus' : 28,
'project' : 'mc3bggp',
'queue' : 'RM',
'schema' :'gsissh',
}
# Assign resource request description to the Application Manager
appman.resource_desc = res_dict
# Assign the workflow as a set or list of Pipelines to the Application Manager
# Note: The list order is not guaranteed to be preserved
appman.workflow = set([p])
# Run the Application Manager
appman.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment