Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion executorlib/interactive/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def generate_slurm_command(
if cwd is not None:
command_prepend_lst += ["-D", cwd]
if threads_per_core > 1:
command_prepend_lst += ["--cpus-per-task" + str(threads_per_core)]
command_prepend_lst += ["--cpus-per-task=" + str(threads_per_core)]
if gpus_per_core > 0:
command_prepend_lst += ["--gpus-per-task=" + str(gpus_per_core)]
if openmpi_oversubscribe:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_pysqa_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
from executorlib.interactive.slurm import generate_slurm_command

try:
from executorlib.cache.queue_spawner import _pysqa_execute_command
Expand Down Expand Up @@ -43,3 +44,16 @@ def test_pysqa_execute_command_fail(self):
shell=False,
error_filename="pysqa.err",
)

def test_generate_slurm_command(self):
command_lst = generate_slurm_command(
cores=1,
cwd="/tmp/test",
threads_per_core=2,
gpus_per_core=1,
openmpi_oversubscribe=True,
slurm_cmd_args=["--help"],
)
self.assertEqual(len(command_lst), 9)
reply_lst = ['srun', '-n', '1', '-D', '/tmp/test', '--cpus-per-task=2', '--gpus-per-task=1', '--oversubscribe', '--help']
self.assertEqual(command_lst, reply_lst)
Loading