Skip to content

add used_cpus_per_task parameter#322

Open
smoors wants to merge 7 commits intoEESSI:mainfrom
smoors:cpus-per-task
Open

add used_cpus_per_task parameter#322
smoors wants to merge 7 commits intoEESSI:mainfrom
smoors:cpus-per-task

Conversation

@smoors
Copy link
Collaborator

@smoors smoors commented Feb 13, 2026

useful for the OSU test where the actually used cpus per task is different from the requested cpus per task

fixes #321

@smoors
Copy link
Collaborator Author

smoors commented Feb 14, 2026

hm, this doesn't work for srun, where reframe automatically sets this:

srun --cpus-per-task=x ...

@smoors
Copy link
Collaborator Author

smoors commented Feb 14, 2026

ok, i managed to fix `srun` by setting SLURM_CPUS_PER_TASK and using a custom launcher based on srun, or by monkeypatching it in the site config like this:
srunlauncher_init = SrunLauncher.__init__


def srunlauncher_patched_init(self):
    srunlauncher_init(self)
    self.use_cpus_per_task = False


SrunLauncher.__init__ = srunlauncher_patched_init

we could add this to the common config so it will work for everyone out of the box.

@smoors
Copy link
Collaborator Author

smoors commented Feb 14, 2026

zut, setting SLURM_CPUS_PER_TASK doesn't work either:

srun: fatal: cpus-per-task set by two different environment variables SLURM_CPUS_PER_TASK=1 != SLURM_TRES_PER_TASK=cpu=2

i don't think it's wise to set/override SLURM_TRES_PER_TASK because it could also contain tres/gpu info.

@smoors
Copy link
Collaborator Author

smoors commented Feb 14, 2026

ok, this time it's really fixed, by adding a custom srun launcher that sets the actually used cpus per task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set OMP_NUM_THREADS explicitly to 1 in pure MPI runs such as OSU

1 participant