kalininalab / alphafold_non_docker

AlphaFold2 non-docker setup
331 stars 119 forks source link

Fix CUDA_VISIBLE_DEVICES control #2

Closed aozalevsky closed 3 years ago

aozalevsky commented 3 years ago

At the moment, the export of CUDA_VISIBLE_DEVICES=0 is hardcoded in the script,

https://github.com/kalininalab/alphafold_non_docker/blob/46ee72c44ff0a1817b6e4b646881aec3a4b9c0dd/run_alphafold.sh#L97

which is quite misleading in conjunction with the

https://github.com/kalininalab/alphafold_non_docker/blob/46ee72c44ff0a1817b6e4b646881aec3a4b9c0dd/run_alphafold.sh#L18

Moreover, the NVIDIA_VISIBLE_DEVICES environment variable applies only to containers and is not needed in the non-docker setup.

https://github.com/kalininalab/alphafold_non_docker/blob/46ee72c44ff0a1817b6e4b646881aec3a4b9c0dd/run_alphafold.sh#L99

This part can be modified like this to work as initially intended.

# Export ENVIRONMENT variables (change me if required)                                                                                                                                                                                         
if [[ "$use_gpu" == true ]] ; then                                                                                                                                                                                                             
    export CUDA_VISIBLE_DEVICES=0                                                                                                                                                                                                              

    if [[ "$gpu_devices" ]] ; then                                                                                                                                                                                                             
        export CUDA_VISIBLE_DEVICES=$gpu_devices                                                                                                                                                                                               
    fi                                                                                                                                                                                                                                         
fi                                        

I hope this will be helpful!

sanjaysrikakulam commented 3 years ago

Hi @aozalevsky,

Yesterday I made changes to the readme especially regarding this (that users can edit the value in the script) and later made changes to the code exactly as you described. I just did not push it yet. I will push it shortly.

sanjaysrikakulam commented 3 years ago

Thank you for your suggestions! :-)