From 0783699142d638df7f798f72d0c01bdb56254219 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sat, 29 Nov 2025 21:59:13 +0100 Subject: [PATCH 1/4] add PRTE_MCA_rmaps_base_mapping_policy --- eessi/testsuite/hooks.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/eessi/testsuite/hooks.py b/eessi/testsuite/hooks.py index 0c17b7ef..2bfeb9e0 100644 --- a/eessi/testsuite/hooks.py +++ b/eessi/testsuite/hooks.py @@ -667,7 +667,7 @@ def set_compact_process_binding(test: rfm.RegressionTest): It is hard to do this in a portable way. Currently supported for process binding are: - Intel MPI (through I_MPI_PIN_DOMAIN) - - OpenMPI (through OMPI_MCA_rmaps_base_mapping_policy) + - OpenMPI (through {OMPI,PRTE}_MCA_rmaps_base_mapping_policy) - srun (LIMITED SUPPORT: through SLURM_CPU_BIND, but only effective if task/affinity plugin is enabled) """ @@ -680,20 +680,19 @@ def set_compact_process_binding(test: rfm.RegressionTest): if test.current_partition.launcher_type().registered_name == 'mpirun': # Do binding for intel and OpenMPI's mpirun, and srun - test.env_vars['I_MPI_PIN_CELL'] = 'core' # Don't bind to hyperthreads, only to physcial cores - test.env_vars['I_MPI_PIN_DOMAIN'] = '%s:compact' % physical_cpus_per_task - test.env_vars['OMPI_MCA_rmaps_base_mapping_policy'] = 'slot:PE=%s' % physical_cpus_per_task - log(f'Set environment variable I_MPI_PIN_CELL to {test.env_vars["I_MPI_PIN_CELL"]}') - log(f'Set environment variable I_MPI_PIN_DOMAIN to {test.env_vars["I_MPI_PIN_DOMAIN"]}') - log('Set environment variable OMPI_MCA_rmaps_base_mapping_policy to ' - f'{test.env_vars["OMPI_MCA_rmaps_base_mapping_policy"]}') + env_vars = { + 'I_MPI_PIN_CELL': 'core', # Don't bind to hyperthreads, only to physcial cores + 'I_MPI_PIN_DOMAIN': f'{physical_cpus_per_task}:compact', + 'OMPI_MCA_rmaps_base_mapping_policy': f'slot:PE={physical_cpus_per_task}', + 'PRTE_MCA_rmaps_base_mapping_policy': f'slot:PE={physical_cpus_per_task}', + } elif test.current_partition.launcher_type().registered_name == 'srun': # Set compact binding for SLURM. Only effective if the task/affinity plugin is enabled # and when number of tasks times cpus per task equals either socket, core or thread count - test.env_vars['SLURM_DISTRIBUTION'] = 'block:block' - test.env_vars['SLURM_CPU_BIND'] = 'verbose' - log(f'Set environment variable SLURM_DISTRIBUTION to {test.env_vars["SLURM_DISTRIBUTION"]}') - log(f'Set environment variable SLURM_CPU_BIND to {test.env_vars["SLURM_CPU_BIND"]}') + env_vars = { + 'SLURM_DISTRIBUTION': 'block:block', + 'SLURM_CPU_BIND': 'verbose', + } else: msg = "hooks.set_compact_process_binding does not support the current launcher" msg += f" ({test.current_partition.launcher_type().registered_name})." @@ -703,6 +702,10 @@ def set_compact_process_binding(test: rfm.RegressionTest): # Warnings will, at default loglevel, be printed on stdout when executing the ReFrame command rflog.getlogger().warning(msg) + for key, value in env_vars: + test.env_vars[key] = value + log(f'Set environment variable {key} to {test.env_vars[value]}') + def set_compact_thread_binding(test: rfm.RegressionTest): """ From 252203e4c11377954cdc94d2c3a7bed25262c0dd Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sat, 29 Nov 2025 22:05:34 +0100 Subject: [PATCH 2/4] fix --- eessi/testsuite/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi/testsuite/hooks.py b/eessi/testsuite/hooks.py index 2bfeb9e0..6fb8de7f 100644 --- a/eessi/testsuite/hooks.py +++ b/eessi/testsuite/hooks.py @@ -702,7 +702,7 @@ def set_compact_process_binding(test: rfm.RegressionTest): # Warnings will, at default loglevel, be printed on stdout when executing the ReFrame command rflog.getlogger().warning(msg) - for key, value in env_vars: + for key, value in env_vars.items(): test.env_vars[key] = value log(f'Set environment variable {key} to {test.env_vars[value]}') From 6988245a995b0342f46e3e73abaae13d744a56ec Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sat, 29 Nov 2025 22:11:13 +0100 Subject: [PATCH 3/4] fix --- eessi/testsuite/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi/testsuite/hooks.py b/eessi/testsuite/hooks.py index 6fb8de7f..8d44e216 100644 --- a/eessi/testsuite/hooks.py +++ b/eessi/testsuite/hooks.py @@ -704,7 +704,7 @@ def set_compact_process_binding(test: rfm.RegressionTest): for key, value in env_vars.items(): test.env_vars[key] = value - log(f'Set environment variable {key} to {test.env_vars[value]}') + log(f'Set environment variable {key} to {test.env_vars[key]}') def set_compact_thread_binding(test: rfm.RegressionTest): From eec69f51778c92e407fc490a4141a9d2d561e2b8 Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Sat, 29 Nov 2025 22:14:26 +0100 Subject: [PATCH 4/4] fix --- eessi/testsuite/hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/eessi/testsuite/hooks.py b/eessi/testsuite/hooks.py index 8d44e216..1c615c5a 100644 --- a/eessi/testsuite/hooks.py +++ b/eessi/testsuite/hooks.py @@ -694,6 +694,7 @@ def set_compact_process_binding(test: rfm.RegressionTest): 'SLURM_CPU_BIND': 'verbose', } else: + env_vars = {} msg = "hooks.set_compact_process_binding does not support the current launcher" msg += f" ({test.current_partition.launcher_type().registered_name})." msg += " The test will run, but using the default binding strategy of your parallel launcher."