diff --git a/ci/docker/ubuntu/scripts/deps/build.sh b/ci/docker/ubuntu/scripts/deps/build.sh index ed3626860..e8938c9e8 100644 --- a/ci/docker/ubuntu/scripts/deps/build.sh +++ b/ci/docker/ubuntu/scripts/deps/build.sh @@ -1,19 +1,39 @@ CMAKE_VERSION="v3.23" -CMAKE_TAR="cmake-3.23.0-linux-x86_64.tar.gz" apt-get update && apt-get install -y --no-install-recommends wget curl g++ gcc ca-certificates \ -make ccache python3-dev gfortran python3-setuptools swig pip \ -libaio-dev libgoogle-perftools-dev clang-format libboost-all-dev liblapack-dev \ +gpg make ccache python3-dev gfortran python3-setuptools swig pip \ +libaio-dev libgoogle-perftools-dev clang-format libboost-program-options-dev \ +&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \ + 2>/dev/null | gpg --dearmor - | tee \ +/usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \ +&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee \ +/etc/apt/sources.list.d/kitware.list >/dev/null \ +&& apt update && apt install -y cmake \ && apt-get remove --purge -y \ && rm -rf /var/lib/apt/lists/* \ +&& wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz \ +&& tar zxvf v3.10.1.tar.gz && cd lapack-3.10.1/ \ +&& cmake -B build -S . -DCMAKE_SKIP_RPATH=ON -DBUILD_SHARED_LIBS=ON \ +-DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local \ +-DCMAKE_Fortran_COMPILER=gfortran -DLAPACKE_WITH_TMG=ON -DCBLAS=OFF \ +-DBUILD_DEPRECATED=OFF \ +&& cmake --build build \ +&& cmake --install build \ +&& rm -r /usr/local/lib/libblas.* \ +&& rm -r /usr/local/lib/liblapacke.* \ +&& rm -r /usr/local/lib/pkgconfig/blas.* \ +&& rm -r /usr/local/lib/pkgconfig/lapacke.* \ +&& rm -r /usr/local/lib/cmake/lapacke* \ +&& rm -r /usr/local/include/* \ +&& cd .. && rm -rf lapack-3.10.1 && rm v3.10.1.tar.gz \ && wget https://github.com/xianyi/OpenBLAS/archive/v0.3.21.tar.gz && \ tar zxvf v0.3.21.tar.gz && cd OpenBLAS-0.3.21 && \ -make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_CBLAS=1 NO_AFFINITY=1 USE_OPENMP=1 \ +make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_AFFINITY=1 USE_OPENMP=1 \ TARGET=HASWELL DYNAMIC_ARCH=1 \ NUM_THREADS=64 MAJOR_VERSION=3 libs shared && \ make PREFIX=/usr/local NUM_THREADS=64 MAJOR_VERSION=3 install && \ -rm -f /usr/local/include/cblas.h /usr/local/include/lapack* &&\ +rm -f /usr/local/include/lapack* && \ +ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so && \ +ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so.3 && \ +ln -s /usr/local/lib/pkgconfig/openblas.pc /usr/local/lib/pkgconfig/blas.pc && \ cd .. && rm -rf OpenBLAS-0.3.21 && rm v0.3.21.tar.gz \ -&& cd /tmp && wget --tries=3 --retry-connrefused "https://cmake.org/files/${CMAKE_VERSION}/${CMAKE_TAR}" \ -&& tar --strip-components=1 -xz -C /usr/local -f ${CMAKE_TAR} \ -&& rm -f ${CMAKE_TAR} \ && pip install twine diff --git a/ci/docker/ubuntu/scripts/deps/e2e.sh b/ci/docker/ubuntu/scripts/deps/e2e.sh index 32fc82dd9..d44a4bf2c 100644 --- a/ci/docker/ubuntu/scripts/deps/e2e.sh +++ b/ci/docker/ubuntu/scripts/deps/e2e.sh @@ -1,13 +1,38 @@ apt-get update && apt-get install -y --no-install-recommends wget curl g++ gcc make ca-certificates \ - python3-dev gfortran python3-setuptools swig liblapack-dev pip git vim \ - libaio-dev libboost-all-dev \ +python3-dev gfortran python3-setuptools swig pip git vim \ +libaio-dev libboost-program-options-dev gpg \ +&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \ + 2>/dev/null | gpg --dearmor - | tee \ +/usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \ +&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee \ +/etc/apt/sources.list.d/kitware.list >/dev/null \ +&& apt update && apt install -y cmake \ && apt-get remove --purge -y \ && rm -rf /var/lib/apt/lists/* \ +&& wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz \ +&& tar zxvf v3.10.1.tar.gz && cd lapack-3.10.1/ \ +&& cmake -B build -S . -DCMAKE_SKIP_RPATH=ON -DBUILD_SHARED_LIBS=ON \ +-DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local \ +-DCMAKE_Fortran_COMPILER=gfortran -DLAPACKE_WITH_TMG=ON -DCBLAS=OFF \ +-DBUILD_DEPRECATED=OFF \ +&& cmake --build build \ +&& cmake --install build \ +&& rm -r /usr/local/lib/libblas.* \ +&& rm -r /usr/local/lib/liblapacke.* \ +&& rm -r /usr/local/lib/pkgconfig/blas.* \ +&& rm -r /usr/local/lib/pkgconfig/lapacke.* \ +&& rm -r /usr/local/lib/cmake/lapacke* \ +&& rm -r /usr/local/include/* \ +&& cd .. && rm -rf lapack-3.10.1 && rm v3.10.1.tar.gz \ && wget https://github.com/xianyi/OpenBLAS/archive/v0.3.21.tar.gz && \ -tar zxvf v0.3.21.tar.gz && cd OpenBLAS-0.3.21 && \ -make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_CBLAS=1 NO_AFFINITY=1 USE_OPENMP=1 \ - TARGET=HASWELL DYNAMIC_ARCH=1 \ - NUM_THREADS=64 MAJOR_VERSION=3 libs shared && \ + tar zxvf v0.3.21.tar.gz && cd OpenBLAS-0.3.21 && \ +make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_AFFINITY=1 USE_OPENMP=1 \ + TARGET=HASWELL DYNAMIC_ARCH=1 \ + NUM_THREADS=64 MAJOR_VERSION=3 libs shared && \ make PREFIX=/usr/local NUM_THREADS=64 MAJOR_VERSION=3 install && \ -rm -f /usr/local/include/cblas.h /usr/local/include/lapack* && \ +rm -f /usr/local/include/cblas.h /usr/local/include/lapack* &&\ +rm -f /usr/local/include/lapack* && \ +ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so && \ +ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so.3 && \ +ln -s /usr/local/lib/pkgconfig/openblas.pc /usr/local/lib/pkgconfig/blas.pc && \ cd .. && rm -rf OpenBLAS-0.3.21 && rm v0.3.21.tar.gz diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index a33960d15..985ec0883 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -34,22 +34,48 @@ if [[ "${MACHINE}" == "Linux" ]]; then if [[ -x "$(command -v apt)" ]]; then # for Ubuntu 18.04 release_num=$(lsb_release -r --short) - sudo apt install -y g++ gcc make ccache python3-dev gfortran liblapack-dev + ubuntu_alias="bionic" + sudo apt install -y g++ gcc make ccache python3-dev gfortran gpg wget if [ "$release_num" == "20.04" ];then sudo apt install -y python3-setuptools swig - fi + ubuntu_alias="focal" + fi + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc \ + 2>/dev/null | gpg --dearmor - | sudo tee \ + /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \ + && echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ '$ubuntu_alias' main' | sudo tee \ + /etc/apt/sources.list.d/kitware.list >/dev/null \ + && apt update && apt install -y cmake \ + && wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz \ + && tar zxvf v3.10.1.tar.gz && cd lapack-3.10.1/ \ + && cmake -B build -S . -DCMAKE_SKIP_RPATH=ON -DBUILD_SHARED_LIBS=ON \ + -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_Fortran_COMPILER=gfortran -DLAPACKE_WITH_TMG=ON -DCBLAS=OFF \ + -DBUILD_DEPRECATED=OFF \ + && cmake --build build \ + && sudo cmake --install build \ + && sudo rm -r /usr/local/lib/libblas.* \ + && sudo rm -r /usr/local/lib/liblapacke.* \ + && sudo rm -r /usr/local/lib/pkgconfig/blas.* \ + && sudo rm -r /usr/local/lib/pkgconfig/lapacke.* \ + && sudo rm -r /usr/local/lib/cmake/lapacke* \ + && sudo rm -r /usr/local/include/* \ + && cd .. && rm -rf lapack-3.10.1 && rm v3.10.1.tar.gz \ # Pre-installation of openblas can save about 15 minutes of openblas building time. # But the apt-installed openblas version is 0.2.20, while the latest openblas version is 0.3.19. # So we only pre-install openblas in Unittest, and compile openblas-0.3.19 when release. if [[ "${INSTALL_OPENBLAS}" == "true" ]]; then - sudo wget https://github.com/xianyi/OpenBLAS/archive/v0.3.21.tar.gz && \ - tar zxvf v0.3.21.tar.gz && cd OpenBLAS-0.3.21 && \ - make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_CBLAS=1 NO_AFFINITY=1 USE_OPENMP=1 \ - TARGET=HASWELL DYNAMIC_ARCH=1 \ - NUM_THREADS=64 MAJOR_VERSION=3 libs shared && \ - sudo make PREFIX=/usr/local NUM_THREADS=64 MAJOR_VERSION=3 install && \ - sudo rm -f /usr/local/include/cblas.h /usr/local/include/lapack* &&\ - cd .. && rm -rf OpenBLAS-0.3.21 && rm v0.3.21.tar.gz + wget https://github.com/xianyi/OpenBLAS/archive/v0.3.21.tar.gz && \ + tar zxvf v0.3.21.tar.gz && cd OpenBLAS-0.3.21 && \ + make NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_AFFINITY=1 USE_OPENMP=1 \ + TARGET=HASWELL DYNAMIC_ARCH=1 \ + NUM_THREADS=64 MAJOR_VERSION=3 libs shared && \ + sudo make PREFIX=/usr/local NUM_THREADS=64 MAJOR_VERSION=3 install && \ + sudo rm -f /usr/local/include/lapack* && \ + sudo ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so && \ + sudo ln -s /usr/local/lib/libopenblasp-r0.3.21.so /lib/libblas.so.3 && \ + sudo ln -s /usr/local/lib/pkgconfig/openblas.pc /usr/local/lib/pkgconfig/blas.pc && \ + cd .. && rm -rf OpenBLAS-0.3.21 && rm v0.3.21.tar.gz fi #DiskANN dependencies sudo apt-get install -y libboost-program-options-dev