From 1fd45a0e3389b38c40a487cc88b8954bf1884cac Mon Sep 17 00:00:00 2001 From: Milot Mirdita Date: Mon, 20 Jan 2025 20:01:51 +0900 Subject: [PATCH] Fix Mac Metal in Foldseek release 10 --- recipes/foldseek/build.sh | 4 +++- recipes/foldseek/meta.yaml | 6 ++++-- recipes/foldseek/prostt5-memory.patch | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 recipes/foldseek/prostt5-memory.patch diff --git a/recipes/foldseek/build.sh b/recipes/foldseek/build.sh index 2cb3038cbd802..3bda0a3350ab1 100644 --- a/recipes/foldseek/build.sh +++ b/recipes/foldseek/build.sh @@ -15,6 +15,8 @@ esac if [ $(uname -s) = "Darwin" ] && [ $(uname -m) = "arm64" ]; then export MACOSX_DEPLOYMENT_TARGET=10.15 export MACOSX_SDK_VERSION=10.15 + # make sure MetalKit.framework is not removed + export LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,-dead_strip_dylibs//g") fi if [ -z "${ARCH_BUILD}" ]; then @@ -24,7 +26,7 @@ fi mkdir build cd build -cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHAVE_TESTS=0 -DHAVE_MPI=0 ${ARCH_BUILD} -DVERSION_OVERRIDE="${PKG_VERSION}" \ +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHAVE_TESTS=0 -DHAVE_MPI=0 ${ARCH_BUILD} -DVERSION_OVERRIDE="${PKG_VERSION}" \ -DCMAKE_CUDA_ARCHITECTURES="75-real;80-real;86-real;89-real;90" -DENABLE_CUDA=${CUDA} .. make -j${CPU_COUNT} ${VERBOSE_CM} make install diff --git a/recipes/foldseek/meta.yaml b/recipes/foldseek/meta.yaml index 0b151e3de395d..46e99eeb777a3 100644 --- a/recipes/foldseek/meta.yaml +++ b/recipes/foldseek/meta.yaml @@ -6,13 +6,16 @@ package: version: {{ version|replace("-", ".") }} build: - number: 0 + number: 1 run_exports: - {{ pin_subpackage('foldseek', max_pin="x") }} source: url: https://github.com/steineggerlab/foldseek/archive/{{ version }}.tar.gz sha256: {{ sha256 }} + patches: + # remove for next release + - prostt5-memory.patch requirements: build: @@ -30,7 +33,6 @@ requirements: - cuda-version >=12.6 # [linux] - perl host: - - gawk - zlib - bzip2 run: diff --git a/recipes/foldseek/prostt5-memory.patch b/recipes/foldseek/prostt5-memory.patch new file mode 100644 index 0000000000000..872f554042d44 --- /dev/null +++ b/recipes/foldseek/prostt5-memory.patch @@ -0,0 +1,23 @@ +commit 07932751e776dd71b224dadc94aea0922d08e653 +Author: Milot Mirdita +Date: Mon Jan 20 19:42:31 2025 +0900 + + Reduce ProstT5 memory requirements + +diff --git a/src/strucclustutils/ProstT5.cpp b/src/strucclustutils/ProstT5.cpp +index 605ce300..28bc6c4b 100644 +--- a/src/strucclustutils/ProstT5.cpp ++++ b/src/strucclustutils/ProstT5.cpp +@@ -168,9 +168,9 @@ ProstT5::ProstT5(ProstT5Model& model, int threads) : model(model) { + auto cparams = llama_context_default_params(); + cparams.n_threads = threads; + cparams.n_threads_batch = threads; +- cparams.n_ubatch = 4096; +- cparams.n_batch = 4096; +- cparams.n_ctx = 4096; ++ cparams.n_ubatch = 2048; ++ cparams.n_batch = 2048; ++ cparams.n_ctx = 2048; + cparams.embeddings = true; + cparams.attention_type = LLAMA_ATTENTION_TYPE_NON_CAUSAL; +