@@ -77,7 +77,7 @@ def _assign_default_num_gpus_per_node(test: rfm.RegressionTest):
7777 log (f'default_num_gpus_per_node set to { test .default_num_gpus_per_node } ' )
7878
7979
80- def assign_tasks_per_compute_unit (test : rfm .RegressionTest , compute_unit : str , num_per : int = 1 ):
80+ def assign_tasks_per_compute_unit (test : rfm .RegressionTest ):
8181 """
8282 Assign one task per compute unit. More than 1 task per compute unit can be assigned with
8383 num_per for compute units that support it.
@@ -102,7 +102,9 @@ def assign_tasks_per_compute_unit(test: rfm.RegressionTest, compute_unit: str, n
102102 - assign_tasks_per_compute_unit(test, COMPUTE_UNITS.CPU_SOCKET) will launch 2 tasks with 64 threads per task
103103
104104 """
105- log (f'assign_tasks_per_compute_unit called with compute_unit: { compute_unit } and num_per: { num_per } ' )
105+ compute_unit = test .compute_unit
106+ num_per = test .num_tasks_per_compute_unit
107+ log (f'assign_tasks_per_compute_unit with compute_unit: { compute_unit } and num_per: { num_per } ' )
106108
107109 if num_per != 1 and compute_unit not in [COMPUTE_UNITS .NODE ]:
108110 raise NotImplementedError (
@@ -150,7 +152,7 @@ def assign_tasks_per_compute_unit(test: rfm.RegressionTest, compute_unit: str, n
150152 elif compute_unit == COMPUTE_UNITS .NUMA_NODE :
151153 _assign_one_task_per_numa_node (test )
152154 elif compute_unit == COMPUTE_UNITS .NODE :
153- _assign_num_tasks_per_node (test , num_per )
155+ _assign_num_tasks_per_node (test )
154156 else :
155157 raise ValueError (f'compute unit { compute_unit } is currently not supported' )
156158
@@ -165,10 +167,13 @@ def assign_tasks_per_compute_unit(test: rfm.RegressionTest, compute_unit: str, n
165167 test .env_vars ['SRUN_CPUS_PER_TASK' ] = test .num_cpus_per_task
166168 log (f'Set environment variable SRUN_CPUS_PER_TASK to { test .env_vars ["SRUN_CPUS_PER_TASK" ]} ' )
167169
170+ if not test .used_cpus_per_task :
171+ test .used_cpus_per_task = test .num_cpus_per_task
172+
168173 _set_job_resources (test )
169174
170175
171- def _assign_num_tasks_per_node (test : rfm .RegressionTest , num_per : int = 1 ):
176+ def _assign_num_tasks_per_node (test : rfm .RegressionTest ):
172177 """
173178 Sets num_tasks_per_node and num_cpus_per_task such that it will run
174179 'num_per' tasks per node, unless specified with:
@@ -183,6 +188,7 @@ def _assign_num_tasks_per_node(test: rfm.RegressionTest, num_per: int = 1):
183188 - num_tasks_per_node = num_per
184189 - num_cpus_per_task = test.default_num_cpus_per_node / num_tasks_per_node
185190 """
191+ num_per = test .num_tasks_per_compute_unit
186192
187193 # neither num_tasks_per_node nor num_cpus_per_task are set
188194 if not test .num_tasks_per_node and not test .num_cpus_per_task :
@@ -693,7 +699,7 @@ def set_compact_process_binding(test: rfm.RegressionTest):
693699 # TODO: check if this also leads to sensible binding when using COMPUTE_UNITS.HWTHREAD
694700 check_proc_attribute_defined (test , 'num_cpus_per_core' )
695701 num_cpus_per_core = test .current_partition .processor .num_cpus_per_core
696- physical_cpus_per_task = int (test .num_cpus_per_task / num_cpus_per_core )
702+ physical_cpus_per_task = int (test .used_cpus_per_task / num_cpus_per_core )
697703
698704 if test .current_partition .launcher_type ().registered_name == 'mpirun' :
699705 # Do binding for intel and OpenMPI's mpirun, and srun
@@ -760,7 +766,7 @@ def set_omp_num_threads(test: rfm.RegressionTest):
760766 """
761767 Set number of OpenMP threads equal to number of CPUs per task
762768 """
763- test .env_vars ['OMP_NUM_THREADS' ] = test .num_cpus_per_task
769+ test .env_vars ['OMP_NUM_THREADS' ] = test .used_cpus_per_task
764770 log (f'Set environment variable OMP_NUM_THREADS to { test .env_vars ["OMP_NUM_THREADS" ]} ' )
765771
766772
0 commit comments