google-deepmind / alphafold3

AlphaFold 3 inference pipeline.
Other
5.07k stars 563 forks source link

Running with Singularity #75

Closed almeida85 closed 3 days ago

almeida85 commented 3 days ago

Hello,

I am trying to run with Singularity in my HPC. I generated the image with the Singularity.def file provided before in #23. With this, I build the sif image without problems

My script is the following:

#!/bin/bash

#SBATCH --job-name test_AF3
#SBATCH --nodes=1
#SBATCH --partition=gpu-a100
#SBATCH --gres=gpu:a100:1
#SBATCH --ntasks-per-node=24
#SBATCH --mem=64G

module load python3/3.7
module load singularity/3.8.7
module load nvidia/cuda/12.1.0

AF3_SIF=/data-beegfs/AlphaFold/alphafold3/alphafold3.sif
AF3_DBs=/data-beegfs/AlphaFold/DBs_AF3
AF3_WEIGTHS=/data-beegfs/AlphaFold/DBs_AF3

AF3_INPUT=$PWD/inputs
AF3_OUTPUT=$PWD/outputs

# Run Singularity
singularity exec \
     --nv $AF3_SIF python alphafold3/run_alphafold.py \
     --bind $AF3_INPUT:/root/af_input \
     --bind $AF3_OUTPUT:/root/af_output \
     --bind $AF3_WEIGTHS:/root/models \
     --bind $AF3_DBs:/root/public_databases \
     --json_path=/root/af_input/test.json \
     --model_dir=/root/models \
     --db_dir=/root/public_databases \
     --output_dir=/root/af_output

When I run the script I get the error: /alphafold3_venv/bin/python: can't open file '//alphafold3/run_alphafold.py': [Errno 2] No such file or directory

The image is located in the alphafold3 root folder cloned from GitHub.

Any help is appreciated.

Thanks

DrizzeTing commented 3 days ago

The issue was that Singularity doesn’t automatically set the working directory like Docker does. By using the full path python /app/alphafold/run_alphafold.py, it worked correctly.

aozalevsky commented 3 days ago

@DrizzeTing thanks! I've updated the %runscript section with an absolute path and removed the unnecessary cd step. https://gist.github.com/aozalevsky/f4704d2a07040ab6852fbeaf46726832

NB: this is not an "official" singularity recipe, and I don't perform extensive testing aside from verifying that it successfully builds and can show cli options and/or run run_alphafod_test.py

Augustin-Zidek commented 3 days ago

Thanks for reporting! Fixed in https://github.com/google-deepmind/alphafold3/commit/65328c9cfbbb5b7f41a83e27c20891cb578ea3a9.