Skip to content

-p/--prgenv has no effect when --mode is used #3734

In review

Description

@Lewih

With --mode, the -p PATTERN option is silently ignored and tests run in all their valid programming environments. Without --mode it works.

$ reframe -n MPIHelloWorldTest -p '.*foss' --dry-run # filters correctly
$ reframe -n MPIHelloWorldTest -p '.*foss' --dry-run --mode=mymode # reverts to the .* fallback

This is quite of a problem as this feature shall be required soon in our production environment.

Activity

  1. Lewih commented on Sep 14, 2026

    @Lewih
    ContributorAuthor

    As a workaround I found that
    reframe --dry-run --mode=mymode -n mutest -S valid_prog_environs=intel-2025a_mpi
    behaves as expected. Still, the -p option is described as the first choice option in the documentation.

  2. added theissue type on Sep 14, 2026
  3. vkarak commented on Sep 14, 2026

    @vkarak
    Contributor

    What options does the mode define?

  4. vkarak commented on Sep 14, 2026

    @vkarak
    Contributor

    I cannot reproduce it. Here are the modes that I define:

    modes:
      - name: mymode
        options: ["-p", "clang"]

    Selecting tests without the mode:

    reframe -C config/machines.yaml -c unittests/resources/checks/hellocheck.py -lC
    [List of matched checks]
    - HelloTest /2b3e4546 @tresa:default+gnu
    - HelloTest /2b3e4546 @tresa:default+clang
    - HelloTest /2b3e4546 @tresa:default+builtin
    - CompileOnlyHelloTest /ecfc0900 @tresa:default+gnu
    - CompileOnlyHelloTest /ecfc0900 @tresa:default+clang
    - CompileOnlyHelloTest /ecfc0900 @tresa:default+builtin
    Concretized 6 test case(s)

    Using the mode:

    reframe -C config/machines.yaml -c unittests/resources/checks/hellocheck.py -lC --mode=mymode
    [List of matched checks]
    - HelloTest /2b3e4546 @tresa:default+clang
    - CompileOnlyHelloTest /ecfc0900 @tresa:default+clang
    Concretized 2 test case(s)

    As expected.

    Note that it works also if options are defined as a single string:

    modes:
      - name: mymode
        options: ["-p clang"]
  5. Lewih commented on Sep 17, 2026

    @Lewih
    ContributorAuthor

    There is a misalignment between our setups.

    I do not put the -p option in the mode section of the config file, instead I only use it in the CLI to ideally select a subset of tests.

    I call the run script reframe --dry-run --mode=all -n MPIHello -p foss-2025a_mpi and have the following output

    [----------] start processing checks
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2023a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2024a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2023a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2024a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2025a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2025a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2023a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2024a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2023a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2024a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2025a_mpi
    [ DRY      ] MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2025a_mpi
    [       OK ] ( 1/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2023a_mpi
    [       OK ] ( 2/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2024a_mpi
    [       OK ] ( 3/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2023a_mpi
    [       OK ] ( 4/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2024a_mpi
    [       OK ] ( 5/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+foss-2025a_mpi
    [       OK ] ( 6/12) MPIHelloWorldTest %launcher=mpirun /f131341c @vaughan:default+intel-2025a_mpi
    [       OK ] ( 7/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2023a_mpi
    [       OK ] ( 8/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2024a_mpi
    [       OK ] ( 9/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2023a_mpi
    [       OK ] (10/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2024a_mpi
    [       OK ] (11/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+foss-2025a_mpi
    [       OK ] (12/12) MPIHelloWorldTest %launcher=srun /4c917fff @vaughan:default+intel-2025a_mpi
    [----------] all spawned checks have finished
    ...
    

    The desired output should show only the foss-2025a_mpi variants of the tests.
    Can you reproduce this?

    The modes section of my config file is as follows

    standard_mode_options = [
        '--exec-policy=async',
        '--output=/myfolder',
        '--perflogdir=/myfolder2',
        '--stage=/myfolder3',
        '--report-file=/myfolder/report.json',
        '--nocolor',
        '--checkpath=/myfolder/checks'
    ]
    
    site_configuration = {
        'modes':
        [
            {
                'name': 'daily',
                # change exec-policy to serial
                'options': standard_mode_options[1:len(standard_mode_options)] + ['--flex-alloc-nodes="1"', '--exec-policy=async', '-t daily']
            },
            {
                'name': 'calcua',
                'options': standard_mode_options + ['-T massive', '-T daily'],
            },
            {
                'name': 'all',
                'options': standard_mode_options
            }
        ],
    ...
    
  6. vkarak commented on Sep 30, 2026

    @vkarak
    Contributor

    Indeed, I updated my mode and I reproduced it:

    modes:
      - name: mymode
        options: ["--prefix", "foo"]
    reframe -C config/machines.yaml -c unittests/resources/checks/hellocheck.py --mode=mymode -n ^HelloTest -p clang -lC
    - HelloTest /2b3e4546 @tresa:default+gnu
    - HelloTest /2b3e4546 @tresa:default+clang
    - HelloTest /2b3e4546 @tresa:default+builtin
  7. vkarak commented on Sep 30, 2026

    @vkarak
    Contributor

    Yes, this is a bug. It comes from here:

    options = argparser.parse_args(namespace=options.cmd_options)
    options.update_config(site_config)

    where ReFrame combines the mode options with those already passed. Inspecting the update_config it seems that ReFrame combines the default value of --prgenv, which is .* with the option passed in the command line as if the user has passed -p '.*' -p clang:

    (Pdb) list
    134                 confvar, action = spec[1:3]
    135                 if action == 'version' or confvar is None:
    136                     continue
    137  
    138                 try:
    139  ->                 value = getattr(self, option)
    140                 except ValueError as e:
    141                     errors.append(e)
    142                     continue
    143  
    144                 if not _undefined(value):
    (Pdb) p getattr(self, 'prgenv')
    ['.*', 'clang']
  8. added this to the milestone on Sep 30, 2026
  9. modified the milestones: , ReFrame 4.11 on Oct 29, 2026
  10. self-assigned this
    on Nov 25, 2026
  11. moved this from Todo to In Progress in ReFrame Backlogon Nov 25, 2026
  12. moved this from In Progress to Merge To Develop in ReFrame Backlogon Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions