Skip to content
Open
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ These are all the possible arguments to `schedule`:
- `job_name: str = "MiniZinc Benchmark"` - The SLURM job name.
- `cpus_per_task: int = 1` - The number of CPU cores required for each task.
- `memory: int = 4096` - The maximum memory used for each task.
- `mem_per_cpu: bool = False` - If True, memory limit will be per CPU (--mem-per-cpu),
- else --mem will be used.
- `debug: bool = False` - Directly capture the output of individual jobs
and store them in a `./logs/` directory.
- `wait: bool = False` - The scheduling process will wait for all jobs to
finish.
- Additional arguments `key_word=value` are directly passed to slurm unchecked,
after transformation to `--key-word=value`.

A `Configuration` object has the following attributes:

Expand Down
8 changes: 6 additions & 2 deletions src/mzn_bench/mzn_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ def schedule(
job_name: str = "MiniZinc Benchmark",
cpus_per_task: int = 1,
memory: int = 4096,
mem_per_cpu: bool = False,
debug: bool = False,
nice: Optional[int] = None,
wait: bool = False,
**kwargs,
) -> NoReturn:
# Count number of instances
assert instances.exists()
Expand Down Expand Up @@ -151,9 +153,9 @@ def schedule(
cmd = [
"sbatch",
f"--output={slurm_output}",
f'--job-name="{job_name}"',
f'--job-name={job_name}',
f"--cpus-per-task={cpus_per_task}",
f"--mem={memory}",
f"--mem-per-cpu={memory}" if mem_per_cpu else f"--mem={memory}",
f"--array=1-{n_tasks}",
f"--time={timeout + timedelta(minutes=1)}", # Set hard timeout as failsafe
]
Expand All @@ -169,6 +171,8 @@ def schedule(
cmd.append(f"--nice={nice}")
if wait:
cmd.append("--wait")
for option, value in kwargs.items():
cmd.append(f"--{option.replace('_', '-')}={value}")
cmd.extend(
[
str(this_script.resolve()),
Expand Down