Skip to content

Commit 5b3ea81

Browse files
authored
Merge branch 'master' into new_linclust
2 parents 6515aba + b804fbe commit 5b3ea81

File tree

252 files changed

+50746
-11044
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+50746
-11044
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ task:
3939
CXX: g++-4.9
4040
compile_script: |
4141
mkdir build && cd build
42-
cmake -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=1 -DHAVE_SSE4_1=1 -DREQUIRE_OPENMP=0 ..
42+
cmake -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=0 -DHAVE_SSE4_1=1 -DREQUIRE_OPENMP=0 ..
4343
make -j $(nproc --all)
4444
test_script: MMSEQS_NUM_THREADS=4 ./util/regression/run_regression.sh ./build/src/mmseqs SCRATCH SEARCH
4545

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
FROM quay.io/pypa/manylinux2014_x86_64
2+
ARG VER="12-6"
3+
ARG ARCH="x86_64"
4+
5+
# CUDA
6+
RUN yum install -y yum-utils
7+
RUN yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
8+
# libcublas-devel-${VER}.${ARCH}
9+
RUN yum -y install cuda-nvcc-${VER}.${ARCH} cuda-cudart-devel-${VER}.${ARCH}
10+
RUN echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/999_nvidia_cuda.conf
11+
ENV PATH="/usr/local/cuda/bin:${PATH}"
12+
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
13+
ENV CUDA_HOME=/usr/local/cuda
14+
ENV CUDA_ROOT=/usr/local/cuda
15+
ENV CUDA_PATH=/usr/local/cuda
16+
ENV CUDADIR=/usr/local/cuda
17+
18+
# Build system
19+
RUN yum install -y git wget vim zlib-devel bzip2-devel ninja-build centos-release-scl
20+
RUN mv /etc/yum.repos.d/CentOS-SCLo-scl.repo /etc/yum.repos.d/CentOS-SCLo-scl.repo.disabled
21+
RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-libatomic-devel
22+
ENV CC=/opt/rh/devtoolset-11/root/bin/gcc
23+
ENV CXX=/opt/rh/devtoolset-11/root/bin/g++
24+
ENV CUDAHOSTCXX=/opt/rh/devtoolset-11/root/bin/g++
25+
ENV CUDACXX=/usr/local/cuda/bin/nvcc
26+
ENV LIBGCC=/opt/rh/devtoolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11
27+
28+
# cmake
29+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.0/cmake-3.31.0-linux-x86_64.sh; \
30+
chmod +x cmake-3.31.0-linux-x86_64.sh; \
31+
./cmake-3.31.0-linux-x86_64.sh --skip-license --prefix=/usr/local;
32+
33+
RUN mkdir /deps; \
34+
cd /deps; \
35+
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz; \
36+
tar xzvf bzip2-1.0.8.tar.gz; \
37+
cd bzip2-1.0.8; \
38+
make install PREFIX=/deps;
39+
40+
RUN cd /deps; \
41+
wget https://www.zlib.net/zlib-1.3.1.tar.gz; \
42+
tar xzvf zlib-1.3.1.tar.gz; \
43+
cd zlib-1.3.1; \
44+
./configure --prefix=/deps --static; \
45+
make install;
46+
47+
# compile
48+
WORKDIR /work
49+
ADD . .
50+
RUN mkdir -p /work/build && cd /work/build; \
51+
if [ -e "${LIBGCC}/libgomp.so" ]; then \
52+
mv -f -- "${LIBGCC}/libgomp.so" "${LIBGCC}/libgomp.so.disabled"; \
53+
fi; \
54+
/usr/local/bin/cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DHAVE_TESTS=1 -DENABLE_WERROR=1 -DHAVE_AVX2=1 \
55+
-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" \
56+
-DATOMIC_LIB_OVERRIDE="${LIBGCC}/libatomic.a" \
57+
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DCMAKE_POLICY_DEFAULT_CMP0144=NEW \
58+
-DZLIB_ROOT=/deps -DBZIP2_ROOT=/deps \
59+
-DFORCE_STATIC_DEPS=1 -DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="75-real;80-real;86-real;89-real;90" ..; \
60+
cmake --build . -j$(nproc --all) -v;
61+
62+
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 \
63+
echo "Error: unwanted libraries found"; \
64+
ldd /work/build/src/mmseqs; \
65+
exit 1; \
66+
fi; \
67+
if readelf -Ws /work/build/src/mmseqs | grep -q GLIBC_PRIVATE; then \
68+
echo "Error: binary contains private glibc symbols"; \
69+
readelf -Ws /work/build/src/mmseqs; \
70+
exit 1; \
71+
fi; \
72+
LIBC_V=$(readelf -V /work/build/src/mmseqs | awk '$3 ~ /^GLIBC_/ { print $3 }' | sort -V | tail -n1); \
73+
if [[ "$LIBC_V" > "GLIBC_2.17" ]]; then \
74+
echo "Error: glibc too new"; \
75+
readelf -V /work/build/src/mmseqs; \
76+
exit 1; \
77+
fi;

.github/workflows/docker.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ on:
1111
tag:
1212
required: true
1313
type: string
14+
description: "Docker tag"
1415
latest:
1516
default: false
1617
type: boolean
18+
description: "Mark as latest"
1719

1820

1921
env:
@@ -45,7 +47,7 @@ jobs:
4547

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

@@ -77,4 +79,63 @@ jobs:
7779
${{ steps.dispatch_tag.outputs.tag }}
7880
${{ steps.dispatch_tag.outputs.latest }}
7981
labels: ${{ steps.meta.outputs.labels }}
82+
build-and-push-gpu-image:
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: read
86+
packages: write
87+
steps:
88+
- name: Checkout repository
89+
uses: actions/checkout@v3
90+
91+
# - name: Set up QEMU
92+
# uses: docker/setup-qemu-action@v2
93+
94+
- name: Set up Docker Buildx
95+
uses: docker/setup-buildx-action@v2
96+
97+
- name: Log in to the Container registry
98+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
99+
with:
100+
registry: ${{ env.REGISTRY }}
101+
username: ${{ github.actor }}
102+
password: ${{ secrets.GITHUB_TOKEN }}
103+
104+
- name: Extract metadata (tags, labels) for Docker
105+
id: meta
106+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
107+
with:
108+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
109+
flavor: |
110+
suffix=-cuda12,onlatest=true
111+
112+
- name: Tag for workflow_dispatch
113+
id: dispatch_tag
114+
run: |
115+
if [ x"$TAG" != x"" ];then
116+
echo "::set-output name=tag::${FULL_TAG}"
117+
fi
118+
if [ x"$LATEST" = x"true" ]; then
119+
echo "::set-output name=latest::${LATEST_TAG}"
120+
fi
121+
env:
122+
FULL_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
123+
LATEST_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
124+
TAG: ${{ github.event.inputs.tag }}
125+
LATEST: ${{ github.event.inputs.latest }}
80126

127+
- name: Build and push Docker image
128+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
129+
with:
130+
context: .
131+
platforms: linux/amd64
132+
push: true
133+
cache-from: type=gha
134+
cache-to: type=gha,mode=max
135+
build-args: |
136+
GPU=1
137+
tags: |
138+
${{ steps.meta.outputs.tags }}
139+
${{ steps.dispatch_tag.outputs.tag }}
140+
${{ steps.dispatch_tag.outputs.latest }}
141+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/mac-arm64.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ on:
77

88
jobs:
99
build:
10-
runs-on: [self-hosted, macOS, ARM64]
10+
runs-on: macos-latest
1111
steps:
1212
- uses: actions/checkout@v3
1313
with:
1414
submodules: true
1515

16+
- name: Dependencies
17+
run: |
18+
brew install -f --overwrite cmake libomp
19+
1620
- name: Build
1721
run: |
1822
mkdir -p build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
src/workflow/time_test
3131

3232
build/
33+
build-*/
3334
.idea/
3435
cmake-build-*/
3536
BenchmarkingDatas/

CMakeLists.txt

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@ set(HAVE_ARM8 0 CACHE BOOL "Have ARMv8 CPU")
1818
set(HAVE_S390X 0 CACHE BOOL "Have s390x architecture")
1919
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.")
2020
set(USE_SYSTEM_ZSTD 0 CACHE BOOL "Use zstd provided by system instead of bundled version")
21+
set(ENABLE_CUDA 0 CACHE BOOL "Enable CUDA")
22+
set(FORCE_STATIC_DEPS 0 CACHE BOOL "Force static linking of deps")
23+
24+
if(FORCE_STATIC_DEPS)
25+
if(ENABLE_CUDA)
26+
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so CACHE INTERNAL "" FORCE)
27+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
28+
else()
29+
set(CMAKE_FIND_LIBRARY_SUFFIXES .a CACHE INTERNAL "" FORCE)
30+
set(CMAKE_LINK_SEARCH_START_STATIC ON CACHE INTERNAL "" FORCE)
31+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
32+
endif()
33+
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE)
34+
endif()
35+
36+
if(NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
37+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
38+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
39+
endif()
2140

2241
if (HAVE_SANITIZER)
2342
include(FindUBSan)
@@ -26,10 +45,6 @@ if (HAVE_SANITIZER)
2645
include(FindTSan)
2746
endif ()
2847

29-
if (NOT CMAKE_BUILD_TYPE)
30-
set(CMAKE_BUILD_TYPE Release)
31-
endif ()
32-
3348
# find compiler
3449
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
3550
message("-- Compiler is clang(++)")
@@ -77,7 +92,11 @@ elseif (HAVE_S390X)
7792
set(ZARCH 1 CACHE INTERNAL "")
7893
endif ()
7994

80-
if (NATIVE_ARCH AND (MMSEQS_ARCH STREQUAL ""))
95+
if (MMSEQS_ARCH)
96+
set(NATIVE_ARCH 0 CACHE INTERNAL "")
97+
endif ()
98+
99+
if (NATIVE_ARCH)
81100
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*|aarch64.*|AARCH64.*)")
82101
set(ARM 1 CACHE INTERNAL "")
83102
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "PPC64*|ppc64*|powerpc64*")
@@ -205,21 +224,29 @@ add_subdirectory(lib/tinyexpr EXCLUDE_FROM_ALL)
205224
include_directories(lib/microtar)
206225
add_subdirectory(lib/microtar)
207226

227+
# tantan
228+
include_directories(lib/tantan)
229+
add_subdirectory(lib/tantan)
230+
208231
# simde
209232
include_directories(lib/simde)
210233

211234
include_directories(lib)
212235
include_directories(lib/simd)
213-
include_directories(lib/gzstream)
214236
include_directories(lib/alp)
215-
include_directories(lib/cacode)
216237
include_directories(lib/ksw2)
217238
include_directories(lib/xxhash)
218239
if (NOT DISABLE_IPS4O)
219240
include_directories(lib/ips4o)
220241
endif ()
221242

222-
add_subdirectory(lib/cacode)
243+
# libmarv
244+
if (ENABLE_CUDA)
245+
set(LIBRARY_ONLY 1 CACHE INTERNAL "" FORCE)
246+
include_directories(lib/libmarv/src)
247+
add_subdirectory(lib/libmarv/src EXCLUDE_FROM_ALL)
248+
endif ()
249+
223250
add_subdirectory(lib/alp)
224251
add_subdirectory(lib/ksw2)
225252
add_subdirectory(data)

Dockerfile

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
ARG APP=mmseqs
2-
FROM --platform=$BUILDPLATFORM debian:stable-slim as builder
2+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS builder
33
ARG TARGETARCH
44
ARG APP
5+
ARG GPU
56

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

1420
WORKDIR /opt/build
1521
ADD . .
@@ -22,33 +28,51 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
2228
mv src/${APP} /opt/build/${APP}_arch; \
2329
touch /opt/build/${APP}_sse2 /opt/build/${APP}_sse41 /opt/build/${APP}_avx2; \
2430
else \
25-
mkdir -p build_sse2/src && mkdir -p build_sse41/src && mkdir -p build_avx2/src; \
26-
cd /opt/build/build_sse2; \
27-
cmake -DHAVE_SSE2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
28-
make -j $(nproc --all); \
29-
mv src/${APP} /opt/build/${APP}_sse2; \
30-
cd /opt/build/build_sse41; \
31-
cmake -DHAVE_SSE4_1=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
32-
make -j $(nproc --all); \
33-
mv src/${APP} /opt/build/${APP}_sse41; \
34-
cd /opt/build/build_avx2; \
35-
cmake -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
36-
make -j $(nproc --all); \
37-
mv src/${APP} /opt/build/${APP}_avx2; \
38-
touch /opt/build/${APP}_arch; \
31+
if [ "$GPU" = "1" ]; then \
32+
export CUDACXX=/usr/local/cuda/bin/nvcc; \
33+
mkdir -p build_avx2/src; \
34+
cd /opt/build/build_avx2; \
35+
LIBGOMP=/usr/lib/gcc/x86_64-linux-gnu/12/; \
36+
cmake -GNinja -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DFORCE_STATIC_DEPS=1 \
37+
-DENABLE_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES="75-real;80-real;86-real;89-real;90" \
38+
-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 \
39+
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
40+
cmake --build . -j$(nproc --all); \
41+
mv src/${APP} /opt/build/${APP}_avx2; \
42+
touch /opt/build/${APP}_arch /opt/build/${APP}_sse41 /opt/build/${APP}_sse2; \
43+
else \
44+
mkdir -p build_sse2/src && mkdir -p build_sse41/src && mkdir -p build_avx2/src; \
45+
cd /opt/build/build_sse2; \
46+
cmake -DHAVE_SSE2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
47+
make -j $(nproc --all); \
48+
mv src/${APP} /opt/build/${APP}_sse2; \
49+
cd /opt/build/build_sse41; \
50+
cmake -DHAVE_SSE4_1=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
51+
make -j $(nproc --all); \
52+
mv src/${APP} /opt/build/${APP}_sse41; \
53+
cd /opt/build/build_avx2; \
54+
cmake -DHAVE_AVX2=1 -DHAVE_MPI=0 -DHAVE_TESTS=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. ..; \
55+
make -j $(nproc --all); \
56+
mv src/${APP} /opt/build/${APP}_avx2; \
57+
touch /opt/build/${APP}_arch; \
58+
fi; \
3959
fi
4060

41-
FROM debian:stable-slim
61+
FROM debian:bookworm-slim
4262
ARG TARGETARCH
4363
ARG APP
44-
45-
RUN apt-get update && apt-get install -y \
46-
gawk bash grep libstdc++6 libgomp1 libatomic1 zlib1g libbz2-1.0 wget tar \
47-
&& rm -rf /var/lib/apt/lists/*
64+
ARG GPU
4865

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

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

78+
ENTRYPOINT ["/usr/local/bin/entrypoint"]

0 commit comments

Comments
 (0)