forked from ROCm/rocGemmDriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·126 lines (114 loc) · 3.4 KB
/
install.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
VALIDATE=0
HELP=N
DEBUG=0
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-v|--validate)
if [ ! -z "$2" ]; then
VALIDATE="$2"
fi
shift # past argument
shift # past value
;;
-r|--rocblas)
ROCBLAS="$2"
shift # past argument
shift # past value
;;
-g|--debug)
DEBUG="$2"
shift # past argument
shift # past value
;;
-h|--help)
HELP="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [ "$HELP" != "N" ] ;
then
printf "$(basename "$0") [-h] [-v 1] -- program to build GemmDriver\n\n
where:\n
-h (--help) show this help text\n
-r (--rocblas) flag to use local copy of rocblas by specifying the base directory\n
-v (--validate) flag to enable blis validation option (default to 0)\n
-g (--debug) flag to build with debug symbols (default to 0)\n"
exit 1
fi
# script begins here
install_blis()
{
# /etc/*-release files describe the system
if [[ -e "/etc/os-release" ]]; then
source /etc/os-release
elif [[ -e "/etc/centos-release" ]]; then
ID=$(cat /etc/centos-release | awk '{print tolower($1)}')
VERSION_ID=$(cat /etc/centos-release | grep -oP '(?<=release )[^ ]*' | cut -d "." -f1)
else
echo "This script depends on the /etc/*-release files"
exit 2
fi
#Download prebuilt AMD multithreaded blis
if [[ ! -f "extern/blis/lib/libblis.so.2" && $VALIDATE != 0 ]]; then
mkdir -p extern
case "${ID}" in
centos|rhel|sles|opensuse-leap)
wget -nv -O extern/blis.tar.gz https://github.com/amd/blis/releases/download/2.0/aocl-blis-mt-centos-2.0.tar.gz
;;
ubuntu)
wget -nv -O extern/blis.tar.gz https://github.com/amd/blis/releases/download/2.0/aocl-blis-mt-ubuntu-2.0.tar.gz
;;
*)
echo "Unsupported OS for this script"
wget -nv -O extern/blis.tar.gz https://github.com/amd/blis/releases/download/2.0/aocl-blis-mt-ubuntu-2.0.tar.gz
;;
esac
cd extern
tar -xvf blis.tar.gz
rm -rf blis
mv amd-blis-mt blis
rm blis.tar.gz
cd blis/lib
ln -sf libblis-mt.so libblis.so
cd ../../..
fi
#Download prebuilt AMD flame
if [[ ! -f "extern/flame/lib/libflame.so.2" && $VALIDATE != 0 ]]; then
case "${ID}" in
centos|rhel|sles|opensuse-leap)
wget -nv -O extern/flame.tar.gz https://github.com/amd/libflame/releases/download/2.0/aocl-libflame-centos-2.0.tar.gz
;;
ubuntu)
wget -nv -O extern/flame.tar.gz https://github.com/amd/libflame/releases/download/2.0/aocl-libflame-ubuntu-2.0.tar.gz
;;
*)
echo "Unsupported OS for this script"
wget -nv -O extern/flame.tar.gz https://github.com/amd/libflame/releases/download/2.0/aocl-libflame-ubuntu-2.0.tar.gz
;;
esac
cd extern
tar -xvf flame.tar.gz
rm -rf flame
mv amd-libflame flame
rm flame.tar.gz
cd ../
fi
}
install_blis
if cat /opt/rocm/hip/lib/.hipInfo | grep clang ; then
CLANG=1
else
CLANG=0
fi
make VALIDATE=$VALIDATE ROCBLASPATH=$ROCBLAS DEBUG=$DEBUG CLANG=$CLANG