Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slurm, round up num CPUs #230

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ def options(self, rqmt):
gres += str(rqmt["gpu"])
out.append(gres)

out.append("--cpus-per-task=%s" % rqmt.get("cpu", 1))
def _round_up_to_even(n):
return n if n % 2 == 0 else n + 1

# Use an even number of CPUs, because when we have SLURM_CPUS_PER_TASK=1 (or any uneven num),
# but Slurm rounds the NumCPUs up to account for hyper-threading (NumCPUs=2),
# this will lead to SLURM_NTASKS=2, i.e. then this job would be executed twice.
# https://github.com/rwth-i6/sisyphus/issues/229
out.append("--cpus-per-task=%s" % _round_up_to_even(rqmt.get("cpu", 1)))

# Try to convert time to float, calculate minutes from it
# and convert it back to an rounded string
Expand Down
Loading