-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBatchGenerator.py
More file actions
47 lines (37 loc) · 1.73 KB
/
Copy pathBatchGenerator.py
File metadata and controls
47 lines (37 loc) · 1.73 KB
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
"""
#!/bin/bash
#SBATCH -J sim_n # job name
#SBATCH -o sim_n.log # output and error file name (%j expands to jobID)
#SBATCH -N 1 # total number of nodes
#SBATCH --exclusive # processes per node
#SBATCH -p parallel-medium # queue (partition) -- batch, parallel, etc.
module load anaconda/2.2.0
python simulation_script args
"""
import os
import subprocess
if os.path.isdir("./UnreliableAssignmentFragments"):
raise ValueError("Folder already exists. Delete /UnreliableAssignmentFragments/ to continue")
num_jobs = 1000
step = .025
base = 0.0
trials = 10000
percentage = base
os.mkdir("UnreliableAssignmentFragments")
os.chdir("./UnreliableAssignmentFragments")
for i in range(41):
os.mkdir("Fragment_" + str(i))
os.chdir("./Fragment_" + str(i))
with open("trials_{:}_{:}_{:}.sh".format(str(trials), int(percentage*100), str(num_jobs)), 'w') as fout:
fout.write("#!/bin/bash\n")
fout.write("#SBATCH -J sim_{:}_{:}\n".format(int(percentage*100), str(num_jobs)))
fout.write("#SBATCH -o sim_{:}_{:}.log\n".format(int(percentage*100), str(num_jobs)))
fout.write("#SBATCH -e sim_{:}_{:}.err\n".format(int(percentage*100), str(num_jobs)))
fout.write("#SBATCH -N 1\n")
fout.write("#SBATCH --exclusive\n")
fout.write("#SBATCH -p parallel-medium\n\n")
fout.write("module load anaconda/2.2.0\n\n")
fout.write("python ../../Collection.py {:} {:} {:} {:}".format(str(num_jobs), str(percentage), str(trials), "trials_{:}_{:}_{:}.csv".format(str(trials), int(percentage*100), str(num_jobs))))
subprocess.call(["sbatch", "./trials_{:}_{:}_{:}.sh".format(str(trials), int(percentage*100), str(num_jobs))])
os.chdir("../")
percentage += step