Skip to content

Commit

Permalink
Merge branch 'master' into new_linclust
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunShow authored Jan 22, 2025
2 parents 6515aba + b804fbe commit 5b3ea81
Show file tree
Hide file tree
Showing 252 changed files with 50,746 additions and 11,044 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ task:
CXX: g++-4.9
compile_script: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=1 -DHAVE_SSE4_1=1 -DREQUIRE_OPENMP=0 ..
cmake -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=0 -DHAVE_SSE4_1=1 -DREQUIRE_OPENMP=0 ..
make -j $(nproc --all)
test_script: MMSEQS_NUM_THREADS=4 ./util/regression/run_regression.sh ./build/src/mmseqs SCRATCH SEARCH

77 changes: 77 additions & 0 deletions .github/workflows/Dockerfile.GPU-manylinux2014
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM quay.io/pypa/manylinux2014_x86_64
ARG VER="12-6"
ARG ARCH="x86_64"

# CUDA
RUN yum install -y yum-utils
RUN yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
# libcublas-devel-${VER}.${ARCH}
RUN yum -y install cuda-nvcc-${VER}.${ARCH} cuda-cudart-devel-${VER}.${ARCH}
RUN echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/999_nvidia_cuda.conf
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
ENV CUDA_HOME=/usr/local/cuda
ENV CUDA_ROOT=/usr/local/cuda
ENV CUDA_PATH=/usr/local/cuda
ENV CUDADIR=/usr/local/cuda

# Build system
RUN yum install -y git wget vim zlib-devel bzip2-devel ninja-build centos-release-scl
RUN mv /etc/yum.repos.d/CentOS-SCLo-scl.repo /etc/yum.repos.d/CentOS-SCLo-scl.repo.disabled
RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-libatomic-devel
ENV CC=/opt/rh/devtoolset-11/root/bin/gcc
ENV CXX=/opt/rh/devtoolset-11/root/bin/g++
ENV CUDAHOSTCXX=/opt/rh/devtoolset-11/root/bin/g++
ENV CUDACXX=/usr/local/cuda/bin/nvcc
ENV LIBGCC=/opt/rh/devtoolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11

# cmake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.0/cmake-3.31.0-linux-x86_64.sh; \
chmod +x cmake-3.31.0-linux-x86_64.sh; \
./cmake-3.31.0-linux-x86_64.sh --skip-license --prefix=/usr/local;

RUN mkdir /deps; \
cd /deps; \
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz; \
tar xzvf bzip2-1.0.8.tar.gz; \
cd bzip2-1.0.8; \
make install PREFIX=/deps;

RUN cd /deps; \
wget https://www.zlib.net/zlib-1.3.1.tar.gz; \
tar xzvf zlib-1.3.1.tar.gz; \
cd zlib-1.3.1; \
./configure --prefix=/deps --static; \
make install;

# compile
WORKDIR /work
ADD . .
RUN mkdir -p /work/build && cd /work/build; \
if [ -e "${LIBGCC}/libgomp.so" ]; then \
mv -f -- "${LIBGCC}/libgomp.so" "${LIBGCC}/libgomp.so.disabled"; \
fi; \
/usr/local/bin/cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=1 -DHAVE_AVX2=1 \
-DOpenMP_C_FLAGS="-fopenmp -I${LIBGCC} -L${LIBGCC}" -DOpenMP_C_LIB_NAMES=gomp -DOpenMP_CXX_FLAGS="-fopenmp -I${LIBGCC} -L${LIBGCC}" -DOpenMP_CXX_LIB_NAMES=gomp -DOpenMP_gomp_LIBRARY="${LIBGCC}/libgomp.a" \
-DATOMIC_LIB_OVERRIDE="${LIBGCC}/libatomic.a" \
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DCMAKE_POLICY_DEFAULT_CMP0144=NEW \
-DZLIB_ROOT=/deps -DBZIP2_ROOT=/deps \
-DFORCE_STATIC_DEPS=1 -DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="75-real;80-real;86-real;89-real;90" ..; \
cmake --build . -j$(nproc --all) -v;

RUN if ldd /work/build/src/mmseqs | grep -P -v "linux-vdso.so|/lib64/(ld-linux-x86-64|libc|libm|libdl|librt|libpthread).so" | grep -q .; then \
echo "Error: unwanted libraries found"; \
ldd /work/build/src/mmseqs; \
exit 1; \
fi; \
if readelf -Ws /work/build/src/mmseqs | grep -q GLIBC_PRIVATE; then \
echo "Error: binary contains private glibc symbols"; \
readelf -Ws /work/build/src/mmseqs; \
exit 1; \
fi; \
LIBC_V=$(readelf -V /work/build/src/mmseqs | awk '$3 ~ /^GLIBC_/ { print $3 }' | sort -V | tail -n1); \
if [[ "$LIBC_V" > "GLIBC_2.17" ]]; then \
echo "Error: glibc too new"; \
readelf -V /work/build/src/mmseqs; \
exit 1; \
fi;
63 changes: 62 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ on:
tag:
required: true
type: string
description: "Docker tag"
latest:
default: false
type: boolean
description: "Mark as latest"


env:
Expand Down Expand Up @@ -45,7 +47,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

Expand Down Expand Up @@ -77,4 +79,63 @@ jobs:
${{ steps.dispatch_tag.outputs.tag }}
${{ steps.dispatch_tag.outputs.latest }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-gpu-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
suffix=-cuda12,onlatest=true
- name: Tag for workflow_dispatch
id: dispatch_tag
run: |
if [ x"$TAG" != x"" ];then
echo "::set-output name=tag::${FULL_TAG}"
fi
if [ x"$LATEST" = x"true" ]; then
echo "::set-output name=latest::${LATEST_TAG}"
fi
env:
FULL_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
LATEST_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
TAG: ${{ github.event.inputs.tag }}
LATEST: ${{ github.event.inputs.latest }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GPU=1
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.dispatch_tag.outputs.tag }}
${{ steps.dispatch_tag.outputs.latest }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 5 additions & 1 deletion .github/workflows/mac-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ on:

jobs:
build:
runs-on: [self-hosted, macOS, ARM64]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Dependencies
run: |
brew install -f --overwrite cmake libomp
- name: Build
run: |
mkdir -p build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
src/workflow/time_test

build/
build-*/
.idea/
cmake-build-*/
BenchmarkingDatas/
Expand Down
43 changes: 35 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ set(HAVE_ARM8 0 CACHE BOOL "Have ARMv8 CPU")
set(HAVE_S390X 0 CACHE BOOL "Have s390x architecture")
set(NATIVE_ARCH 1 CACHE BOOL "Assume native architecture for SIMD. Use one of the HAVE_* options or set CMAKE_CXX_FLAGS to the appropriate flags if you disable this.")
set(USE_SYSTEM_ZSTD 0 CACHE BOOL "Use zstd provided by system instead of bundled version")
set(ENABLE_CUDA 0 CACHE BOOL "Enable CUDA")
set(FORCE_STATIC_DEPS 0 CACHE BOOL "Force static linking of deps")

if(FORCE_STATIC_DEPS)
if(ENABLE_CUDA)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a CACHE INTERNAL "" FORCE)
set(CMAKE_LINK_SEARCH_START_STATIC ON CACHE INTERNAL "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
endif()
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE)
endif()

if(NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

if (HAVE_SANITIZER)
include(FindUBSan)
Expand All @@ -26,10 +45,6 @@ if (HAVE_SANITIZER)
include(FindTSan)
endif ()

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()

# find compiler
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message("-- Compiler is clang(++)")
Expand Down Expand Up @@ -77,7 +92,11 @@ elseif (HAVE_S390X)
set(ZARCH 1 CACHE INTERNAL "")
endif ()

if (NATIVE_ARCH AND (MMSEQS_ARCH STREQUAL ""))
if (MMSEQS_ARCH)
set(NATIVE_ARCH 0 CACHE INTERNAL "")
endif ()

if (NATIVE_ARCH)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*|aarch64.*|AARCH64.*)")
set(ARM 1 CACHE INTERNAL "")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "PPC64*|ppc64*|powerpc64*")
Expand Down Expand Up @@ -205,21 +224,29 @@ add_subdirectory(lib/tinyexpr EXCLUDE_FROM_ALL)
include_directories(lib/microtar)
add_subdirectory(lib/microtar)

# tantan
include_directories(lib/tantan)
add_subdirectory(lib/tantan)

# simde
include_directories(lib/simde)

include_directories(lib)
include_directories(lib/simd)
include_directories(lib/gzstream)
include_directories(lib/alp)
include_directories(lib/cacode)
include_directories(lib/ksw2)
include_directories(lib/xxhash)
if (NOT DISABLE_IPS4O)
include_directories(lib/ips4o)
endif ()

add_subdirectory(lib/cacode)
# libmarv
if (ENABLE_CUDA)
set(LIBRARY_ONLY 1 CACHE INTERNAL "" FORCE)
include_directories(lib/libmarv/src)
add_subdirectory(lib/libmarv/src EXCLUDE_FROM_ALL)
endif ()

add_subdirectory(lib/alp)
add_subdirectory(lib/ksw2)
add_subdirectory(data)
Expand Down
74 changes: 49 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
ARG APP=mmseqs
FROM --platform=$BUILDPLATFORM debian:stable-slim as builder
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS builder
ARG TARGETARCH
ARG APP
ARG GPU

RUN dpkg --add-architecture $TARGETARCH \
&& apt-get update \
&& apt-get install -y \
build-essential cmake xxd git \
build-essential cmake xxd git wget \
zlib1g-dev libbz2-dev libatomic1 \
crossbuild-essential-$TARGETARCH zlib1g-dev:$TARGETARCH libbz2-dev:$TARGETARCH \
&& rm -rf /var/lib/apt/lists/*
crossbuild-essential-$TARGETARCH zlib1g-dev:$TARGETARCH libbz2-dev:$TARGETARCH; \
if [ "$GPU" = "1" ]; then \
wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb; \
dpkg -i cuda-keyring_1.1-1_all.deb; \
apt-get update && apt-get install -y cuda-nvcc-12-6 cuda-cudart-dev-12-6 ninja-build; \
fi; \
rm -rf /var/lib/apt/lists/*;

WORKDIR /opt/build
ADD . .
Expand All @@ -22,33 +28,51 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
mv src/${APP} /opt/build/${APP}_arch; \
touch /opt/build/${APP}_sse2 /opt/build/${APP}_sse41 /opt/build/${APP}_avx2; \
else \
mkdir -p build_sse2/src && mkdir -p build_sse41/src && mkdir -p build_avx2/src; \
cd /opt/build/build_sse2; \
cmake -DHAVE_SSE2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_sse2; \
cd /opt/build/build_sse41; \
cmake -DHAVE_SSE4_1=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_sse41; \
cd /opt/build/build_avx2; \
cmake -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_avx2; \
touch /opt/build/${APP}_arch; \
if [ "$GPU" = "1" ]; then \
export CUDACXX=/usr/local/cuda/bin/nvcc; \
mkdir -p build_avx2/src; \
cd /opt/build/build_avx2; \
LIBGOMP=/usr/lib/gcc/x86_64-linux-gnu/12/; \
cmake -GNinja -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DFORCE_STATIC_DEPS=1 \
-DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="75-real;80-real;86-real;89-real;90" \
-DOpenMP_C_FLAGS="-fopenmp -I${LIBGOMP}" -DOpenMP_C_LIB_NAMES=gomp -DOpenMP_CXX_FLAGS="-fopenmp -I${LIBGOMP}" -DOpenMP_CXX_LIB_NAMES=gomp -DOpenMP_gomp_LIBRARY=${LIBGOMP}/libgomp.a \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
cmake --build . -j$(nproc --all); \
mv src/${APP} /opt/build/${APP}_avx2; \
touch /opt/build/${APP}_arch /opt/build/${APP}_sse41 /opt/build/${APP}_sse2; \
else \
mkdir -p build_sse2/src && mkdir -p build_sse41/src && mkdir -p build_avx2/src; \
cd /opt/build/build_sse2; \
cmake -DHAVE_SSE2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_sse2; \
cd /opt/build/build_sse41; \
cmake -DHAVE_SSE4_1=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_sse41; \
cd /opt/build/build_avx2; \
cmake -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
make -j $(nproc --all); \
mv src/${APP} /opt/build/${APP}_avx2; \
touch /opt/build/${APP}_arch; \
fi; \
fi

FROM debian:stable-slim
FROM debian:bookworm-slim
ARG TARGETARCH
ARG APP

RUN apt-get update && apt-get install -y \
gawk bash grep libstdc++6 libgomp1 libatomic1 zlib1g libbz2-1.0 wget tar \
&& rm -rf /var/lib/apt/lists/*
ARG GPU

COPY --from=builder /opt/build/${APP}_arch /opt/build/${APP}_sse2 /opt/build/${APP}_sse41 /opt/build/${APP}_avx2 /usr/local/bin/
ADD util/${APP}_wrapper.sh /usr/local/bin/entrypoint
RUN if [ "$TARGETARCH" = "arm64" ]; then rm -f /usr/local/bin/entrypoint; ln -s /usr/local/bin/${APP}_arch /usr/local/bin/entrypoint; fi

ENTRYPOINT ["/usr/local/bin/entrypoint"]
RUN apt-get update && apt-get install -y \
gawk bash grep libstdc++6 libgomp1 libatomic1 zlib1g libbz2-1.0 wget tar aria2 \
&& rm -rf /var/lib/apt/lists/*; \
if [ "$TARGETARCH" = "arm64" ]; then \
rm -f /usr/local/bin/entrypoint; ln -s /usr/local/bin/${APP}_arch /usr/local/bin/entrypoint; \
elif [ "$GPU" = "1" ]; then \
rm -f /usr/local/bin/entrypoint; ln -s /usr/local/bin/${APP}_avx2 /usr/local/bin/entrypoint; \
fi

ENTRYPOINT ["/usr/local/bin/entrypoint"]
Loading

0 comments on commit 5b3ea81

Please sign in to comment.