11#! /bin/bash
2+ # SBATCH --job-name=gmgpolar-setup
3+ # SBATCH --output=slurm-%A-setup.out
4+ # SBATCH --error=slurm-%A-setup.err
5+ # SBATCH -N 1
6+ # SBATCH -n 1
7+ # SBATCH -c 1
8+ # SBATCH -t 5
29
310# fixed variables
11+ # If Origin is chosen, the node can be set as coarse or fine. Default: Coarse.
412origin_NOT_coarse=0 # origin_NOT_coarse
13+ # Choose anisotropy in angle-direction. Default: Off.
514theta_aniso=0 # theta_aniso
15+ # Smoother 3 is our default, 13 is used for some testing, should be not used
16+ # for production. -> TODO: Rename smoother names
17+ smoother=3 # smoother (3,13)
618
7- # changing variables ?!
8- prob=5 # prob
9- R=1.3 # R
10- kappa_eps=0 # k
11- delta_e=0 # d
12- discr=3 # discr
13- fac_ani=3 # a
14- nr_exp=4 # n
19+ # default variables
20+ # If origin is not a particular node of the mesh, Dirichlet boundary conditions
21+ # can be implemented on the most inner circle
22+ DirBC_Interior=1 # DirBC_Interior (0/1)
23+ # Generalized radius of most inner circle. Defines if origin will be a particular node.
24+ R0=1e-8 # r (1e-8/1e-5/1e-2)
25+ # Generalized radius of maximum outer circle.
26+ R=1.3 # R
27+ # Anisotropy in radial direction.
28+ fac_ani=3 # a
29+ # TODO: which nr_exp and divideby2 do we want to consider?
30+ nr_exp=4 # n
1531
1632# changing variables
17- mod_pk=0 # mod_pk (0/1)
18- R0=0.1 # r (1e-8/1e-5/1e-2)
19- DirBC_Interior=0 # DirBC_Interior (0/1)
20- divideBy2=0 # divideBy2 (3/4/5/6)
21- smoother=3 # smoother (3,13)
22- extrapolation=0 # E
33+ mod_pk=1 # mod_pk=1: Shafranov geometry
34+ prob=7 # Prob=7: Simulate solution (23) of Bourne et al.
35+ # TODO: which alpha and beta to simulate? Alpha aligned with anisotropy?
36+ alpha_coeff=2
37+ beta_coeff=1
38+
39+ # set to on
40+ extrapolation=1 # E
41+
42+ debug=0
43+ v1=1
44+ v2=1
45+ maxiter=300
46+ res_norm=3
47+ rel_red_conv=1e-11
48+
49+ nodes=1
50+ ranks=1 # number of MPI Ranks
51+ cores=128 # set OpenMP Num Threads to maximum number of cores requested
52+
53+ # ###################################
54+ # # create grids ##
55+ # ###################################
56+ create_grid=0
57+ if [ $create_grid ]
58+ then
59+ cd ..
60+ mkdir -p angles_files/Rmax" $R " /aniso" $fac_ani " /
61+ mkdir -p radii_files/Rmax" $R " /aniso" $fac_ani " /
62+ # Costly function as setup as expensive and sequential. Only run once.
63+ for divideBy2 in 0 1 2 3 4 5 6 7 8 # create different grid sizes
64+ do
65+ # # ATTENTION / REMARK:
66+ # # Please note that these calls will abort/segfault as creation of grids and computation in one step
67+ # # is not yet supported by GMGPolar. We will make this functionality available in a future commit.
68+ # # Please ignore abort/segfault for the calls in this loop.
69+ # mod_pk has no effect on the creation of grids as the set of (r,theta) is
70+ # the same for all geometries, only the mapping F(r,theta) -> (x,y) changes.
71+ ./build/gmgpolar_simulation -n $nr_exp -a $fac_ani --mod_pk 0 --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother --verbose 2 --debug $debug --extrapolation $extrapolation --optimized 1 $ --v1 $v1 --v2 $v2 -R $R --prob $prob --maxiter $maxiter --alpha_coeff $alpha_coeff --beta_coeff $beta_coeff --res_norm $res_norm --write_radii_angles 1 --f_grid_r " radii_files/Rmax" $R " /aniso" $fac_ani " /divide" $divideBy2 " .txt" --f_grid_theta " angles_files/Rmax" $R " /aniso" $fac_ani " /divide" $divideBy2 " .txt"
72+ done
73+ fi
2374
2475echo " #!/bin/bash" > run_gmgpolar_sbatch.sh
2576# create a short name for your job
2677echo " #SBATCH --job-name=gmgpolar" >> run_gmgpolar_sbatch.sh
2778# stdout file %A=job id
28- echo " #SBATCH --output=slurm-%A-p$prob -fa $fac_ani - r$nr_exp -mpk$mod_pk -s$smoother -e$extrapolation .out" >> run_gmgpolar_sbatch.sh
79+ echo " #SBATCH --output=slurm-%A-p$prob -r$nr_exp -mpk$mod_pk -s$smoother -e$extrapolation --N $nodes -R $ranks -maxC $cores .out" >> run_gmgpolar_sbatch.sh
2980# stderr file
30- echo " #SBATCH --error=slurm-%A-p$prob -fa $fac_ani - r$nr_exp -mpk$mod_pk -s$smoother -e$extrapolation .err" >> run_gmgpolar_sbatch.sh
81+ echo " #SBATCH --error=slurm-%A-p$prob -r$nr_exp -mpk$mod_pk -s$smoother -e$extrapolation --N $nodes -R $ranks -maxC $cores .err" >> run_gmgpolar_sbatch.sh
3182
32- echo " #SBATCH -N 1" >> run_gmgpolar_sbatch.sh
33- echo " #SBATCH -n 1" >> run_gmgpolar_sbatch.sh
34- echo " #SBATCH -c 14" >> run_gmgpolar_sbatch.sh
35- echo " #SBATCH -t 6000" >> run_gmgpolar_sbatch.sh
83+ echo " #SBATCH -N $nodes " >> run_gmgpolar_sbatch.sh
84+ echo " #SBATCH -n $ranks " >> run_gmgpolar_sbatch.sh
85+ echo " #SBATCH -c $cores " >> run_gmgpolar_sbatch.sh
86+ # fix to one thread per core
87+ echo " #SBATCH --threads-per-core=1" >> run_gmgpolar_sbatch.sh
88+ # fix CPU frequency to 1.8 Mhz
89+ echo " #SBATCH --cpu-freq=1800000" >> run_gmgpolar_sbatch.sh
90+ echo " #SBATCH -t 600" >> run_gmgpolar_sbatch.sh
3691echo " #SBATCH --exclusive" >> run_gmgpolar_sbatch.sh
3792
3893# remove potentially loaded and conflicting modules
3994echo " module purge" >> run_gmgpolar_sbatch.sh
4095
41- # gcc10
42- echo " module load PrgEnv/gcc10-openmpi" >> run_gmgpolar_sbatch.sh
96+ # CARO
97+ # echo "module load rev/23.05" >> run_gmgpolar_sbatch.sh
98+ # spack install mumps@XXX+metis~mpi
99+ echo " module load likwid/5.2.2" >> run_gmgpolar_sbatch.sh
100+ # Local machine
101+ # echo "module load PrgEnv/gcc10-openmpi" >> run_gmgpolar_sbatch.sh
102+
103+ # echo "cd .." >> run_gmgpolar_sbatch.sh
104+ # echo "make -j16" >> run_gmgpolar_sbatch.sh
105+
106+ # to be defined for use case (3/4/5/6)
107+ # Attention: divideBy is used as a dummy variable to access folders as grids are read in
108+ echo " let divideBy2=4" >> run_gmgpolar_sbatch.sh
43109
44- echo " cd .." >> run_gmgpolar_sbatch.sh
45- echo " make -j16" >> run_gmgpolar_sbatch.sh
110+ # ###################################
111+ # # solve system ##
112+ # ###################################
46113
47- # FLOPS-DP counter
48- echo " for m in {0..1}; do" >> run_gmgpolar_sbatch.sh
49- echo " likwid-perfctr -C 0-$m -g FLOPS_DP ./build_gnu/main --matrix_free 1 -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother -E $extrapolation " >> run_gmgpolar_sbatch.sh
114+ # reduce cores as cores count from 0
115+ max_threads=$(( cores))
116+ echo " let m=1" >> run_gmgpolar_sbatch.sh
117+ # FLOPS-DP counter from 1 to cores many threads
118+ echo " while [ \$ m -le $max_threads ]; do" >> run_gmgpolar_sbatch.sh
119+ echo " let mminus1=m-1" >> run_gmgpolar_sbatch.sh
120+ echo " srun --cpus-per-task=\$ m likwid-perfctr -f -C 0-\$ mminus1 -g FLOPS_DP ./build/gmgpolar_simulation --openmp \$ m --matrix_free 1 -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 0 -r $R0 --smoother $smoother -E $extrapolation --verbose 2 --debug $debug --optimized 1 --v1 $v1 --v2 $v2 -R $R --prob $prob --maxiter $maxiter --alpha_coeff $alpha_coeff --beta_coeff $beta_coeff --res_norm $res_norm --f_grid_r " radii_files/Rmax" $R " /aniso" $fac_ani " /divide" \$ divideBy2" .txt" --f_grid_theta " angles_files/Rmax" $R " /aniso" $fac_ani " /divide" \$ divideBy2" .txt" --rel_red_conv $rel_red_conv " >> run_gmgpolar_sbatch.sh
121+ echo " let m=m*2" >> run_gmgpolar_sbatch.sh
50122echo " done;" >> run_gmgpolar_sbatch.sh
51123
52- # memory (saturation) benchmarks
53- echo " for m in {0..1}; do" >> run_gmgpolar_sbatch.sh
54- echo " likwid-perfctr -C 0-$m -g CACHES ./build_gnu/main -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 $divideBy2 -r $R0 --smoother $smoother -E $extrapol " >> run_gmgpolar_sbatch.sh
124+ # # Memory (saturation) benchmarks
125+ echo " let m=1" >> run_gmgpolar_sbatch.sh
126+ echo " while [ \$ m -le $max_threads ]; do" >> run_gmgpolar_sbatch.sh
127+ echo " let mminus1=m-1" >> run_gmgpolar_sbatch.sh
128+ echo " srun --cpus-per-task=\$ m likwid-perfctr -f -C 0-\$ mminus1 -g CACHE ./build/gmgpolar_simulation --openmp \$ m --matrix_free 1 -n $nr_exp -a $fac_ani --mod_pk $mod_pk --DirBC_Interior $DirBC_Interior --divideBy2 0 -r $R0 --smoother $smoother -E $extrapolation --verbose 2 --debug $debug --optimized 1 --v1 $v1 --v2 $v2 -R $R --prob $prob --maxiter $maxiter --alpha_coeff $alpha_coeff --beta_coeff $beta_coeff --res_norm $res_norm --f_grid_r " radii_files/Rmax" $R " /aniso" $fac_ani " /divide" \$ divideBy2" .txt" --f_grid_theta " angles_files/Rmax" $R " /aniso" $fac_ani " /divide" \$ divideBy2" .txt" --rel_red_conv $rel_red_conv " >> run_gmgpolar_sbatch.sh
129+ echo " let m=m*2" >> run_gmgpolar_sbatch.sh
55130echo " done;" >> run_gmgpolar_sbatch.sh
56131
57132# submit the job
58- sbatch run_gmgpolar_sbatch.sh
133+ sbatch run_gmgpolar_sbatch.sh
0 commit comments