### Basic Pipeline Hook Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/regression_test_api.md Demonstrates attaching simple hooks to the 'setup' stage using @run_after. Hooks are executed in reverse MRO order by default. ```python class BaseTest(rfm.RegressionTest): @run_after('setup') def x(self): '''Hook x''' class DerivedTest(BaseTeset): @run_after('setup') def y(self): '''Hook y''' ``` -------------------------------- ### SSH Launcher Configuration Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/config_reference.md Example configuration for the 'ssh' launcher. Ensure password-less SSH access is configured for the remote host. ```python { 'name': 'foo' 'scheduler': 'local', 'launcher': 'ssh' 'access': ['-l admin', 'remote.host'], 'environs': ['builtin'], } ``` -------------------------------- ### Install ReFrame using EasyBuild Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/started.md Install ReFrame using an EasyBuild package. This method installs man pages and Graylog bindings by default. ```bash eb ReFrame-VERSION.eb -r ``` -------------------------------- ### Install ReFrame using uv Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/started.md Install the standard ReFrame package or with Graylog bindings using the uv package manager. Also shows how to install a development release from GitHub. ```bash uv tool install reframe-hpc # Install with Graylog bindings uv tool install reframe-hpc --extra graylog # Install a dev release from Github uv tool install git+https://github.com/reframe-hpc/reframe.git@VERSION_TAG ``` -------------------------------- ### Install ReFrame using uv Source: https://github.com/reframe-hpc/reframe/blob/develop/README.md Installs ReFrame using the uv package manager. Ensure uv is fetched and installed first. ```bash # Fetch uv curl -LsSf https://astral.sh/uv/install.sh | sh # Install ReFrame uv tool install reframe-hpc # Check the installation reframe -V ``` -------------------------------- ### ReFrame Site Configuration for EasyBuild Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md A minimal ReFrame site configuration defining a 'tutorialsys' system with 'lmod' modules system and a local partition. This configuration is used for running the EasyBuild example. ```python site_configuration = { 'systems': [ { 'name': 'tutorialsys', 'descr': 'Example system', 'hostnames': ['myhost'], 'modules_system': 'lmod', 'partitions': [ { 'name': 'default', 'descr': 'Example partition', 'scheduler': 'local', 'launcher': 'local', 'environs': ['builtin'] } ] } ] } ``` -------------------------------- ### Install ReFrame from source Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/started.md Clone the ReFrame repository and install it locally. This method also includes commands for running tests, building documentation, and serving it locally. ```bash git clone https://github.com/reframe-hpc/reframe.git cd reframe uv run reframe --version ``` ```bash uv sync --group dev --group docs # Run the unit tests uv run ./test_reframe.py # Build the documentation uv run make -C docs # View the documentation locally cd docs/html && python -m http.server ``` -------------------------------- ### Docker Run Command for ReFrame Examples Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md Command to run ReFrame examples within a Docker container, mounting local example directories and setting the working directory. ```bash docker run -h myhost --mount type=bind,source=$(pwd)/examples/,target=/home/user/reframe-examples --workdir=/home/user/reframe-examples/tutorial -it reframe-eb-spack:tutorial /bin/bash -l ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md An example of ReFrame configuration using YAML format, defining systems, partitions, and environments. This format offers a more compact configuration than Python. ```yaml systems: - name: tutorialsys descr: Example system hostnames: ['myhost'] partitions: - name: default descr: Example partition scheduler: local launcher: local environs: ['baseline'] environments: - name: baseline features: ['stream'] ``` -------------------------------- ### Build and Run Single-Node Tutorial Container Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Builds a Docker image for the single-node tutorial and runs it, mounting the ReFrame examples directory. ```bash git clone https://github.com/reframe-hpc/reframe.git cd reframe docker build -t reframe-tut-singlenode:latest -f examples/tutorial/dockerfiles/singlenode.Dockerfile . docker run -h myhost -it --mount type=bind,source=$(pwd)/examples/,target=/home/user/reframe-examples reframe-tut-singlenode:latest /bin/bash ``` -------------------------------- ### ReFrame Setup Output Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Displays the setup information when ReFrame is launched, including version, command, working directory, and configuration files loaded. ```console [ReFrame Setup] version: 4.5.0-dev.1 command: '/usr/local/share/reframe/bin/reframe -C config/baseline.py -c stream/stream_runonly.py -r' launched by: user@myhost working directory: '/home/user' settings files: '', 'reframe-examples/tutorial/config/baseline.py' check search path: '/home/user/reframe-examples/tutorial/stream/stream_runonly.py' stage directory: '/home/user/stage' output directory: '/home/user/output' log files: '/tmp/rfm-dz8m5nfz.log' <...> [----------] start processing checks [ RUN ] stream_test /2e15a047 @tutorialsys:default+baseline [ OK ] (1/1) stream_test /2e15a047 @tutorialsys:default+baseline P: copy_bw: 23135.4 MB/s (r:0, l:None, u:None) P: triad_bw: 16600.5 MB/s (r:0, l:None, u:None) [----------] all spawned checks have finished [ PASSED ] Ran 1/1 test case(s) from 1 check(s) (0 failure(s), 0 skipped, 0 aborted) ``` -------------------------------- ### Install ReFrame using Spack Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/started.md Install ReFrame using the Spack package manager. Explains available variants for installing documentation and Graylog bindings. ```bash spack install reframe ``` -------------------------------- ### Install ReFrame for Multi-architecture on Shared Filesystem Source: https://github.com/reframe-hpc/reframe/blob/develop/README.md Installs ReFrame for a specific architecture using uv, ensuring each installation has a unique prefix. The reframe executable is added to the PATH. ```bash export UV_TOOL_BIN_DIR=$HOME/.local/$(uname -m)/bin export UV_TOOL_DIR=$HOME/.local/$(uname -m)/share/uv/tools uv tool install reframe-hpc export PATH=$UV_TOOL_BIN_DIR:$PATH reframe -V ``` -------------------------------- ### Install ReFrame using pip Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/started.md Install ReFrame from PyPI, either the standard package or with Graylog bindings. Development releases from GitHub can also be installed. ```bash pip install reframe-hpc # Install with Graylog bindings pip install reframe-hpc[graylog] # Install a dev release from Github pip install git+https://github.com/reframe-hpc/reframe.git@VERSION_TAG ``` -------------------------------- ### Package Installation with EasyBuild and FPM Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md Configure ReFrame to package installations as RPM files using EasyBuild's packaging support and the FPM package manager. Ensure `keep_files` is set to retain generated packages. ```python self.keep_files = ['easybuild/packages'] self.build_system.package_opts = { 'type': 'rpm', } ``` -------------------------------- ### Performance Comparison Example 1 Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Compares test cases from a specific session with the mean performance of the last 10 days. ```console 7a70b2da-1544-4ac4-baf4-0fcddd30b672/now-10d:now/mean:/ ``` -------------------------------- ### Perflog Output Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Example of the output format found in a ReFrame performance log file. ```console result,job_completion_time,system:partition,environ,copy_bw_value,copy_bw_unit,triad_bw_value,triad_bw_unit pass,2024-02-26T22:39:52,pseudo-cluster:compute,gnu,11527.4,MB/s,10110.8,MB/s pass,2024-02-26T22:39:52,pseudo-cluster:compute,clang,11798.5,MB/s,8370.0,MB/s ``` -------------------------------- ### Query Specific Configuration Parameter Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Use `--show-config` to retrieve the value of a specific configuration parameter. This example queries the name of the first system. ```bash reframe --show-config=systems/0/name ``` -------------------------------- ### Running Derived Test from Library Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This command executes the derived test defined in `testlib_example.py`, which utilizes the test library. ```bash reframe -c reframe-examples/howto/testlib_example.py -r ``` -------------------------------- ### Aggregation Function Examples Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Illustrates the use of aggregation functions like 'max' and 'stats'. ```text max(num_tasks) ``` ```text stats ``` -------------------------------- ### Example of a built-in mpirun launcher Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This snippet shows the actual implementation of the 'mpirun' launcher in ReFrame, demonstrating how to derive from JobLauncher and implement the command() method. ```python from reframe.core.launchers import JobLauncher @register_launcher('mpirun') class MpirunLauncher(JobLauncher): def command(self, job): return ['mpirun', '-np', str(job.num_tasks)] ``` -------------------------------- ### Bootstrap ReFrame Installation Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md Installs ReFrame after building the local repository, cleaning the 'external' directory if pip encounters issues. ```bash # In case of problems with pip, first clean the `external` directory with `rm -rf external` ./bootstrap.sh ``` -------------------------------- ### Example Performance Log Output Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This is an example of the console output from a performance log file. It includes a header row followed by multiple data rows, each representing a test run with various performance metrics and job details. ```console result|job_completion_time|descr|env_vars|environ|exclusive_access|extra_resources|job_completion_time_unix|job_exitcode|job_nodelist|job_submit_time|jobid|modules|name|num_cpus_per_task|num_gpus_per_node|num_tasks|num_tasks_per_core|num_tasks_per_node|num_tasks_per_socket|partition|copy_bw_value|copy_bw_unit|copy_bw_ref|copy_bw_lower_thres|copy_bw_upper_thres|triad_bw_value|triad_bw_unit|triad_bw_ref|triad_bw_lower_thres|triad_bw_upper_thres|short_name|system|unique_name|use_multithreading pass|2024-02-21T22:51:16||{}|gnu|false|{}|1708555876.746763|null|None|1708555874.6122677|65||stream_test|null|null|1|null|null|null|compute|21116.7|MB/s|0|None|None|14813.0|MB/s|0|None|None|stream_test|pseudo-cluster|stream_test|null pass|2024-02-21T22:51:19||{}|clang|false|{}|1708555879.4456542|null|None|1708555877.3607173|66||stream_test|null|null|1|null|null|null|compute|18405.7|MB/s|0|None|None|14997.1|MB/s|0|None|None|stream_test|pseudo-cluster|stream_test|null pass|2024-02-25T20:45:17||{}|gnu|false|{}|1708893917.8675761|null|None|1708893915.3461528|69||stream_test|null|null|1|null|null|null|compute|11429.4|MB/s|0|None|None|10674.8|MB/s|0|None|None|stream_test|pseudo-cluster|stream_test|null pass|2024-02-25T20:45:17||{}|clang|false|{}|1708893917.9110286|null|None|1708893915.4608803|70||stream_test|null|null|1|null|null|null|compute|11909.9|MB/s|0|None|None|8325.0|MB/s|0|None|None|stream_test|pseudo-cluster|stream_test|null ``` -------------------------------- ### Start IPcluster with 2 engines Source: https://github.com/reframe-hpc/reframe/blob/develop/hpctestlib/interactive/jupyter/ipcmagic/src/tf-hvd-sgd-ipc-tf2.ipynb Starts an IPyParallel cluster with 2 worker engines. This command might need to be repeated in case of a TimeoutError. ```python %ipcluster start -n 2 ``` -------------------------------- ### Dependency Listing Output Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This console output illustrates how ReFrame displays test cases and their dependencies when using the list command. ```console [List of matched checks] - osu_allreduce_test /63dd518c ^build_osu_benchmarks /f6911c4c ^fetch_osu_benchmarks /52d9b2c6 Found 3 check(s) ``` -------------------------------- ### Run OSU Point-to-Point Bandwidth Benchmark Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/hpctestlib.md Executes the run-only version of the OSU point-to-point bandwidth benchmark. Requires the OSU microbenchmarks to be installed. ```console reframe -n 'osu_run.*benchmark_info=mpi.pt2pt.osu_bw' -S modules=my-osu-benchmarks -S valid_systems=mysystem -S valid_prog_environs=myenv -l ``` -------------------------------- ### Stream Workflows Specification Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md An example specification file for generating multiple STREAM test variants. It defines different configurations for element type, array size, number of iterations, and thread scaling. ```yaml stream_workflows: - elem_type: 'float' array_size: 16777216 num_iters: 10 num_threads: 4 - elem_type: 'double' array_size: 1048576 num_iters: 100 num_threads: 1 - elem_type: 'double' array_size: 16777216 num_iters: 10 thread_scaling: [1, 2, 4, 8] ``` -------------------------------- ### Defining a custom launcher in Python configuration Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This example demonstrates how to define a custom launcher, 'slrun', directly within a Python-based ReFrame configuration file. ```python from reframe.core.backends import register_launcher from reframe.core.launchers import JobLauncher @register_launcher('slrun') class MySmartLauncher(JobLauncher): def command(self, job): return ['slrun', ...] site_configuration = { 'systems': [ { 'name': 'my_system', 'partitions': [ { 'name': 'my_partition', 'launcher': 'slrun' ... } ], ... }, ... ], ... } ``` -------------------------------- ### Performance Comparison Example 2 Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Compares the best performance of test cases run on specific days, grouping by node list and including the test result. ```console 20240701:20240702/20240705:20240706/max:+job_nodelist/+result ``` -------------------------------- ### HTTPJSON Handler Configuration Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Configuration example for the httpjson handler to send performance logs to an HTTP endpoint. ```default 'format_perfvars': ('%(check_perf_value)s, '%(check_perf_unit)s, '), 'append': True }, { 'type': 'httpjson', 'url': 'https://httpjson-server:12345/rfm', 'level': 'info', 'debug': True, 'extra_headers': {'Key0': 'Value0', 'Key1': 'Value1'}, 'extras': { 'facility': 'reframe', 'data-version': '1.0' }, ``` -------------------------------- ### Example Output of Listed Test Variants Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Console output demonstrating how parameterized fixture values (e.g., elem_type=double) appear in the test variant names. ```console - stream_test %num_threads=8 %thread_placement=spread %stream_binary.elem_type=double /ffbd00f1 ^build_stream %elem_type=double ~tutorialsys:default+gnu-11.4.0 'stream_binary /099a4f75 ^build_stream %elem_type=double ~tutorialsys:default+clang-14.0.0 'stream_binary /7bd4e3bb <...omitted...> - stream_test %num_threads=1 %thread_placement=close %stream_binary.elem_type=float /bc1f32c2 ^build_stream %elem_type=float ~tutorialsys:default+gnu-11.4.0 'stream_binary /2ed36672 ^build_stream %elem_type=float ~tutorialsys:default+clang-14.0.0 'stream_binary /d19d2d86 Found 24 check(s) ``` -------------------------------- ### Launch Multi-Node Slurm Cluster with Docker Compose Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Launches a Slurm pseudo-cluster using a Docker Compose file for running multi-node examples. ```bash git clone https://github.com/reframe-hpc/reframe.git cd reframe docker compose --project-directory=$(pwd) -f examples/tutorial/dockerfiles/slurm-cluster/docker-compose.yml up --abort-on-container-exit --exit-code-from frontend ``` -------------------------------- ### Example Test Script Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Displays the content of a generated test script for a simple ReFrame test. This script contains the commands executed by the test. ```bash #!/bin/bash stream.x ``` -------------------------------- ### Example Time Period: 3 Weeks from August 5, 2024 Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Specifies a 3-week period starting on August 5, 2024. ```text 20240805:20240805+3w ``` -------------------------------- ### Define System, Partition, and Environment Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This snippet defines a basic ReFrame system named 'tutorialsys' with a 'default' partition and a 'baseline' environment. It's useful for setting up a minimal ReFrame configuration for testing. ```python site_configuration = { 'systems': [ { 'name': 'tutorialsys', 'descr': 'Example system', 'hostnames': ['myhost'], 'partitions': [ { 'name': 'default', 'descr': 'Example partition', 'scheduler': 'local', 'launcher': 'local', 'environs': ['baseline'] } ] } ], 'environments': [ { 'name': 'baseline', 'features': ['stream'] } ] } ``` -------------------------------- ### Select Specific Partitions and Environments Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Use --system and -p options to restrict tests to a single partition and/or environment. This example runs GCC tests on the compute partition. ```bash reframe --prefix=/scratch/rfm-stage/ -C config/cluster.py -c stream/stream_variables_fixtures.py \ --system=pseudo-cluster:compute -p gnu -r ``` -------------------------------- ### Dry-run Mode Output Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Example console output when running ReFrame in dry-run mode. Note the 'DRY' message replacing 'RUN'. ```console [==========] Running 1 check(s) [==========] Started on Wed Jan 10 22:45:49 2024+0000 [----------] start processing checks [ DRY ] stream_test /2e15a047 @generic:default+builtin [ OK ] (1/1) stream_test /2e15a047 @generic:default+builtin [----------] all spawned checks have finished [ PASSED ] Ran 1/1 test case(s) from 1 check(s) (0 failure(s), 0 skipped, 0 aborted) [==========] Finished on Wed Jan 10 22:45:49 2024+0000 ``` -------------------------------- ### Dynamic Path Generation for Filelog Handler Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/config_reference.md Demonstrates how to create dynamic paths for performance log files based on system and partition information. This is useful for organizing logs based on execution environment. ```none {basedir}/ system1/ partition1/ .log partition2/ .log ... system2/ ... ``` -------------------------------- ### Example ReFrame job script content Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This is an example of a generated Slurm job script for a ReFrame test, showing job name, output/error files, partition, and the nodelist for pinning. ```bash #!/bin/bash #SBATCH --job-name="rfm_stream_test_05038dad" #SBATCH --ntasks=1 #SBATCH --output=rfm_job.out #SBATCH --error=rfm_job.err #SBATCH --nodelist=nid01 #SBATCH -p all srun /scratch/rfm-stage/stage/pseudo-cluster/compute/gnu/build_stream_3f5dbfe2/stream.x ``` -------------------------------- ### Build ReFrame Documentation Locally Source: https://github.com/reframe-hpc/reframe/blob/develop/README.md Synchronizes documentation dependencies and builds the ReFrame documentation using 'uv run make'. The built documentation is located in the 'docs/html' directory. ```bash uv sync --group docs uv run make -C docs ``` -------------------------------- ### ReFrame Job Script Example Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This is an example of a ReFrame generated job script, showing the 'OMP_NUM_THREADS' environment variable set to 8 and the path to the compiled Stream benchmark executable. ```bash #!/bin/bash export OMP_NUM_THREADS=8 /scratch/rfm-stage/stage/pseudo-cluster/login/gnu/build_stream_c5e9e6a0/stream.x ``` -------------------------------- ### Show ReFrame Configuration with Specific File Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Load a specific configuration file and then inspect the resolved configuration. The ':' prefix drops any previously loaded configuration. ```bash reframe -C :config/baseline.py --show-config ``` -------------------------------- ### ReFrame Test with EasyBuild Integration Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This ReFrame test uses the EasyBuild build system to install zlib and verifies the installation. It demonstrates setting EasyBuild-specific attributes and managing generated modules. ```python import reframe as rfm import reframe.utility.sanity as sn @rfm.simple_test class ZlibEBCheck(rfm.RegressionTest): descr = 'Demo test using EasyBuild to build the test code' valid_systems = ['*'] valid_prog_environs = ['builtin'] executable = 'ls' executable_opts = ['$LD_LIBRARY_PATH/libz.so.1.3.1'] build_system = 'EasyBuild' @run_before('compile') def setup_build_system(self): self.build_system.easyconfigs = ['zlib-1.3.1.eb'] self.build_system.options = ['-f'] @run_before('run') def prepare_run(self): self.modules = self.build_system.generated_modules @sanity_function def assert_exists(self): return sn.assert_eq(self.job.exitcode, 0) ``` -------------------------------- ### Executing a Command as a Job Step Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This snippet demonstrates how to use the JobLauncher API to execute a command, such as 'hostname', as a distinct job step before the main executable. It leverages the prerun_cmds attribute. ```python @run_before('run') def hostname_step(self): launch_cmd = self.job.launcher.run_command(self.job) self.prerun_cmds = [f'{launch_cmd} hostname'] ``` -------------------------------- ### Example Slurm Job Script Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md An example of a Slurm job script generated by ReFrame. It specifies job parameters like name, tasks, output/error files, and partition, and includes the command to run the application. ```bash #!/bin/bash #SBATCH --job-name="rfm_stream_test" #SBATCH --ntasks=1 #SBATCH --output=rfm_job.out #SBATCH --error=rfm_job.err #SBATCH -p all srun /scratch/rfm-stage/stage/pseudo-cluster/compute/gnu/build_stream_3f5dbfe2/stream.x ``` -------------------------------- ### Example ReFrame Job Script with OMP_NUM_THREADS Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This is an example of a generated ReFrame job script. It shows how the `OMP_NUM_THREADS` environment variable is set based on the `num_threads` test variable provided via the command line. ```bash #!/bin/bash export OMP_NUM_THREADS=2 /home/user/reframe-examples/tutorial/stage/tutorialsys/default/clang-14.0.0/build_stream_d19d2d86/stream.x ``` -------------------------------- ### Check IPcluster version Source: https://github.com/reframe-hpc/reframe/blob/develop/hpctestlib/interactive/jupyter/ipcmagic/src/tf-hvd-sgd-ipc-tf2.ipynb Checks the installed version of IPcluster. ```python %ipcluster --version ``` -------------------------------- ### CompileOnlyRegressionTest with Make build system Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This example demonstrates how to use the 'Make' build system within a CompileOnlyRegressionTest. It shows how to specify source directories, set build options, and define CFLAGS. This is useful when your test requires compilation using Make. ```python import os import reframe as rfm import reframe.utility.sanity as sn class build_stream(rfm.CompileOnlyRegressionTest): build_system = 'Make' sourcesdir = 'https://github.com/jeffhammond/STREAM.git' array_size = variable(int, value=0) @run_before('compile') def prepare_build(self): omp_flag = self.current_environ.extras.get('omp_flag') self.build_system.options = ['stream_c.exe'] self.build_system.cflags = ['-O3', omp_flag] if self.array_size: self.build_system.cflags += [f'-DARRAY_SIZE={self.array_size}'] ``` -------------------------------- ### Example Session Filter: Tag '123' Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Selects all stored sessions with the tag '123'. ```text ?'tag=="123"' ``` -------------------------------- ### Configure ReFrame Activity Logging Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Set up multiple logging handlers for ReFrame activity. This example configures a debug log file and an info-level output file with timestamps and custom formats. ```default 'logging': [ { 'handlers': [ { 'type': 'file', 'name': 'reframe.log', 'timestamp': '%FT%T', 'level': 'debug2', 'format': ('[%(asctime)s] %(levelname)s: ' '%(check_info)s: %(message)s'), 'append': False }, { 'type': 'file', 'name': 'reframe.out', 'timestamp': '%FT%T', 'level': 'info', 'format': '%(message)s', 'append': False } ] } ] ``` -------------------------------- ### Custom JSON Formatter Function Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Example of a Python function to customize the JSON record format sent to an HTTP endpoint. ```default def _get_authorization_header(): return 'Bearer YOUR_API_TOKEN' def _format_record(record, extras, ignore_keys): data = {} for attr, val in record.__dict__.items(): if attr in ignore_keys or attr.startswith('_'): continue if attr.startswith('check_'): data[attr[6:]] = val else: ``` -------------------------------- ### Environment Configuration with Extras Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md This configuration snippet shows how to define environment extras, such as compiler flags, within the 'environments' list. These extras can be accessed from within a test. ```default 'environments': [ { 'name': 'baseline', 'features': ['stream'] }, { 'name': 'gnu', 'cc': 'gcc', 'cxx': 'g++', 'features': ['openmp'], 'extras': {'omp_flag': '-fopenmp'} }, { 'name': 'clang', 'cc': 'clang', 'cxx': 'clang++', 'features': ['openmp'], 'extras': {'omp_flag': '-fopenmp'} } ] ``` -------------------------------- ### Directory Structure for Test Library Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This shows the typical directory layout for a ReFrame test library and an example test file that uses it. ```console ~/reframe-examples/howto ├── testlib │   ├── __init__.py │   ├── simple.py │   └── utility │   └── __init__.py └── testlib_example.py ``` -------------------------------- ### Run ReFrame Unit Tests Source: https://github.com/reframe-hpc/reframe/blob/develop/README.md Synchronizes development dependencies and runs the framework's unit tests using 'uv run'. Requires a POSIX-compliant C compiler and the 'make' utility. ```bash uv sync --group dev uv run ./test_reframe.py -v ``` -------------------------------- ### Define Resource for Scheduler Options in Partition Configuration Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/tutorial.md Define a resource in the partition configuration with a name and a list of scheduler options. Placeholders in options are filled from the test. ```default 'resources': [ { 'name': 'memory', 'options': ['--mem={size}'] } ] ``` -------------------------------- ### Generated Spack Environment Structure Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md Example structure of the Spack environment created by ReFrame within the test's stage directory. ```console stage/generic/default/builtin/BZip2SpackCheck/ ├── rfm_spack_env │   ├── spack │   │   └── opt │   │      └── spack │   │      ├── bin │   │      └── darwin-catalina-skylake │   ├── spack.lock │   └── spack.yaml ├── rfm_ZlibSpackCheck_build.err ├── rfm_ZlibSpackCheck_build.out ├── rfm_ZlibSpackCheck_build.sh ├── rfm_ZlibSpackCheck_job.err ├── rfm_ZlibSpackCheck_job.out └── rfm_ZlibSpackCheck_job.sh ``` -------------------------------- ### Example Time Period: Last 10 Days Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/manpage.md Specifies the time period for the last 10 days using the 'now-10d:now' format. ```text now-10d:now ``` -------------------------------- ### Serve ReFrame Documentation Locally Source: https://github.com/reframe-hpc/reframe/blob/develop/README.md Serves the locally built ReFrame documentation using Python's http.server module. The documentation will be accessible at http://localhost:8000. ```bash cd docs/html python3 -m http.server ``` -------------------------------- ### Implicit Evaluation during Iteration Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/deferrables.md Illustrates that iterating over a deferred expression implicitly triggers its evaluation. The example uses a @sn.deferrable decorated function. ```pycon >>> @sn.deferrable ... def getlist(iterable): ... ret = list(iterable) ... ret += [1, 2, 3] ... return ret >>> getlist([1, 2, 3]) >>> for x in getlist([1, 2, 3]): ... print(x) ... 1 2 3 1 2 3 ``` -------------------------------- ### Define Deferrable Functions with Arguments Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/deferrables.md Shows how to define deferrable functions that accept arguments and how to combine them. The evaluation of chained deferrable functions is also demonstrated. ```python import reframe.utility.sanity as sn @sn.deferrable def foo(arg): print(arg) @sn.deferrable def greetings(): return 'hello' ``` -------------------------------- ### Assert equality with custom message Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/deferrable_functions_reference.md Example of using `assert_eq` with a custom formatted message. Placeholders in the message will be substituted with function arguments. ```python assert_eq(a, 1, msg="{0} is not equal to {1}") ``` -------------------------------- ### Execute code on all engines to get hostname Source: https://github.com/reframe-hpc/reframe/blob/develop/hpctestlib/interactive/jupyter/ipcmagic/src/tf-hvd-sgd-ipc-tf2.ipynb Executes Python code on all worker engines to retrieve their hostnames. Requires the `%%px` magic. ```python %%px import socket socket.gethostname() ``` -------------------------------- ### Create and batch TensorFlow dataset Source: https://github.com/reframe-hpc/reframe/blob/develop/hpctestlib/interactive/jupyter/ipcmagic/src/tf-hvd-sgd-ipc-tf2.ipynb Creates a TensorFlow dataset from the training data, shuffles, batches, and repeats it for training. Requires the `%%px` magic. ```python %%px dataset = tf.data.Dataset.from_tensor_slices((x_train.astype(np.float32), y_train.astype(np.float32))) dataset = dataset.shuffle(1000) dataset = dataset.batch(100) dataset = dataset.repeat(150) ``` -------------------------------- ### Force Flexible Execution of OSU Allreduce Benchmark Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md This command demonstrates how to force flexible execution for the OSU allreduce benchmark. Setting 'num_tasks' to zero allows ReFrame to span the test across all available nodes in the system partition. ```bash reframe --prefix=/scratch/rfm-stage/ -C config/cluster_mpi.py -c mpi/osu.py -n osu_allreduce_test -S num_tasks=0 -r ``` -------------------------------- ### Running ReFrame and Inspecting Build Script Source: https://github.com/reframe-hpc/reframe/blob/develop/docs/howto.md Shows the command to run a ReFrame test and how to inspect the generated build script for a Make build system. ```bash reframe -C config/baseline_environs.py -c stream/stream_make.py -p gnu -r cat output/tutorialsys/default/gnu/build_stream_40af02af/rfm_build.sh ```