- 自动编译Abseil的btree benchmark 和 mutex benchmark,和编译hashtable源码
- 使用clang/llvm 编译器: CC=clang-9 BAZEL_COMPILER=llvm
- 添加如下编译参数:bazel build --cxxopt=-std=c++17 -c opt --cxxopt='-O3' --cxxopt='-fPIE' --cxxopt='-mpie-copy-relocations' --cxxopt='-fno-omit-frame-pointer' --cxxopt='-fno-strict-aliasing'
#!/bin/bash
sudo apt-get install clang-9
sudo apt-get install libboost-all-dev
sudo apt-get install pkg-config zip g++ zlib1g-dev unzip python
sudo apt-get install libboost-all-dev
HOME_DIR=/home/yjiang2
TESTCASE_SRC_HOME=${HOME_DIR}/src
ABSL_HOME=${TESTCASE_SRC_HOME}/abseil-cpp
BAZEL_HOME=${TESTCASE_SRC_HOME}/bazel-3.0.0-dist
#
#1st thing is first, install bazel
#
ARCH=`uname -p`
BAZEL_BIN=${HOME_DIR}/bin/bazel
if [ ! -f ${BAZEL_BIN} ]; then
if [[ "$ARCH" == "aarch64" ]];then
#TX2
wget -P ${TESTCASE_SRC_HOME} -c http://distfiles.macports.org/bazel/bazel-3.0.0-dist.zip
unzip ${TESTCASE_SRC_HOME}/bazel-3.0.0-dist.zip -d ${BAZEL_HOME}
cd ${BAZEL_HOME} && bash ./compile.sh
source ${HOME_DIR}/.profile
elif [[ "$ARCH" == "x86_64" ]]; then
#Skylake 6148 or Rome
wget -c https://github.com/bazelbuild/bazel/releases/download/3.0.0/bazel-3.0.0-installer-linux-x86_64.sh
chmod +x bazel-3.0.0-installer-linux-x86_64.sh
./bazel-3.0.0-installer-linux-x86_64.sh --user
fi
fi
ABSL_SCRIPT=${HOME_DIR}/bin/absl-run-multiple-config-of-socket-final-envset.sh
if [ ! -f ${ABSL_SCRIPT} ]; then
echo "##############Downloading bin.tar.gz ...##############"
sudo apt-get install sshpass
if [[ "$ARCH" == "aarch64" ]];then
#Download running script bin/
sshpass -p "yjiang2" scp yjiang2@saber-06:${HOME_DIR}/bin-TX2-0525.tar.gz ${HOME_DIR}/
tar xzf ${HOME_DIR}/bin-TX2-0525.tar.gz -C ${HOME_DIR}/
elif [[ "$ARCH" == "x86_64" ]]; then
#Download running script bin/
sshpass -p yjiang2 scp yjiang2@sm6148-2s-02:${HOME_DIR}/bin-Skylake-0525.tar.gz ${HOME_DIR}/
tar xzf ${HOME_DIR}/bin-Skylake-0525.tar.gz -C ${HOME_DIR}/
fi
if [ -f ${ABSL_SCRIPT} ]; then
echo "Completed for ${ARCH}"
else
echo "Not completed for ${ARCH} !!!"
fi
fi
#
#Download source code of Abseil and compile it
#
if [ ! -d ${ABSL_HOME} ]; then
git clone https://github.com/abseil/abseil-cpp ${ABSL_HOME}
else
echo "Abseil has been installed on this platform !!!"
fi
HASHTABLE_BENCHMARK_HOME=${TESTCASE_SRC_HOME}/hashtable-benchmarks
if [ ! -d ${HASHTABLE_BENCHMARK_HOME} ]; then
git clone https://github.com/google/hashtable-benchmarks ${HASHTABLE_BENCHMARK_HOME}
else
echo "hashtable-benchmarks has been installed on this platform !!!"
fi
ABSL_MUTEX_BENCHMARK=${ABSL_HOME}/bazel-bin/absl/synchronization/mutex_benchmark
if [ ! -f ${ABSL_HOME} ]; then
#build
cd ${ABSL_HOME} && sudo CC=clang-9 BAZEL_COMPILER=llvm bazel build --cxxopt=-std=c++17 -c opt --cxxopt='-O3' --cxxopt='-fPIE' --cxxopt='-mpie-copy-relocations' --cxxopt='-fno-omit-frame-pointer' --cxxopt='-fno-strict-aliasing' //absl/synchronization:mutex_benchmark
fi
ABSL_BTREE_BENCHMARK=${ABSL_HOME}/bazel-bin/absl/container/btree_benchmark
if [ ! -f ${ABSL_BTREE_BENCHMARK} ]; then
#build btree-benchmark
cd ${ABSL_HOME} && sudo CC=clang-9 BAZEL_COMPILER=llvm bazel build --cxxopt='-std=c++17' -c opt --cxxopt='-O3' --cxxopt='-fPIE' --cxxopt='-mpie-copy-relocations' --cxxopt='-fno-omit-frame-pointer' --cxxopt='-fno-strict-aliasing' //absl/container:btree_benchmark
fi
HASHTABLE_BENCHMARK=${HASHTABLE_BENCHMARK_HOME}/bazel-bin/hashtable_benchmarks
if [ ! -f ${HASHTABLE_BENCHMARK} ]; then
#build hashtable-benchmarks
cd ${HASHTABLE_BENCHMARK_HOME} && sudo CC=clang-9 BAZEL_COMPILER=llvm bazel build --cxxopt='-std=c++17' -c opt --cxxopt='-O3' --cxxopt='-fPIE' --cxxopt='-mpie-copy-relocations' --cxxopt='-fno-omit-frame-pointer' --cxxopt='-fno-strict-aliasing' :hashtable_benchmarks
fi