Skip to content

Commit b3d7f4e

Browse files
committed
Adjust chpl_launchcmd to be able to handle colocales with PBS
Signed-off-by: Engin Kayraklioglu <[email protected]>
1 parent 3a18b7b commit b3d7f4e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

util/test/chpl_launchcmd.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def job_name(self):
199199
logging.debug('Job name prefix is: {0}'.format(prefix))
200200

201201
cmd_basename = os.path.basename(self.test_command[0])
202-
logging.debug('Test command basname: {0}'.format(cmd_basename))
202+
logging.debug('Test command basename: {0}'.format(cmd_basename))
203203

204204
job_name = '{0}-{1}'.format(prefix, cmd_basename)
205205
logging.debug('Job name is: {0}'.format(job_name))
@@ -924,7 +924,26 @@ def _qsub_command(self, output_file, error_file):
924924
if num_locales == -1:
925925
num_locales = 1
926926

927+
loc_per_node = int(os.environ.get('CHPL_RT_LOCALES_PER_NODE', '1'))
928+
929+
logging.debug("Locales per node: {}".format(loc_per_node))
930+
if num_locales%loc_per_node != 0:
931+
raise RuntimeError('Requested number of locales ({}) is not '
932+
'divisible by CHPL_RT_LOCALES_PER_NODE '
933+
'({}).'.format(num_locales, loc_per_node))
934+
935+
num_locales = int(num_locales/loc_per_node)
936+
927937
if self.hostlist is not None:
938+
if loc_per_node != 1:
939+
# Engin: I am not sure if this code path is still needed, nor
940+
# can't tell how to handle colocales here. So, for now, I am
941+
# just adding a warning. If this path is needed, we can make
942+
# adjustments here.
943+
logging.warning('Hostlist and the CHPL_RT_LOCALES_PER_NODE '
944+
'environment are set. You may not get correct '
945+
'number of nodes allocated')
946+
928947
# This relies on the caller to use the correct select syntax.
929948
select_stmt = select_pattern.format(self.hostlist)
930949
select_stmt = select_stmt.replace('<num_locales>', str(num_locales))

0 commit comments

Comments
 (0)