Skip to content

Commit de93b62

Browse files
authored
Merge pull request #3208 from createyourpersonalaccount/tutorial-patch
[doc] Improve description of `valid_systems` and `valid_prog_environs` in the tutorial and other minor tutorial fixes
2 parents 392efbc + 095b9bb commit de93b62

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

docs/regression_test_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ Modules Systems
290290
:show-inheritance:
291291

292292
.. _build-systems:
293+
293294
-------------
294295
Build Systems
295296
-------------

docs/tutorial.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,14 @@ Here is an example for our STREAM benchmark:
264264
class stream_test(rfm.RunOnlyRegressionTest):
265265
...
266266
reference = {
267-
'myhost:baseline': {
267+
'generic:default': {
268268
'copy_bw': (23_890, -0.10, 0.30, 'MB/s'),
269269
'triad_bw': (17_064, -0.05, 0.50, 'MB/s'),
270270
}
271271
}
272272
273-
The :attr:`reference` test variable is a multi-level dictionary that defines the expected performance for each of the test's performance variables on all supported systems.
273+
The :attr:`reference` test variable is a multi-level dictionary that defines the expected performance for each of the test's performance variables on all supported systems (here, ``generic``) and partitions (here, ``default``).
274+
We explain more about this pre-defined system later in :ref:`systems-and-environments`.
274275
It is not necessary that all performance variables and all systems have a reference.
275276
If a reference value is not found, then the obtained performance will be logged, but no performance validation will be performed.
276277
The reference value is essentially a three or four element tuple of the form: ``(target_perf, lower_thres, upper_thres, unit)``. The ``unit`` is optional as it is already defined in the :func:`@performance_function <reframe.core.builtins.performance_function>` definitions.
@@ -310,6 +311,8 @@ Note that the ``RUN`` message is replaced by ``DRY`` in the dry-run mode.
310311
You can also check the generated test script in ``stage/generic/default/builtin/stream_test/rfm_job.sh``.
311312

312313

314+
.. _systems-and-environments:
315+
313316
Systems and environments
314317
========================
315318

@@ -338,7 +341,7 @@ We could do that simply by setting the :attr:`valid_prog_environs` as follows:
338341
339342
self.valid_prog_environs = ['+stream']
340343
341-
This tells ReFrame that this test is valid only for environments that define the ``stream`` feature.
344+
This tells ReFrame that this test is valid only for environments that define the ``stream`` feature (the ``+`` prefix requests a feature; we will explain the syntax later in this section).
342345
If we try to run the test now, nothing will be run:
343346

344347
.. code-block:: bash
@@ -355,7 +358,7 @@ If we try to run the test now, nothing will be run:
355358
This happens because ReFrame by default defines a generic system and environment.
356359
You may have noticed in our first run the ``@generic:default+builtin`` notation printed after test name.
357360
This is the system partition name (``generic:default``) and the environment name (``builtin``) where the test is being run in.
358-
The ``generic`` system and the ``builtin`` partition come as predefined in ReFrame.
361+
The ``generic`` system and the ``builtin`` environment come as predefined in ReFrame.
359362
They make the minimum possible assumptions:
360363

361364
- The ``generic`` system defines a single partition, named ``default`` which launches test jobs locally.
@@ -387,6 +390,19 @@ Let's look at some key elements of the configuration:
387390
Their definitions are resolved in the :attr:`~config.environments` section.
388391
* Every partition and environment can define a set of arbitrary features or key/value pairs in the :attr:`~config.environments.features` and :attr:`~config.environments.extras` options respectively.
389392
ReFrame will try to match system partitions and environments to a test based on the test's specification in :attr:`valid_systems` and :attr:`valid_prog_environs`.
393+
More specifically, a feature is requested with the ``+feat`` and excluded with ``-feat``, whereas an extra is requested with ``%key=val``.
394+
Multiple features or extras can be ANDed if specified in the same :attr:`valid_systems` or :attr:`valid_prog_environs` elements or otherwise ORed if specified in different elements:
395+
396+
.. code-block:: python
397+
398+
# Valid only for system partitions that define `feat0` and `key0=val` but not `feat1`
399+
valid_systems = [r'+feat0 -feat1 %key0=val']
400+
401+
# Valid only for environments with either feature `A` or `B`
402+
valid_prog_environs = ['+A', '+B']
403+
404+
Finally, a system or system partition name can be specified in :attr:`valid_systems` and similarly an environment name in :attr:`valid_prog_environs`, in which case the test is bound to those specific system partitions and/or environments.
405+
390406

391407
There are many options that we can be define for systems, partitions and environments.
392408
We will cover several of them as we go through the tutorial, but for the complete reference you should refer to :doc:`config_reference`.

0 commit comments

Comments
 (0)