-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathalphafold_3.0.0.def
82 lines (64 loc) · 3.22 KB
/
alphafold_3.0.0.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
bootstrap: docker
from: docker.io/nvidia/cuda:12.6.0-base-ubuntu22.04
%post
export DEBIAN_FRONTEND=noninteractive
# Get latest package listing, install software-properties-common, git, wget,
# compilers and libraries.
# git is required for pyproject.toml toolchain's use of CMakeLists.txt.
# gcc, g++, make are required for compiling hmmer and AlphaFold 3 libaries.
# zlib is a required dependency of AlphaFold 3.
apt update --quiet \
&& apt install --yes --quiet software-properties-common \
&& apt install --yes --quiet git wget gcc g++ make zlib1g-dev zstd
# Get apt repository of specific Python versions. Then install Python. Tell APT
# this isn't an interactive TTY to avoid timezone prompt when installing.
add-apt-repository ppa:deadsnakes/ppa \
&& apt install --yes --quiet python3.11 python3-pip python3.11-venv python3.11-dev
# Update pip to the latest version. Not necessary in Docker, but good to do when
# this is used as a recipe for local installation since we rely on new pip
# features for secure installs.
python3.11 -m venv /alphafold3_venv
PATH="/hmmer/bin:/alphafold3_venv/bin:$PATH"
pip3 install --upgrade pip
# Install HMMER. Do so before copying the source code, so that docker can cache
# the image layer containing HMMER.
mkdir /hmmer_build /hmmer ; \
wget http://eddylab.org/software/hmmer/hmmer-3.4.tar.gz --directory-prefix /hmmer_build ; \
(cd /hmmer_build && tar zxf hmmer-3.4.tar.gz && rm hmmer-3.4.tar.gz) ; \
(cd /hmmer_build/hmmer-3.4 && ./configure --prefix /hmmer) ; \
(cd /hmmer_build/hmmer-3.4 && make -j8) ; \
(cd /hmmer_build/hmmer-3.4 && make install) ; \
(cd /hmmer_build/hmmer-3.4/easel && make install) ; \
rm -R /hmmer_build
# Copy the AlphaFold 3 source code from the local machine to the container and
# set the working directory to there.
mkdir -p app
cd app/
git clone https://github.com/google-deepmind/alphafold3.git --branch v3.0.0 alphafold
cd alphafold
# Install the Python dependencies AlphaFold 3 needs.
pip3 install -r dev-requirements.txt
pip3 install --no-deps .
# Build chemical components database (this binary was installed by pip).
build_data
# create directories for models and database
mkdir -p /data
mkdir -p /models
%environment
# set python env
export PATH="/hmmer/bin:/alphafold3_venv/bin:${PATH}"
# to avoid potentially-conflicting Python packages installed in ~/.local
export PYTHONNOUSERSITE=true
# To work around a known XLA issue causing the compilation time to greatly
# increase, the following environment variable setting XLA flags must be enabled
# when running AlphaFold 3:
export XLA_FLAGS="--xla_gpu_enable_triton_gemm=false"
# Memory settings used for folding up to 5,120 tokens on A100 80 GB.
export XLA_PYTHON_CLIENT_PREALLOCATE=true
export XLA_CLIENT_MEM_FRACTION=0.95
%runscript
exec python3 /app/alphafold/run_alphafold.py "$@"
%labels
Author [email protected]
%help
Singularity container to run Alphafold3, converted from the Dockerfile https://github.com/google-deepmind/alphafold3/commits/main/docker/Dockerfile