-
Notifications
You must be signed in to change notification settings - Fork 1
/
weak_scaling_experiments.py
50 lines (42 loc) · 1.21 KB
/
weak_scaling_experiments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import sys
#
# Generate SLURM scripts for the weak scaling experiments.
#
base_str = """#!/bin/bash
#SBATCH --mail-user={email}
#SBATCH --mail-type=FAIL
#SBATCH --time=01:00:00
#SBATCH --ntasks-per-node=28
#SBATCH --nodes={nodes}
#SBATCH --mem=96G
#SBATCH --job-name={name}
#SBATCH --array=0-9
#SBATCH --account={buyin}
#SBATCH --output={output}/%x_%A_%a.out
cd ${{SLURM_SUBMIT_DIR}}
export OMP_NUM_THREADS={tasks},{nested}
srun -n {nodes} run.out -m 0.01 -c 0.75 -s ${{SLURM_ARRAY_TASK_ID}} -f 4 -p {population_size} -g 10000 -o ./{output}/
scontrol show job ${{SLURM_JOB_ID}}
"""
try:
email, buyin, output = sys.argv[1], sys.argv[2], sys.argv[3]
except IndexError:
print("Must provide email, buy-in group name, and output directory.")
min_scale = 1
max_scale = 6
for i in range(min_scale, max_scale + 1):
name = "s{}".format(i)
this_output = os.path.join(output, name)
os.makedirs(this_output, exist_ok=True)
with open(name + ".sb", "w") as fptr:
fptr.write(base_str.format(
email=email,
name=name,
buyin=buyin,
output=this_output,
nodes=i,
tasks=28,
nested=1,
population_size= i * 28
))