You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial_advanced.rst
+120-3Lines changed: 120 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -683,6 +683,9 @@ First, we need to enable the container platform support in ReFrame's configurati
683
683
For each partition, users can define a list of container platforms supported using the :js:attr:`container_platforms` `configuration parameter <config_reference.html#.systems[].partitions[].container_platforms>`__.
684
684
In this case, we define the `Sarus <https://github.com/eth-cscs/sarus>`__ platform for which we set the :js:attr:`modules` parameter in order to instruct ReFrame to load the ``sarus`` module, whenever it needs to run with this container platform.
685
685
Similarly, we add an entry for the `Singularity <https://sylabs.io>`__ platform.
686
+
Optionally, users are allowed to set the ``default`` attribute to :obj:`True` in order to mark a specific container platform as the default of that partition (see below on how this information is being used).
687
+
If no default container platform is specified explicitly, then always the first in the list will be considered as successful.
688
+
686
689
687
690
The following parameterized test, will create two tests, one for each of the supported container platforms:
688
691
@@ -698,14 +701,17 @@ The following parameterized test, will create two tests, one for each of the sup
698
701
699
702
A container-based test can be written as :class:`~reframe.core.pipeline.RunOnlyRegressionTest` that sets the :attr:`~reframe.core.pipeline.RegressionTest.container_platform` attribute.
700
703
This attribute accepts a string that corresponds to the name of the container platform that will be used to run the container for this test.
701
-
If such a platform is not `configured <config_reference.html#container-platform-configuration>`__ for the current system, the test will fail.
704
+
It is not necessary to specify this attribute, in which case, the default container platform of the current partition will be used.
705
+
You can still differentiate your test based on the actual container platform that is being used by checking the ``self.container_platform.name`` variable.
706
+
707
+
As soon as the container platform to be used is determined, you need to specify the container image to use by setting the :attr:`~reframe.core.containers.ContainerPlatform.image`.
708
+
If the image is not specified, then the container logic is skipped and the test executes as if the :attr:`~reframe.core.pipeline.RegressionTest.container_platform` was never set.
702
709
703
-
As soon as the container platform to be used is defined, you need to specify the container image to use by setting the :attr:`~reframe.core.containers.ContainerPlatform.image`.
704
710
In the ``Singularity`` test variant, we add the ``docker://`` prefix to the image name, in order to instruct ``Singularity`` to pull the image from `DockerHub <https://hub.docker.com/>`__.
705
711
The default command that the container runs can be overwritten by setting the :attr:`~reframe.core.containers.ContainerPlatform.command` attribute of the container platform.
706
712
707
713
The :attr:`~reframe.core.containers.ContainerPlatform.image` is the only mandatory attribute for container-based checks.
708
-
It is important to note that the :attr:`~reframe.core.pipeline.RegressionTest.executable` and :attr:`~reframe.core.pipeline.RegressionTest.executable_opts` attributes of the actual test are ignored in case of container-based tests.
714
+
It is important to note that the :attr:`~reframe.core.pipeline.RegressionTest.executable` and :attr:`~reframe.core.pipeline.RegressionTest.executable_opts` attributes of the actual test are ignored if the containerized code path is taken, i.e., when :attr:`~reframe.core.containers.ContainerPlatform.image` is not :obj:`None`.
709
715
710
716
ReFrame will run the container according to the given platform as follows:
711
717
@@ -759,6 +765,117 @@ For a complete list of the available attributes of a specific container platform
759
765
On how to configure ReFrame for running containerized tests, please have a look at the :ref:`container-platform-configuration` section of the :doc:`config_reference`.
760
766
761
767
768
+
.. versionchanged:: 3.12.0
769
+
There is no need any more to explicitly set the :attr:`container_platform` in the test.
770
+
This is automatically initialized from the default platform of the current partition.
771
+
772
+
773
+
774
+
Combining containerized and native application tests
It is very easy in ReFrame to have a single run-only test to either test the native or the containerized version of an application.
780
+
This is possible, since the framework will only take the "containerized" code path only if the :attr:`~reframe.core.containers.ContainerPlatform.image` attribute of the :attr:`~reframe.core.pipeline.RegressionTest.container_platform` is not :obj:`None`.
781
+
Otherwise, the *bare metal* version of the tested application will be run.
782
+
The following test uses exactly this trick to test a series of GROMACS images as well as the native one provided on the Piz Daint supercomputer.
783
+
It also extends the GROMACS benchmark tests that are provided with ReFrame's test library (see :doc:`hpctestlib`).
784
+
For simplicity, we are assuming a single system here (the hybrid partition of Piz Daint) and we set fixed values for the :attr:`num_cpus_per_task` as well as the ``-ntomp`` option of GROMACS (NB: in a real-world test we would use the auto-detected processor topology information to set these values; see :ref:`proc-autodetection` for more information).
785
+
We also redefine and restrict the benchmark's parameters ``benchmark_info`` and ``nb_impl`` to the values that are of interest for the demonstration of this test.
786
+
Finally, we also reset the executable to use ``gmx`` instead of the ``gmx_mpi`` that is used from the library test.
All this test does in addition to the library test it inherits from is to set the :attr:`~reframe.core.containers.ContainerPlatform.image` and the :attr:`~reframe.core.containers.ContainerPlatform.command` attributes of the :attr:`~reframe.core.pipeline.RegressionTest.container_platform`.
793
+
The former is set from the ``gromacs_image`` test parameter whereas the latter from the test's :attr:`~reframe.core.pipeline.RegressionTest.executable` and :attr:`~reframe.core.pipeline.RegressionTest.executable_opts` attributes.
794
+
Remember that these attributes are ignored if the framework takes the path of launching a container.
795
+
Finally, if the image is :obj:`None` we handle the case of the native run, in which case we load the modules required to run GROMACS natively on the target system.
796
+
797
+
In the following, we run the GPU version of a single benchmark with a series of images from NVIDIA and natively:
0 commit comments