Skip to content

Commit cb9960c

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into doc/sanity_re_multiline
2 parents 59fb5ae + 7a7f956 commit cb9960c

File tree

9 files changed

+48
-27
lines changed

9 files changed

+48
-27
lines changed

cscs-checks/mch/automatic_arrays_acc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import reframe as rfm
7+
import reframe.utility.os_ext as os_ext
78
import reframe.utility.sanity as sn
89

910

@@ -87,6 +88,9 @@ def cray_linker_workaround(self):
8788

8889
@rfm.run_before('compile')
8990
def cdt2006_pgi_workaround(self):
90-
if (self.current_system.name == 'dom' and
91-
self.current_environ.name == 'PrgEnv-pgi'):
91+
cdt = os_ext.cray_cdt_version()
92+
if not cdt:
93+
return
94+
95+
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.06'):
9296
self.variables.update({'CUDA_HOME': '$CUDATOOLKIT_HOME'})

cscs-checks/mch/gpu_direct_acc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os
77
import reframe as rfm
8+
import reframe.utility.os_ext as os_ext
89
import reframe.utility.sanity as sn
910

1011

@@ -83,6 +84,9 @@ def cray_linker_workaround(self):
8384

8485
@rfm.run_before('compile')
8586
def cdt2006_pgi_workaround(self):
86-
if (self.current_system.name == 'dom' and
87-
self.current_environ.name == 'PrgEnv-pgi'):
87+
cdt = os_ext.cray_cdt_version()
88+
if not cdt:
89+
return
90+
91+
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.06'):
8892
self.variables['CUDA_HOME'] = '$CUDATOOLKIT_HOME'

cscs-checks/mch/openacc_cuda_mpi_cppstd.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import reframe as rfm
7+
import reframe.utility.os_ext as os_ext
78
import reframe.utility.sanity as sn
89

910

@@ -93,6 +94,9 @@ def setflags(self):
9394

9495
@rfm.run_before('compile')
9596
def cdt2006_pgi_workaround(self):
96-
if (self.current_system.name == 'dom' and
97-
self.current_environ.name == 'PrgEnv-pgi'):
97+
cdt = os_ext.cray_cdt_version()
98+
if not cdt:
99+
return
100+
101+
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.06'):
98102
self.variables.update({'CUDA_HOME': '$CUDATOOLKIT_HOME'})

cscs-checks/prgenv/openacc_checks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import reframe as rfm
7+
import reframe.utility.os_ext as os_ext
78
import reframe.utility.sanity as sn
89

910

@@ -77,6 +78,9 @@ def cray_linker_workaround(self):
7778

7879
@rfm.run_before('compile')
7980
def cdt2006_pgi_workaround(self):
80-
if (self.current_system.name == 'dom' and
81-
self.current_environ.name == 'PrgEnv-pgi'):
81+
cdt = os_ext.cray_cdt_version()
82+
if not cdt:
83+
return
84+
85+
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.06'):
8286
self.variables.update({'CUDA_HOME': '$CUDATOOLKIT_HOME'})

cscs-checks/prgenv/opencl_check.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77

88
import reframe as rfm
9+
import reframe.utility.os_ext as os_ext
910
import reframe.utility.sanity as sn
1011

1112

@@ -31,6 +32,9 @@ def setflags(self):
3132

3233
@rfm.run_before('compile')
3334
def cdt2006_pgi_workaround(self):
34-
if (self.current_system.name == 'dom' and
35-
self.current_environ.name == 'PrgEnv-pgi'):
35+
cdt = os_ext.cray_cdt_version()
36+
if not cdt:
37+
return
38+
39+
if (self.current_environ.name == 'PrgEnv-pgi' and cdt == '20.06'):
3640
self.variables.update({'CUDA_HOME': '$CUDATOOLKIT_HOME'})

cscs-checks/system/slurm/slurm.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def __init__(self):
100100
self.sanity_patterns = sn.assert_found(
101101
r'error: You have to specify, at least, what sort of node you '
102102
r'need: -C gpu for GPU enabled nodes, or -C mc for multicore '
103-
r'nodes.', self.stderr)
103+
r'nodes.|ERROR: you must specify -C with one of the following: '
104+
r'mc,gpu,storage', self.stderr)
104105

105106

106107
@rfm.simple_test
@@ -175,11 +176,8 @@ def __init__(self):
175176
@rfm.run_before('run')
176177
def set_slurm_constraint(self):
177178
cabinet = self.cabinets.get(self.current_partition.fullname)
178-
constraint = f'--constraint={self.current_partition.name}'
179179
if cabinet:
180-
constraint += f'&{cabinet}'
181-
182-
self.job.options += [constraint]
180+
self.job.options += [f'--constraint={cabinet}']
183181

184182

185183
@rfm.simple_test

docs/manpage.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,16 @@ Options controlling job submission
352352
Any job options specified with this command-line option will be emitted after any job options specified in the :js:attr:`access` system partition configuration parameter.
353353

354354
Especially for the Slurm backends, constraint options, such as ``-J constraint=value``, ``-J C=value``, ``-J --constraint=value`` or ``-J -C=value``, are going to be combined with any constraint options specified in the :js:attr:`access` system partition configuration parameter.
355-
For example, if ``-C x`` is specified in the :js:attr:`access` and ``-J C=y`` is passed to the command-line, ReFrame will pass ``-C x,y`` as a constraint to the scheduler.
355+
For example, if ``-C x`` is specified in the :js:attr:`access` and ``-J C=y`` is passed to the command-line, ReFrame will pass ``-C x&y`` as a constraint to the scheduler.
356356
Notice, however, that if constraint options are specified through multiple :option:`-J` options, only the last one will be considered.
357357
If you wish to completely overwrite any constraint options passed in :js:attr:`access`, you should consider passing explicitly the Slurm directive with ``-J '#SBATCH --constraint=new'``.
358358

359359
.. versionchanged:: 3.0
360360
This option has become more flexible.
361361

362+
.. versionchanged:: 3.1
363+
Use ``&`` to combine constraints.
364+
362365
------------------------
363366
Flexible node allocation
364367
------------------------

reframe/core/schedulers/slurm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def emit_preamble(self, job):
214214

215215
if constraints:
216216
preamble.append(
217-
self._format_option(','.join(constraints), '--constraint={0}')
217+
self._format_option('&'.join(constraints), '--constraint={0}')
218218
)
219219

220220
preamble.append(self._format_option(hint, '--hint={0}'))
@@ -326,7 +326,7 @@ def filternodes(self, job, nodes):
326326
'available nodes now: %s' % (partitions, len(nodes)))
327327

328328
if constraints:
329-
constraints = set(constraints.strip().split(','))
329+
constraints = set(constraints.strip().split('&'))
330330
nodes = {n for n in nodes if n.active_features >= constraints}
331331
getlogger().debug(
332332
'flex_alloc_nodes: filtering nodes by constraint(s) %s: '

unittests/test_schedulers.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,13 @@ def test_no_empty_lines_in_preamble(minimal_job):
372372

373373
def test_combined_access_constraint(make_job, slurm_only):
374374
job = make_job(sched_access=['--constraint=c1'])
375-
job.options = ['-C c2,c3']
375+
job.options = ['-C c2&c3']
376376
prepare_job(job)
377377
with open(job.script_filename) as fp:
378378
script_content = fp.read()
379379

380-
assert re.search(r'(?m)--constraint=c1,c2,c3$', script_content)
381-
assert re.search(r'(?m)--constraint=(c1|c2,c3)$', script_content) is None
380+
assert re.search(r'(?m)--constraint=c1&c2&c3$', script_content)
381+
assert re.search(r'(?m)--constraint=(c1|c2&c3)$', script_content) is None
382382

383383

384384
def test_combined_access_multiple_constraints(make_job, slurm_only):
@@ -388,7 +388,7 @@ def test_combined_access_multiple_constraints(make_job, slurm_only):
388388
with open(job.script_filename) as fp:
389389
script_content = fp.read()
390390

391-
assert re.search(r'(?m)--constraint=c1,c3$', script_content)
391+
assert re.search(r'(?m)--constraint=c1&c3$', script_content)
392392
assert re.search(r'(?m)--constraint=(c1|c2|c3)$', script_content) is None
393393

394394

@@ -781,7 +781,7 @@ def test_flex_alloc_valid_constraint_opt(make_flexible_job):
781781

782782
def test_flex_alloc_valid_multiple_constraints(make_flexible_job):
783783
job = make_flexible_job('all')
784-
job.options = ['-C f1,f3']
784+
job.options = ['-C f1&f3']
785785
prepare_job(job)
786786
assert job.num_tasks == 4
787787

@@ -808,7 +808,7 @@ def test_flex_alloc_valid_multiple_partitions(make_flexible_job):
808808

809809
def test_flex_alloc_valid_constraint_partition(make_flexible_job):
810810
job = make_flexible_job('all')
811-
job.options = ['-C f1,f2', '--partition=p1,p2']
811+
job.options = ['-C f1&f2', '--partition=p1,p2']
812812
prepare_job(job)
813813
assert job.num_tasks == 4
814814

@@ -867,7 +867,7 @@ def test_flex_alloc_exclude_nodes_opt(make_flexible_job):
867867
def test_flex_alloc_no_num_tasks_per_node(make_flexible_job):
868868
job = make_flexible_job('all')
869869
job.num_tasks_per_node = None
870-
job.options = ['-C f1,f2', '--partition=p1,p2']
870+
job.options = ['-C f1&f2', '--partition=p1,p2']
871871
prepare_job(job)
872872
assert job.num_tasks == 1
873873

@@ -888,15 +888,15 @@ def test_flex_alloc_maintenance_nodes(make_flexible_job):
888888

889889
def test_flex_alloc_not_enough_nodes_constraint_partition(make_flexible_job):
890890
job = make_flexible_job('all')
891-
job.options = ['-C f1,f2', '--partition=p1,p2']
891+
job.options = ['-C f1&f2', '--partition=p1,p2']
892892
job.num_tasks = -8
893893
with pytest.raises(JobError):
894894
prepare_job(job)
895895

896896

897897
def test_flex_alloc_enough_nodes_constraint_partition(make_flexible_job):
898898
job = make_flexible_job('all')
899-
job.options = ['-C f1,f2', '--partition=p1,p2']
899+
job.options = ['-C f1&f2', '--partition=p1,p2']
900900
job.num_tasks = -4
901901
prepare_job(job)
902902
assert job.num_tasks == 4

0 commit comments

Comments
 (0)