-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
106 lines (82 loc) · 2.94 KB
/
setup.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
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
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
setup_log="${DIR}/setup_log.txt"
cmake_args=(
..
)
check_success () {
if [ $? -ne 0 ]; then
echo " -- unsuccessful, check ${setup_log}"
exit 1
fi
}
print () {
to_echo="~ ~ ~ > $1 ..."
echo $to_echo >> ${setup_log}
echo $to_echo
}
# is windows
[[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] ; is_windows=$?
is_windows=$((1-$is_windows))
# is mac
[[ "$OSTYPE" == "darwin"* ]] ; is_mac=$?
is_mac=$((1-$is_mac))
build_dirs=(
"${DIR}/packages/boxhed/boxhed.egg-info/"
"${DIR}/packages/boxhed/build/"
#"${DIR}/packages/boxhed_kernel/boxhed_kernel/build/"
"${DIR}/packages/boxhed_kernel/boxhed_kernel/lib/"
"${DIR}/packages/boxhed_kernel/boxhed_kernel/python-package/build/"
"${DIR}/packages/boxhed_kernel/boxhed_kernel/python-package/xgboost.egg-info/"
"${DIR}/packages/boxhed_prep/build/"
"${DIR}/packages/boxhed_prep/boxhed_prep.egg-info/")
for dir in ${build_dirs[@]};
do
rm -rf $dir
done
rm -f setup_log
echo "This installation relies heavily on https://xgboost.readthedocs.io/en/latest/build.html"
print "creating build directory for boxhed2.0 in ${DIR}/packages/boxhed_kernel/"
cd "${DIR}/packages/boxhed_kernel/boxhed_kernel/"
mkdir -p build &> ${setup_log}
check_success
if [[ $is_mac == 1 ]]; then
print "installing libomp for MacOS"
brew install libomp >> ${setup_log} 2>&1
check_success
fi
print "running cmake for boxhed in ${DIR}/packages/boxhed_kernel/boxhed_kernel/build/"
cd "${DIR}/packages/boxhed_kernel/boxhed_kernel/build/"
cmake_args+=(-DUSE_CUDA=ON)
# CMake arguments may be passed like the following. It has the general
# form of "-D _ARGUMENT_=VALUE". A common problem that may arise is
# CMake not being able to find CUDA compiler. In case this happens you
# may uncomment following line and replace the address place holder
# with your true CUDA compiler address. (The compiler address should look
# like this example: /home/grads/j/j.doe/cuda-11.1/bin/nvcc)
#cmake_args+=(-D CMAKE_CUDA_COMPILER=__ADDRESS_TO_CUDA_COMPILER__)
cmake ${cmake_args[@]} >> ${setup_log} 2>&1
check_success
print "running make for boxhed in ${DIR}/packages/boxhed_kernel/boxhed_kernel/build/"
cd "${DIR}/packages/boxhed_kernel/boxhed_kernel/build/"
build_args=(
--build .
)
if [[ $is_windows == 1 ]]; then
build_args+=(--config Release)
fi
cmake ${build_args[@]} >> ${setup_log} 2>&1
check_success
print "setting up boxhed for python in ${DIR}/packages/boxhed_kernel/boxhed_kernel/python-package/"
cd "${DIR}/packages/boxhed_kernel/boxhed_kernel/python-package/"
python setup.py install >> ${setup_log} 2>&1
check_success
print "boxhed installed successfully"
####### setting up preprocessing #######
print "installing preprocessor"
cd "${DIR}/packages/"
pip install ./boxhed_prep
####### setting up boxhed #######
print "installing BoXHED"
cd "${DIR}/packages/"
pip install ./boxhed