Commit a3259565 authored by mashun1's avatar mashun1
Browse files

fix bug

parent cc620f00
FROM image.sourcefind.cn:5000/dcu/admin/base/jax:0.4.23-ubuntu20.04-dtk24.04.1-py3.10
# RUN apt update
RUN apt update
# WORKDIR /app
RUN sudo apt install hmmer -y
# WORKDIR /app/softwares
RUN sudo apt install doxygen -y
# RUN git clone https://github.com/soedinglab/hh-suite.git
WORKDIR /app
# RUN mkdir -p hh-suite/build && cd hh-suite/build && cmake -DCMAKE_INSTALL_PREFIX=. .. && make -j 4 && make install
COPY . /app/alphafold2
# hh-suite
WORKDIR /app/softwares
RUN git clone https://github.com/soedinglab/hh-suite.git
# # for intel cpu
# RUN mkdir -p hh-suite/build && cd hh-suite/build && lscpu | grep 'Model name' | grep -q 'Intel' && cmake -DCMAKE_INSTALL_PREFIX=. .. && make -j 4 && make install || echo "not for intel"
# # RUN which hhsearch && echo "already build for intel" || echo ""
# # for others
# RUN lscpu | grep 'Model name' | grep -vq 'Intel' && cmake -DHAVE_AVX2=1 -DCMAKE_INSTALL_PREFIX=. .. && make -j 4 && make install && echo "already build for hygon or amd" || echo "not for others"
# # RUN which hhsearch
# ENV PATH=/app/softwares/hh-suite/build/bin:/app/softwares/hh-suite/build/scripts:$PATH
# WORKDIR /app/softwares
# RUN which hhsearch
# kalign
WORKDIR /app/softwares
RUN wget https://github.com/TimoLassmann/kalign/archive/refs/tags/v3.4.0.zip && unzip v3.4.0.zip && cd kalign-3.4.0 && mkdir build && cd build && cmake .. && make && sudo make install
# openmm
WORKDIR /app/softwares
# RUN wget https://github.com/TimoLassmann/kalign/archive/refs/tags/v3.4.0.zip && unzip v3.4.0.zip && cd kalign-3.4.0 && mkdir build && cd build && cmake .. && make && make install
RUN wget https://github.com/openmm/openmm/archive/refs/tags/8.0.0.zip && unzip 8.0.0.zip
# WORKDIR /app/softwares
# RUN mkdir build build-hip install
# RUN sudo apt install doxygen -y
# RUN cd build && cmake ../openmm-8.0.0/ -D CMAKE_INSTALL_PREFIX=../install -D OPENMM_BUILD_COMMON=ON -D OPENMM_PYTHON_USER_INSTALL=ON && make && sudo make install && sudo make PythonInstall
# RUN wget https://github.com/openmm/openmm/archive/refs/tags/8.0.0.zip && unzip 8.0.0.zip && cd openmm-8.0.0 && mkdir build && cd build && cmake .. && make && sudo make install && sudo make PythonInstall
# hip
WORKDIR /app/softwares
# WORKDIR /app/softwares
RUN git clone https://github.com/amd/openmm-hip.git
# RUN wget https://github.com/openmm/pdbfixer/archive/refs/tags/1.9.zip && unzip 1.9.zip && cd pdbfixer-1.9 && python setup.py install
# RUN cd build-hip && cmake ../openmm-hip/ -D OPENMM_DIR=../install -D OPENMM_SOURCE_DIR=../openmm-8.0.0 -D CMAKE_INSTALL_PREFIX=../install && make && sudo make install
# RUN sudo apt install hmmer -y
# ENV LD_LIBRARY_PATH=/app/softwares/build-hip/:$LD_LIBRARY_PATH
# WORKDIR /app
# ENV OPENMM_PLUGIN_DIR=/app/softwares/install/lib/plugins
# COPY . /app/alphafold2
# ENV OPENMM_FFT_BACKEND=1
# RUN ls
# RUN python docker_test.py | grep -q 'HIP'
# RUN pip install --no-cache-dir -r /app/alphafold2/requirements_dcu.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple
# pdbfixer
# RUN pip install dm-haiku==0.0.11 flax==0.7.1 jmp==0.0.2 tabulate==0.8.9 --no-deps jax -i https://mirrors.ustc.edu.cn/pypi/web/simple
WORKDIR /app/softwares
# RUN pip install orbax==0.1.6 orbax-checkpoint==0.1.6 optax==0.2.2 -i https://mirrors.ustc.edu.cn/pypi/web/simple
RUN wget https://github.com/openmm/pdbfixer/archive/refs/tags/1.9.zip && unzip 1.9.zip && cd pdbfixer-1.9 && python setup.py install
# WORKDIR /app/alphafold2
# pip
RUN ls
# RUN python setup.py install
RUN pip install --no-cache-dir -r /app/alphafold2/requirements_dcu.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple
RUN pip install dm-haiku==0.0.11 flax==0.7.1 jmp==0.0.2 tabulate==0.8.9 --no-deps jax -i https://mirrors.ustc.edu.cn/pypi/web/simple
RUN pip install orbax==0.1.6 orbax-checkpoint==0.1.6 optax==0.2.2 -i https://mirrors.ustc.edu.cn/pypi/web/simple
WORKDIR /app/alphafold2
RUN python setup.py install
......@@ -16,69 +16,35 @@ AlphaFold2通过从蛋白质序列和结构数据中提取信息,使用神经
## 环境配置
### Docker(方法一)
<!-- ### Docker
# 使用该方法不需要下载本仓库,镜像中已包含可运行代码,需要挂载相应的数据文件
# 使用该方法不需要下载本仓库,镜像中已包含可运行代码,需要挂载相应的数据文件
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:alphafold2-dtk24.04.1-py310
docker run --shm-size 100g --network=host --name=alphafold2 --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v 本地数据地址:镜像数据地址 -v /opt/hyhal:/opt/hyhal:ro -it <your IMAGE ID> bash
# 该镜像在intel-cpu上编译,若在其他cpu上使用,需要重新编译hh-suite
cd /app/softwares/hh-suite && rm -rf build
mkdir build && cd build
cmake -DHAVE_AVX2=1 -DCMAKE_INSTALL_PREFIX=. ..
make -j 4 && sudo make install
export PATH="$(pwd)/bin:$(pwd)/scripts:$PATH"
cd /app/alphafold2/dcu_build
### Docker(方法二)
# 此过程较为耗时
bash build.sh
docker pull image.sourcefind.cn:5000/dcu/admin/base/jax:0.4.23-ubuntu20.04-dtk24.04.1-py3.10
source env.sh -->
docker run --shm-size 50g --network=host --name=alphafold2 --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v 项目地址(绝对路径):/home/ -v /opt/hyhal:/opt/hyhal:ro -it <your IMAGE ID> bash
### Dockerfile
# 1. 一般依赖项安装
pip install -r requirements_dcu.txt
# 下载本仓库
pip install dm-haiku==0.0.11 flax==0.7.1 jmp==0.0.2 tabulate==0.8.9 --no-deps jax
docker build -t alphafold2:v1 .
pip install orbax==0.1.6 orbax-checkpoint==0.1.6 optax==0.2.2
python setup.py install
sudo apt install hmmer -y
# 2、hh-suite
git clone https://github.com/soedinglab/hh-suite.git
mkdir -p hh-suite/build && cd hh-suite/build
cmake -DCMAKE_INSTALL_PREFIX=. ..
make -j 4 && make install
export PATH="$(pwd)/bin:$(pwd)/scripts:$PATH"
wget https://github.com/TimoLassmann/kalign/archive/refs/tags/v3.4.0.zip
unzip v3.4.0.zip && cd kalign-3.4.0
mkdir build
cd build
cmake ..
make
make test
make install
# 3. openmm + pdbfixer
sudo apt install doxygen
wget https://github.com/openmm/openmm/archive/refs/tags/8.0.0.zip
unzip 8.0.0.zip && cd openmm-8.0.0 && mkdir build && cd build
cmake .. && make && sudo make install && sudo make PythonInstall
docker run --shm-size 100g --network=host --name=alphafold2 --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v 本地数据地址:镜像数据地址 -v /opt/hyhal:/opt/hyhal:ro -it <your IMAGE ID> bash
wget https://github.com/openmm/pdbfixer/archive/refs/tags/1.9.zip
cd /app/alphafold2/dcu_build
unzip 1.9.zip && cd pdbfixer-1.9 && python setup.py install
# 此过程较为耗时
bash build.sh
source env.sh
## 数据集
推荐使用AlphaFold2中的开源数据集,包括BFD、MGnify、PDB70、Uniclust、Uniref90等,数据集大小约2.62TB。数据集格式如下:
......
......@@ -92,7 +92,7 @@ def _openmm_minimize(
_add_restraints(system, pdb, stiffness, restraint_set, exclude_residues)
integrator = openmm.LangevinIntegrator(0, 0.01, 0.0)
platform = openmm.Platform.getPlatformByName("CUDA" if use_gpu else "CPU")
platform = openmm.Platform.getPlatformByName("HIP" if use_gpu else "CPU")
simulation = openmm_app.Simulation(
pdb.topology, system, integrator, platform)
simulation.context.setPositions(pdb.positions)
......
#!/bin/bash
# /*即使下载了镜像依旧可能无法使用,因此在这里对一些容易出问题的库编译*/
# hh-suite
platform_is_intel=`lscpu | grep 'Model name' | grep -q "Intel" && echo "true" || echo "false"`
echo $platform_is_intel
if [ "${platform_is_intel}" = "true" ]; then
echo "build for intel"
cd /app/softwares/hh-suite
rm -rf build
mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX=. .. && make -j 8 && make install
else
echo "build for others"
cd /app/softwares/hh-suite
rm -rf build
mkdir -p build && cd build && cmake -DHAVE_AVX2=1 -DCMAKE_INSTALL_PREFIX=. .. && make -j 8 && make install
fi
# openmm-8.0.0
echo "build openmm-8.0.0"
cd /app/softwares
rm -rf build build-hip install
mkdir build build-hip install
cd build && cmake ../openmm-8.0.0/ -D CMAKE_INSTALL_PREFIX=../install -D OPENMM_BUILD_COMMON=ON -D OPENMM_PYTHON_USER_INSTALL=ON && make && sudo make install && sudo make PythonInstall
# openmm-hip
cd /app/softwares
cd build-hip && cmake ../openmm-hip/ -D OPENMM_DIR=../install -D OPENMM_SOURCE_DIR=../openmm-8.0.0 -D CMAKE_INSTALL_PREFIX=../install && make && sudo make install
#!/bin/bash
export LD_LIBRARY_PATH=/app/softwares/build-hip/:$LD_LIBRARY_PATH
export OPENMM_PLUGIN_DIR=/app/softwares/install/lib/plugins
export OPENMM_FFT_BACKEND=1
export PATH=/app/softwares/hh-suite/build/bin:/app/softwares/hh-suite/build/scripts:$PATH
import openmm
num_platform = openmm.Platform_getNumPlatforms()
for i in range(num_platform):
gname = openmm.Platform_getPlatform(i).getName()
if gname == "HIP":
print(gname)
break
#!/bin/bash
download_dir=/home/chuangkj/alphafold2_jax/downloads
download_dir=/path/to/data
python3 run_alphafold.py \
--fasta_paths=monomer.fasta \
--output_dir=./ \
......
#!/bin/bash
download_dir=/home/chuangkj/alphafold2_jax/downloads
download_dir=/path/to/data
python3 run_alphafold.py \
--fasta_paths=multimer.fasta \
--output_dir=./ \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment