-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathbuild_hipBLAS.sh
More file actions
executable file
·138 lines (128 loc) · 3.86 KB
/
Copy pathbuild_hipBLAS.sh
File metadata and controls
executable file
·138 lines (128 loc) · 3.86 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
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
#!/bin/bash
#
#Copyright © Advanced Micro Devices, Inc., or its affiliates.
#
#SPDX-License-Identifier: MIT
#
# build_hipblas.sh: Script to build and install hipblas library
#
#
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
realpath=`realpath $0`
thisdir=`dirname $realpath`
. $thisdir/../aomp_common_vars
# --- end standard header ----
_repo_dir=$AOMP_REPOS/rocmlibs/hipBLAS
patchrepo $_repo_dir
export CC=$LLVM_INSTALL_LOC/bin/clang
export CXX=$LLVM_INSTALL_LOC/bin/clang++
export FC=$LLVM_INSTALL_LOC/bin/flang
export ROCM_DIR=$AOMP_INSTALL_DIR
export ROCM_PATH=$AOMP_INSTALL_DIR
export PATH=$AOMP_SUPP/cmake/bin:$AOMP_INSTALL_DIR/bin:$PATH
export HIP_USE_PERL_SCRIPTS=1
export USE_PERL_SCRIPTS=1
export NUM_PROC=$AOMP_JOB_THREADS
export CXXFLAGS="-I$AOMP_INSTALL_DIR/include -D__HIP_PLATFORM_AMD__=1"
export LDFLAGS="-fPIC"
if [ "$AOMP_USE_CCACHE" != 0 ] ; then
_ccache_bin=`which ccache`
# export CMAKE_CXX_COMPILER_LAUNCHER=$_ccache_bin
fi
if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
if [ ! -L $AOMP ] ; then
if [ -d $AOMP ] ; then
echo "ERROR: Directory $AOMP is a physical directory."
echo " It must be a symbolic link or not exist"
exit 1
fi
fi
else
echo "ERROR: $0 only valid for AOMP_STANDALONE_BUILD=1"
exit 1
fi
if [ "$1" == "nocmake" ] ; then
echo "ERROR: nocmake is not an option for $0"
exit 1
fi
# Make sure we can update the install directory
if [ "$1" == "install" ] ; then
$SUDO mkdir -p $AOMP_INSTALL_DIR
$SUDO touch $AOMP_INSTALL_DIR/testfile
if [ $? != 0 ] ; then
echo "ERROR: No update access to $AOMP_INSTALL_DIR"
exit 1
fi
$SUDO rm $AOMP_INSTALL_DIR/testfile
fi
if [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/rocmlibs/hipBLAS"
echo "Use ""$0 install"" to avoid FRESH START."
echo rm -rf $BUILD_DIR/build/rocmlibs/hipBLAS
rm -rf $BUILD_DIR/build/rocmlibs/hipBLAS
mkdir -p $BUILD_DIR/build/rocmlibs/hipBLAS
else
if [ ! -d $BUILD_DIR/build/rocmlibs/hipBLAS ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/rocmlibs/hipBLAS does not exist"
echo " run $0 without install option. "
exit 1
fi
fi
if [ "$1" != "install" ] ; then
# Remember start directory to return on exit
_curdir=$PWD
echo " -----Running cmake ---"
echo cd $AOMP_REPOS/build/rocmlibs/hipBLAS
cd $AOMP_REPOS/build/rocmlibs/hipBLAS
pwd
MYCMAKEOPTS="
-DCMAKE_CXX_COMPILER=$CXX
-DCMAKE_C_COMPILER=$CC
-DROCM_DIR:PATH=$AOMP_INSTALL_DIR
-DCPACK_PACKAGING_INSTALL_PREFIX=$AOMP_INSTALL_DIR
-DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR
-DROCM_PATH=$AOMP_INSTALL_DIR
-DCMAKE_PREFIX_PATH:PATH=$AOMP_INSTALL_DIR
-DCPACK_SET_DESTDIR=OFF
-DCMAKE_BUILD_TYPE=Release
-Drocblas_DIR=$AOMP_INSTALL_DIR/rocblas
-DAMDGPU_TARGETS="""$ROCMLIBS_GFXLIST"""
-DCUSTOM_TARGET=host
-DBUILD_WITH_SOLVER=ON
-DROCBLAS_PATH=$AOMP_INSTALL_DIR/rocblas
-DROCSOLVER_PATH=$AOMP_INSTALL_DIR/rocsolver
"
echo $AOMP_CMAKE $MYCMAKEOPTS $_repo_dir
$AOMP_CMAKE $MYCMAKEOPTS $_repo_dir
if [ $? != 0 ] ; then
echo "ERROR cmake failed."
echo " $MYCMAKEOPTS"
cd $_curdir
exit 1
fi
make -j$AOMP_JOB_THREADS
if [ $? != 0 ] ; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
fi
if [ "$1" == "install" ] ; then
echo " -----Installing to $AOMP_INSTALL_DIR ---- "
cd $BUILD_DIR/build/rocmlibs/hipBLAS
make -j$AOMP_JOB_THREADS install
if [ $? != 0 ] ; then
echo "ERROR install to $AOMP_INSTALL_DIR failed "
exit 1
fi
echo
echo "SUCCESSFUL INSTALL to $AOMP_INSTALL_DIR"
echo
removepatch $_repo_dir
else
echo
echo "SUCCESSFUL BUILD, please run: $0 install"
echo " to install into $AOMP_INSTALL_DIR"
echo
fi