forked from tbvanderwoude/semsans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
full-simulation-optimized.sh
executable file
·55 lines (47 loc) · 2.52 KB
/
full-simulation-optimized.sh
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
#!/bin/bash
# Example usage:
# ./full-simulation.sh 100000 4 5 0,0.020908 2.165 0.02 10000 0.001 0.095993 4.0 2.0 1.8 iso iso_empty GPU
# Check if the number of arguments provided is correct
if [ "$#" -ne 15 ]; then
echo "Usage: $0 <N> <N_threads> <N_steps> <B_min,B_max> <L0> <DL> <R> <t> <theta0_foil> <L_1> <L_2> <L_s> <instr_with_sample> <instr_no_sample> <mode>\nmode can be CPU or GPU"
exit 1
fi
# Assign command-line arguments to variables
N=$1
N_threads=$2
N_steps=$3
By_range=$4
L0=$5
DL=$6
R=$7
t=$8
theta0_foil=$9
L_1=${10}
L_2=${11}
L_s=${12}
instr_with_sample=${13}
instr_no_sample=${14}
mode=${15}
# Generate timestamp
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
# Rename the directory with timestamp
dir_name="data"
mv "$dir_name" "${dir_name}_${timestamp}"
# Zip the renamed directory
zip -r "${dir_name}_${timestamp}.zip" "${dir_name}_${timestamp}"
# Remove the original directory
rm -rf "${dir_name}_${timestamp}"
mkdir data
cd instr
if [ $mode == 'CPU' ]; then
mcrun $instr_with_sample --mpi=$N_threads -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=1 --dir "../${dir_name}/up"
mcrun $instr_with_sample --mpi=$N_threads -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=-1 --dir "../${dir_name}/down"
mcrun $instr_no_sample --mpi=$N_threads -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=1 --dir "../${dir_name}/empty_up"
mcrun $instr_no_sample --mpi=$N_threads -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=-1 --dir "../${dir_name}/empty_down"
else
echo "Running with OpenACC GPU acceleration, this will require the CUDA toolkit to be installed"
mcrun $instr_with_sample --openacc -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=1 --dir "../${dir_name}/up"
mcrun $instr_with_sample --openacc -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=-1 --dir "../${dir_name}/down"
mcrun $instr_no_sample --openacc -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=1 --dir "../${dir_name}/empty_up"
mcrun $instr_no_sample --openacc -n $N -N $N_steps L0=$L0 DL=$DL R=$R t=$t theta0=$theta0_foil L_1=$L_1 L_2=$L_2 L_s=$L_s By=$By_range AnaSign=-1 --dir "../${dir_name}/empty_down"
fi