From 575405a0793143c7aefa40ec0380e88386a8a69c Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 13 Apr 2016 10:03:10 +0000
Subject: [PATCH] Task #8437: Use 8 cores for BBS

---
 CEP/Pipeline/recipes/sip/master/bbs_reducer.py | 10 +++++++++-
 CEP/Pipeline/recipes/sip/master/imager_bbs.py  | 10 +++++++++-
 CEP/Pipeline/recipes/sip/tasks.cfg.CEP4.in     |  1 -
 CEP/Pipeline/recipes/sip/tasks.cfg.in          |  2 ++
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/CEP/Pipeline/recipes/sip/master/bbs_reducer.py b/CEP/Pipeline/recipes/sip/master/bbs_reducer.py
index 5fda848e56d..25bab0248d2 100644
--- a/CEP/Pipeline/recipes/sip/master/bbs_reducer.py
+++ b/CEP/Pipeline/recipes/sip/master/bbs_reducer.py
@@ -26,6 +26,11 @@ class bbs_reducer(BaseRecipe, RemoteCommandRecipeMixIn):
             '-p', '--parset',
             help="BBS configuration parset"
         ),
+        'nthreads': ingredient.IntField(
+            '--nthreads',
+            default=8,
+            help="Number of threads per process"
+        ),
         'executable': ingredient.ExecField(
             '--executable',
             help="The full path to the BBS-reducer executable"
@@ -115,7 +120,10 @@ class bbs_reducer(BaseRecipe, RemoteCommandRecipeMixIn):
                         self.inputs['executable'],
                         self.inputs['parset'],
                         self.environment
-                    ]
+                    ],
+                    resources={
+                        "cores": self.inputs['nthreads']
+                    }
                 )
             )
         self._schedule_jobs(self.jobs)
diff --git a/CEP/Pipeline/recipes/sip/master/imager_bbs.py b/CEP/Pipeline/recipes/sip/master/imager_bbs.py
index c17450c4bff..809c2f182fe 100644
--- a/CEP/Pipeline/recipes/sip/master/imager_bbs.py
+++ b/CEP/Pipeline/recipes/sip/master/imager_bbs.py
@@ -36,6 +36,11 @@ class imager_bbs(BaseRecipe, RemoteCommandRecipeMixIn):
             '-p', '--parset',
             help="BBS configuration parset"
         ),
+        'nthreads': ingredient.IntField(
+            '--nthreads',
+            default=8,
+            help="Number of threads per process"
+        ),
         'bbs_executable': ingredient.StringField(
             '--bbs-executable',
             help="BBS standalone executable (bbs-reducer)"
@@ -128,7 +133,10 @@ class imager_bbs(BaseRecipe, RemoteCommandRecipeMixIn):
             arguments = [self.inputs['bbs_executable'],
                          self.inputs['parset'],
                          ms_list_path, parmdb_list_path, sourcedb_list_path]
-            jobs.append(ComputeJob(host, node_command, arguments))
+            jobs.append(ComputeJob(host, node_command, arguments,
+                    resources={
+                        "cores": self.inputs['nthreads']
+                    }))
 
         # start and wait till all are finished
         self._schedule_jobs(jobs)
diff --git a/CEP/Pipeline/recipes/sip/tasks.cfg.CEP4.in b/CEP/Pipeline/recipes/sip/tasks.cfg.CEP4.in
index 895a78d7a96..c6708c69332 100644
--- a/CEP/Pipeline/recipes/sip/tasks.cfg.CEP4.in
+++ b/CEP/Pipeline/recipes/sip/tasks.cfg.CEP4.in
@@ -1,6 +1,5 @@
 [ndppp]
 nproc = 0
-nthreads = 8
 
 [setupparmdb]
 nproc = 0
diff --git a/CEP/Pipeline/recipes/sip/tasks.cfg.in b/CEP/Pipeline/recipes/sip/tasks.cfg.in
index ab6fcb96cbe..5d6d46b8fb8 100644
--- a/CEP/Pipeline/recipes/sip/tasks.cfg.in
+++ b/CEP/Pipeline/recipes/sip/tasks.cfg.in
@@ -86,6 +86,7 @@ makesourcedb_path = %(lofarroot)s/bin/makesourcedb
 [imager_bbs]
 recipe = imager_bbs
 bbs_executable = %(lofarroot)s/bin/bbs-reducer
+nthreads = 8
   
 [imager_source_finding]
 recipe = imager_source_finding
@@ -106,6 +107,7 @@ parset = %(runtime_directory)s/%(job_name)s/parsets/bbs.parset
 instrument_mapfile = %(runtime_directory)s/%(job_name)s/mapfiles/instrument.mapfile
 sky_mapfile = %(runtime_directory)s/%(job_name)s/mapfiles/sky.mapfile
 data_mapfile = %(runtime_directory)s/%(job_name)s/mapfiles/bbs.mapfile
+nthreads = 8
 
 [selfcal_awimager]
 recipe = selfcal_awimager
-- 
GitLab