-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_jobs_mth.py
81 lines (55 loc) · 2.15 KB
/
run_jobs_mth.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import os
batch_str =\
"""#!/bin/bash -l
# Standard output and error:
#SBATCH -o ./tjob.out.{filename}.{mapping}.{nprocs}.%j
#SBATCH -e ./tjob.err.{filename}.{mapping}.{nprocs}.%j
# Initial working directory:
#SBATCH -D ./
# Job Name:
#SBATCH -J job_{filename}_{nprocs}
#
# Number of nodes and MPI tasks per node:
#SBATCH --nodes={nnodes}
#SBATCH --ntasks-per-node={ntasks_per_node}
#SBATCH --cpus-per-task={nthreads}
#SBATCH --mem={mem}
#
# Wall clock limit:
#SBATCH --time={time_limit}
module load gcc/9
module load openmpi/4
module load anaconda/3/2020.02 mpi4py/3.0.3
module load h5py-mpi/2.10
# Run the program:
export OMPI_MCA_mpi_warn_on_fork=0
export OMPI_MCA_mpi_yield_when_idle=1
export OMP_NUM_THREADS={nthreads}
export OMP_PLACES=cores
export OMP_PROC_BIND=close
"""
filenames = ['poisson_3d','time_harmonic_maxwell_3d']
mappings = [[['identity', True],['identity', False]],[['identity', True]]]
nnodes = [1,2,2**2,2**3,2**4,2**5,2**6,2**7]
ntasks_per_node = 2
ncells = [96,128,160,192]
degrees = [2,3,4,5]
nthreads = 16
script_nc_d = 'srun python3 {filename}.py -n {nc} {nc} {nc} -d {d} {d} {d} {mapping}\n'
os.makedirs('mesh', exist_ok=True)
#os.system('python3 mesh/generate_meshes.py')
os.makedirs('results', exist_ok=True)
for mapping,f in zip(mappings,filenames):
for ea in mapping:
mapp = '-m ' + ea[0]+(' -a' if ea[1] else '')
mapp_name = ea[0] + (('_'+'analytical') if ea[1] else '')
for nn in nnodes:
batch_script = batch_str.format(filename=f, mapping=mapp_name, nprocs=nn*ntasks_per_node,nnodes=nn,ntasks_per_node=ntasks_per_node, nthreads=nthreads, mem=150000,time_limit="6:00:00")
for nc in ncells:
for d in degrees:
batch_script += script_nc_d.format(filename=f, nc=nc, d=d, mapping=mapp)
batch_script += '\n'
filename = 'job_{filename}_{mapping}_{nprocs}.sh'.format(filename=f, mapping=mapp_name, nprocs=nn*ntasks_per_node)
with open(filename,'w') as file_:
file_.write(batch_script)
os.system('sbatch {}'.format(filename))