-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch
executable file
·164 lines (104 loc) · 2.92 KB
/
launch
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
_error() {
local readonly msg="$1"
echo "."
echo "."
echo "launchkit >> [Error] << ${msg}"
echo "."
echo "."
return 1
}
_error_fatal() {
local readonly msg="$1"
echo "."
echo "."
echo "launchkit >> [Fatal Error] << ${msg}"
echo "."
echo "."
exit 1
}
_platform_mattlaptop_match() {
[[ $(uname -n) =~ MBP115573 ]] || return 1
}
_platform_mattlaptop_setup() {
export CC=/usr/local/bin/gcc-13
export CXX=/usr/local/bin/g++-13
export FC=/usr/local/bin/gfortran-13
}
_platform_perlmutter_match() {
[[ $LMOD_SYSTEM_NAME =~ perlmutter ]] || return 1
}
_platform_perlmutter_setup() {
module load cmake
module load nvidia
}
_scenario_gpu_trial1_mattlaptop_build() {
BUILD_TYPE=Debug
echo cmake configured to generate a $BUILD_TYPE build.
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm ./src/*.mod
rm -rf ./build
mkdir ./build && cd $_
cmake \
-DCMAKE_Fortran_FLAGS="-O3 -fopenmp -fallow-argument-mismatch -malign-double" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -ffpe-trap=invalid,zero,overflow -fbacktrace" \
..
[[ $? -eq 0 ]] && make VERBOSE=1
LAUNCHKIT_RUNTIME_PATH_EXE="$(pwd -P)/build/bin/xfpgpu"
cd - >/dev/null
}
_scenario_gpu_trial1_mattlaptop_run() {
echo
}
_scenario_gpu_trial1_perlmutter_build() {
BUILD_TYPE=Debug
HARDWARE_TYPE=GPU
echo cmake configured to generate a $BUILD_TYPE build.
rm -f CMakeCache.txt
rm -rf CMakeFiles
rm ./src/*.mod
rm -rf ./build
mkdir ./build && cd $_
if [ "$HARDWARE_TYPE" == CPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DCMAKE_Fortran_FLAGS="-Mfree -Mpreprocess -r8 -fPIC -O3 -mp -cuda -cudalib=curand" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
..
elif [ "$HARDWARE_TYPE" == GPU ]
then
cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_ACC=ON \
-DCMAKE_Fortran_FLAGS="-fast -acc=gpu -gpu=cc80 -cudalib=curand -Mfree -fPIC -O3 -Mpreprocess" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
..
else
echo " choose a valid hardware type "
fi
[[ $? -eq 0 ]] && make VERBOSE=1
LAUNCHKIT_RUNTIME_PATH_EXE="$(pwd -P)/build/bin/xfpgpu"
cd - >/dev/null
}
__platform_match() {
local match_count=0
[[ -n $LAUNCHKIT_PLATFORM ]] && return
_platform_perlmutter_match && let "match_count+=1" && LAUNCHKIT_PLATFORM="perlmutter"
_platform_mattlaptop_match && let "match_count+=1" && LAUNCHKIT_PLATFORM="mattlaptop"
[[ ${match_count} -eq 1 ]] || _error_fatal "unable to select platform"
}
__platform_setup() {
local readonly platform="$LAUNCHKIT_PLATFORM"
_platform_${platform}_setup
}
__build() {
local readonly platform="$LAUNCHKIT_PLATFORM"
_scenario_gpu_trial1_${platform}_build &> compiler_report.txt
}
LAUNCHKIT_RUNTIME_PATH_EXE=""
LAUNCHKIT_PLATFORM=""
__platform_match
__platform_setup
__build