Skip to content

Commit 6d96511

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into feature/improve-error-handling
2 parents 551172b + 8de06d4 commit 6d96511

File tree

16 files changed

+395
-213
lines changed

16 files changed

+395
-213
lines changed

config/cscs-ci.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
{
2525
'name': 'gpu',
2626
'scheduler': 'slurm',
27+
'time_limit': '10m',
2728
'access': [
2829
'--constraint=gpu',
2930
'--partition=cscsci',
@@ -58,6 +59,7 @@
5859
{
5960
'name': 'slurm',
6061
'scheduler': 'slurm',
62+
'time_limit': '10m',
6163
'access': [
6264
'--constraint=gpu',
6365
f'--account={osext.osgroup()}'
@@ -80,6 +82,7 @@
8082
{
8183
'name': 'pbs',
8284
'scheduler': 'pbs',
85+
'time_limit': '10m',
8386
'access': [
8487
'proc=gpu',
8588
f'-A {osext.osgroup()}'
@@ -94,6 +97,7 @@
9497
{
9598
'name': 'torque',
9699
'scheduler': 'torque',
100+
'time_limit': '10m',
97101
'access': [
98102
'-l proc=gpu',
99103
f'-A {osext.osgroup()}'

config/cscs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
},
183183
{
184184
'name': 'gpu',
185+
'time_limit': '10m',
185186
'scheduler': 'slurm',
186187
'container_platforms': [
187188
{
@@ -230,6 +231,7 @@
230231
{
231232
'name': 'mc',
232233
'scheduler': 'slurm',
234+
'time_limit': '10m',
233235
'container_platforms': [
234236
{
235237
'type': 'Sarus',
@@ -348,6 +350,7 @@
348350
{
349351
'name': 'gpu',
350352
'scheduler': 'slurm',
353+
'time_limit': '10m',
351354
'container_platforms': [
352355
{
353356
'type': 'Sarus',
@@ -389,6 +392,7 @@
389392
{
390393
'name': 'mc',
391394
'scheduler': 'slurm',
395+
'time_limit': '10m',
392396
'container_platforms': [
393397
{
394398
'type': 'Sarus',
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
2+
# ReFrame Project Developers. See the top-level LICENSE file for details.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
import reframe as rfm
7+
import reframe.utility.sanity as sn
8+
import reframe.utility.typecheck as typ
9+
10+
11+
@rfm.simple_test
12+
class nvidia_smi_check(rfm.RunOnlyRegressionTest):
13+
gpu_mode = parameter(['accounting', 'compute', 'ecc'])
14+
valid_systems = ['daint:gpu', 'dom:gpu']
15+
valid_prog_environs = ['builtin']
16+
executable = 'nvidia-smi'
17+
executable_opts = ['-a', '-d']
18+
num_tasks = 1
19+
num_tasks_per_node = 1
20+
exclusive = True
21+
tags = {'maintenance', 'production'}
22+
maintainers = ['VH']
23+
mode_values = variable(typ.Dict[str, str], value={
24+
'accounting': 'Enabled',
25+
'compute': 'Exclusive_Process',
26+
'ecc': 'Enabled'
27+
})
28+
29+
@rfm.run_before('run')
30+
def set_display_opt(self):
31+
self.executable_opts.append(self.gpu_mode.upper())
32+
33+
@rfm.run_before('sanity')
34+
def set_sanity(self):
35+
modeval = self.mode_values[self.gpu_mode]
36+
if self.gpu_mode == 'ecc':
37+
patt = rf'Current\s+: {modeval}'
38+
else:
39+
patt = rf'{self.gpu_mode.capitalize()} Mode\s+: {modeval}'
40+
41+
num_gpus_detected = sn.count(sn.findall(patt, self.stdout))
42+
num_gpus_all = self.num_tasks
43+
44+
# We can't an use f-string here, because it will misinterpret the
45+
# placeholders for the sanity function message
46+
errmsg = ('{0} out of {1} GPU(s) have the correct %s mode' %
47+
self.gpu_mode)
48+
self.sanity_patterns = sn.assert_eq(
49+
num_gpus_detected, num_gpus_all, errmsg
50+
)

docs/config_reference.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ System Partition Configuration
287287
A list of `environment module objects <#module-objects>`__ to be loaded before running a regression test on this partition.
288288

289289

290+
.. js:attribute:: .systems[].partitions[].time_limit
291+
292+
:required: No
293+
:default: ``null``
294+
295+
The time limit for the jobs submitted on this partition.
296+
When the value is ``null``, no time limit is applied.
297+
298+
290299
.. js:attribute:: .systems[].partitions[].variables
291300

292301
:required: No

docs/regression_test_api.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This provides the ReFrame internals with further control over the user's input,
4848
In essence, these builtins exert control over the test creation, and they allow adding and/or modifying certain attributes of the regression test.
4949

5050

51-
.. py:function:: reframe.core.pipeline.RegressionTest.parameter(values=None, inherit_params=False, filter_params=None)
51+
.. py:function:: RegressionTest.parameter(values=None, inherit_params=False, filter_params=None)
5252
5353
Inserts or modifies a regression test parameter.
5454
If a parameter with a matching name is already present in the parameter space of a parent class, the existing parameter values will be combined with those provided by this method following the inheritance behavior set by the arguments ``inherit_params`` and ``filter_params``.
@@ -67,7 +67,7 @@ In essence, these builtins exert control over the test creation, and they allow
6767
else:
6868
do_other()
6969
70-
One of the most powerful features about these built-in functions is that they store their input information at the class level.
70+
One of the most powerful features about these built-in functions is that they store their input information at the class level.
7171
However, a parameter may only be accessed from the class instance and accessing it directly from the class body is disallowed.
7272
With this approach, extending or specializing an existing parametrized regression test becomes straightforward, since the test attribute additions and modifications made through built-in functions in the parent class are automatically inherited by the child test.
7373
For instance, continuing with the example above, one could override the :func:`__init__` method in the :class:`Foo` regression test as follows:
@@ -83,7 +83,7 @@ In essence, these builtins exert control over the test creation, and they allow
8383
8484
Note that this built-in parameter function provides an alternative method to parameterize a test to :func:`reframe.core.decorators.parameterized_test`, and the use of both approaches in the same test is currently disallowed.
8585
The two main advantages of the built-in :func:`parameter` over the decorated approach reside in the parameter inheritance across classes and the handling of large parameter sets.
86-
As shown in the example above, the parameters declared with the built-in :func:`parameter` are automatically carried over into derived tests through class inheritance, whereas tests using the decorated approach would have to redefine the parameters on every test.
86+
As shown in the example above, the parameters declared with the built-in :func:`parameter` are automatically carried over into derived tests through class inheritance, whereas tests using the decorated approach would have to redefine the parameters on every test.
8787
Similarly, parameters declared through the built-in :func:`parameter` are regarded as fully independent from each other and ReFrame will automatically generate as many tests as available parameter combinations. This is a major advantage over the decorated approach, where one would have to manually expand the parameter combinations.
8888
This is illustrated in the example below, consisting of a case with two parameters, each having two possible values.
8989

@@ -114,11 +114,11 @@ In essence, these builtins exert control over the test creation, and they allow
114114
This only has an effect if used with ``inherit_params=True``.
115115

116116

117-
.. py:function:: reframe.core.pipeline.RegressionTest.variable(*types, value=None)
117+
.. py:function:: RegressionTest.variable(*types, value=None)
118118
119119
Inserts a new regression test variable.
120120
Declaring a test variable through the :func:`variable` built-in allows for a more robust test implementation than if the variables were just defined as regular test attributes (e.g. ``self.a = 10``).
121-
Using variables declared through the :func:`variable` built-in guarantees that these regression test variables will not be redeclared by any child class, while also ensuring that any values that may be assigned to such variables comply with its original declaration.
121+
Using variables declared through the :func:`variable` built-in guarantees that these regression test variables will not be redeclared by any child class, while also ensuring that any values that may be assigned to such variables comply with its original declaration.
122122
In essence, by using test variables, the user removes any potential test errors that might be caused by accidentally overriding a class attribute. See the example below.
123123

124124

0 commit comments

Comments
 (0)