openmm / NNPOps

High-performance operations for neural network potentials
Other
81 stars 17 forks source link

Conda install the CUDA version of nnpops on a linux CPU platform #96

Closed xiki-tempula closed 1 year ago

xiki-tempula commented 1 year ago

Hi developers, I have a question of pulling in the CUDA version of nnpops on a linux CPU platform. I need to build a docker image to deploy my pipeline and I usually does this on a linux CPU platform as part of the CI. The nnpops is pulled in through conda as part of the building process. It seems that If I just tried to blindly pull in the nnpops on this CPU platform, I will get the CPU version, which makes sense. However, since I will be deploying the docker image on a GPU platform, it will be helpful if I could pull in the cuda version during the docker building. I tried to tell conda that I want the CUDA build variant via mamba create -c conda-forge -n test "nnpops>=0.4=cuda*" However, I will get

Could not solve for environment specs
Encountered problems while solving:
  - nothing provides __cuda needed by pytorch-1.13.1-cuda112py310he33e0d6_200

The environment can't be solved, aborting the operation

And it seems that only 0.4 and 0.3 has this problem as I could pull in nnpops=0.2 as fine. Any guidance is appreciated. Thank you.

sef43 commented 1 year ago

You should be able to set the CONDA_OVERRIDE_CUDA environmental variable: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-virtual.html#overriding-detected-packages Then __cuda will be defined in conda info and conda will install cuda versions of packages without complaining

xiki-tempula commented 1 year ago

Thanks. The keyword is actually CONDA_OVERRIDE_CUDA

xiki-tempula commented 1 year ago

@sef43 Many thanks for the help, Do you happen to know how to add environmental variable CONDA_OVERRIDE_CUDA into mamba-org/provision-with-micromamba@main? Thank you.

sef43 commented 1 year ago

I'm not familiar with that workflow, but it will be the same as setting any other linux environmental variable, supposedly you can also set them in the conda environment.yml files: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#setting-environment-variables