-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·89 lines (76 loc) · 2.25 KB
/
run.sh
File metadata and controls
executable file
·89 lines (76 loc) · 2.25 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
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
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
: '
FLAMEGPU 2 Agent-Based Model
run.sh
Run the ABM.
Inputs:
-expdir or --experiment_dir: directory with the scenario to simulate
-prun or --parallel_run: number of run to execute in parallel on GPUs
-e or --ensemble: run with ensemble
-v or --visualisation: activate the visualisation
Authors: Daniele Baccega, Irene Terrone, Simone Pernice
'
# Default values for input parameters
EXPERIMENT_DIR="None"
PARALLEL_RUN="10"
ENSEMBLE="OFF"
VISUALISATION="OFF"
while [[ $# -gt 0 ]]; do
case $1 in
-expdir|--experiment_dir)
EXPERIMENT_DIR="$2"
shift
shift
;;
-prun|--parallel_run)
PARALLEL_RUN="$2"
shift
shift
;;
-e|--ensemble)
ENSEMBLE="$2"
shift
shift
;;
-v|--visualisation)
VISUALISATION="$2"
shift
shift
;;
-h|--help)
printf "./run.sh - run the ABM\n\n"
printf "Arguments:\n"
printf " -expdir or --experiment_dir: directory with the scenario to simulate"
printf " -prun or --parallel_run: number of run to execute in parallel on GPUs (default: 10)\n"
printf " -e or --ensemble: run with ensemble (default: OFF; possible values: ON, OFF)\n"
printf " -v or --visualisation: activate the visualisation (default: OFF; possible values: ON, OFF)\n"
exit 1
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # Save positional arg
shift # Past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # Restore positional parameters
DIR="resources/f4f/$EXPERIMENT_DIR"
# Check if the directory exists
if [ ! -d "$DIR" ]; then
echo "❌ Error: Directory $DIR does not exist."
exit 1
fi
if [ $VISUALISATION != "ON" ];
then
VISUALISATION_ARG="-c"
fi
if [ $ENSEMBLE == "ON" ];
then
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./build/bin/Release/FLAMEGPUABM -c $PARALLEL_RUN $EXPERIMENT_DIR
else
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./build/bin/Release/FLAMEGPUABM -i resources/configuration_file.xml $EXPERIMENT_DIR
fi
bash postprocessing.sh -expdir $EXPERIMENT_DIR