From 2cbea4c4a8ed1821f69f2be783cb4acfa3d9ae9b Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 4 Apr 2016 18:18:19 +0000 Subject: [PATCH] Task #8437: Specify nthreads for recipes that may benefit from it --- CEP/Pipeline/recipes/sip/master/executable_args.py | 10 +++++++++- CEP/Pipeline/recipes/sip/master/imager_prepare.py | 12 ++++++++++-- CEP/Pipeline/recipes/sip/master/long_baseline.py | 10 +++++++++- CEP/Pipeline/recipes/sip/tasks.cfg.in | 10 ++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CEP/Pipeline/recipes/sip/master/executable_args.py b/CEP/Pipeline/recipes/sip/master/executable_args.py index 4c07727745f..2bec87956bb 100644 --- a/CEP/Pipeline/recipes/sip/master/executable_args.py +++ b/CEP/Pipeline/recipes/sip/master/executable_args.py @@ -35,6 +35,11 @@ class executable_args(BaseRecipe, RemoteCommandRecipeMixIn): default='', optional=True ), + 'nthreads': ingredient.IntField( + '--nthreads', + default=8, + help="Number of threads per process" + ), 'nodescript': ingredient.StringField( '--nodescript', help="Name of the node script to execute", @@ -369,7 +374,10 @@ class executable_args(BaseRecipe, RemoteCommandRecipeMixIn): self.inputs['parsetasfile'], args_format, self.environment - ] + ], + resources={ + "cores": self.inputs['nthreads'] + } ) ) max_per_node = self.inputs['max_per_node'] diff --git a/CEP/Pipeline/recipes/sip/master/imager_prepare.py b/CEP/Pipeline/recipes/sip/master/imager_prepare.py index f17ce182724..3ba13b86007 100644 --- a/CEP/Pipeline/recipes/sip/master/imager_prepare.py +++ b/CEP/Pipeline/recipes/sip/master/imager_prepare.py @@ -57,6 +57,11 @@ class imager_prepare(BaseRecipe, RemoteCommandRecipeMixIn): '-w', '--working-directory', help="Working directory used by the nodes: local data" ), + 'nthreads': ingredient.IntField( + '--nthreads', + default=8, + help="Number of threads per process" + ), 'target_mapfile': ingredient.StringField( '--target-mapfile', help="Contains the node and path to target files, defines" @@ -191,7 +196,7 @@ class imager_prepare(BaseRecipe, RemoteCommandRecipeMixIn): paths_to_image_mapfiles.append( tuple([item.host, inputs_for_image_mapfile_path, False])) - # use a unique working directory per job, to prevent interference between jobs on a global fs + # use unique working directories per job, to prevent interference between jobs on a global fs working_dir = os.path.join(self.inputs['working_directory'], "ms_per_image_{0}".format(idx_sb_group)) arguments = [self.environment, @@ -211,7 +216,10 @@ class imager_prepare(BaseRecipe, RemoteCommandRecipeMixIn): self.inputs['add_beam_tables'], globalfs] - jobs.append(ComputeJob(item.host, node_command, arguments)) + jobs.append(ComputeJob(item.host, node_command, arguments, + resources={ + "cores": self.inputs['nthreads'] + })) # Hand over the job(s) to the pipeline scheduler self._schedule_jobs(jobs) diff --git a/CEP/Pipeline/recipes/sip/master/long_baseline.py b/CEP/Pipeline/recipes/sip/master/long_baseline.py index 45734bd28e8..fe399f5263c 100644 --- a/CEP/Pipeline/recipes/sip/master/long_baseline.py +++ b/CEP/Pipeline/recipes/sip/master/long_baseline.py @@ -63,6 +63,11 @@ class long_baseline(BaseRecipe, RemoteCommandRecipeMixIn): '-w', '--working-directory', help="Working directory used by the nodes: local data" ), + 'nthreads': ingredient.IntField( + '--nthreads', + default=8, + help="Number of threads per process" + ), 'target_mapfile': ingredient.StringField( '--target-mapfile', help="Contains the node and path to target files, defines" @@ -212,7 +217,10 @@ class long_baseline(BaseRecipe, RemoteCommandRecipeMixIn): globalfs, final_item.file] - jobs.append(ComputeJob(output_item.host, node_command, arguments)) + jobs.append(ComputeJob(output_item.host, node_command, arguments, + resources={ + "cores": self.inputs['nthreads'] + })) # Hand over the job(s) to the pipeline scheduler self._schedule_jobs(jobs, max_per_node=self.inputs['nproc']) diff --git a/CEP/Pipeline/recipes/sip/tasks.cfg.in b/CEP/Pipeline/recipes/sip/tasks.cfg.in index e2968e1bc5b..ab6fcb96cbe 100644 --- a/CEP/Pipeline/recipes/sip/tasks.cfg.in +++ b/CEP/Pipeline/recipes/sip/tasks.cfg.in @@ -62,6 +62,7 @@ asciistat_executable = %(lofarroot)s/bin/asciistats.py statplot_executable = %(lofarroot)s/bin/statsplot.py msselect_executable = %(casaroot)s/bin/msselect rficonsole_executable = %(lofarroot)s/bin/rficonsole +nthreads = 8 [long_baseline] recipe = long_baseline @@ -71,6 +72,7 @@ statplot_executable = %(lofarroot)s/bin/statsplot.py msselect_executable = %(casaroot)s/bin/msselect rficonsole_executable = %(lofarroot)s/bin/rficonsole nproc = 1 +nthreads = 8 [imager_awimager] recipe = imager_awimager @@ -134,6 +136,7 @@ inplace = False outputsuffixes = [] parsetasfile = False #args_format=gnu +nthreads = 8 [casapy-imager] recipe = executable_args @@ -141,20 +144,24 @@ parsetasfile = True #executable = /path/to/your/casapy/bin/casa outputsuffixes = [flux,image,model,residual,psf] nodescript = executable_casa +nthreads = 8 [pythonplugin] recipe = executable_args nodescript = python_plugin +nthreads = 8 [python-calibrate-stand-alone] recipe=executable_args nodescript=calibrate-stand-alone executable=%(lofarroot)s/bin/bbs-reducer parsetasfile=True +nthreads = 8 [calibrate-stand-alone] recipe = executable_args executable = %(lofarroot)s/bin/calibrate-stand-alone +nthreads = 8 [dppp] recipe = executable_args @@ -163,6 +170,7 @@ executable = %(lofarroot)s/bin/NDPPP outputsuffixes = [] args_format=lofar outputkey=msout +nthreads = 8 [awimager] recipe = executable_args @@ -172,7 +180,9 @@ outputsuffixes = [.model, .model.corr, .residual, .residual.corr, .restored, .re max_per_node = 1 args_format=lofar outputkey=image +nthreads = 8 [rficonsole] recipe = executable_args executable = %(lofarroot)s/bin/rficonsole +nthreads = 8 -- GitLab