-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildUberJar.sh
executable file
·64 lines (52 loc) · 1.81 KB
/
buildUberJar.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
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -e
set -u
set -o pipefail
detectOSPlatform() {
OSNAME=$(uname)
if [[ "${OSNAME}" = "Darwin" ]]; then
OSNAME=macosx
elif [[ "${OSNAME}" = "Linux" ]]; then
OSNAME=linux
fi
echo ${OSNAME}
}
downloadResources() {
./download-src-main-resources.sh
}
runMvnPackage() {
BACKEND=${1:-"cpu-backend"}
time mvn package -P"${BACKEND}" \
-Djavacpp.platform="${OSNAME}-x86_64" \
-Dplatform="${OSNAME}"
}
runBuildCpuBackendPackage() {
echo ""; echo "Building uber jar for target platform: ${OSNAME} with CPU backend (default)"
runMvnPackage "cpu-backend"
}
runBuildGpuBackendPackage() {
if [[ "${OSNAME}" = "macosx" ]]; then
echo ""; echo "Skipping building of uber jar for target platform: ${OSNAME} with GPU backend..."
echo "Skymind has dropped support for CUDA for the MacOSX, " \
"see https://gitter.im/deeplearning4j/deeplearning4j?at=5d92a15c9d4cf173604945c6."
else
echo ""; echo "Building uber jar for target platform: ${OSNAME} with GPU backend"
runMvnPackage "gpu-backend"
fi
}
postBuildProcessOnValohaiPlatform() {
### Check if we are running in the Valohai environment, an empty VH_INPUTS_DIR means we are running outside that environment
if [[ ! -z "${VH_OUTPUTS_DIR:-}" ]]; then
### In Valohai environment
echo "~~~ Copying the build-time-know-your-gpus.logs file into ${VH_OUTPUTS_DIR}"
./know-your-gpus.sh &> "${VH_OUTPUTS_DIR}/build-time-know-your-gpus.logs"
echo "~~~ Copying the build jar file into ${VH_OUTPUTS_DIR}"
cp target/*bin*.jar ${VH_OUTPUTS_DIR}
ls -lash ${VH_OUTPUTS_DIR}
fi
}
OSNAME=${1:-$(detectOSPlatform)}
downloadResources
runBuildCpuBackendPackage
runBuildGpuBackendPackage
postBuildProcessOnValohaiPlatform