PMBio / deeprvat

Other
16 stars 1 forks source link

Deeprvat environment does not support cuda when created using conda #16

Open endast opened 11 months ago

endast commented 11 months ago

If you create the deeprvat environment using conda pytorch is not installed with CUDA enabled, hence no gpu is used:

(base)  magnus@pc003:~/code/deeprvat (main) 🦖$ conda  env create -f deeprvat_env.yaml  -n conda_deeprvat
...
(base)  magnus@pc003:~/code/deeprvat (main) 🦖$ conda activate conda_deeprvat
(conda_deeprvat) magnus@pc003:~/code/deeprvat (main) 🦖$  python
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:06:00) 
[GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.device_count()
0
>>> print('Current cuda device ', torch.cuda.current_device())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/magnus/mambaforge/envs/conda_deeprvat/lib/python3.8/site-packages/torch/cuda/__init__.py", line 552, in current_device
    _lazy_init()
  File "/data/magnus/mambaforge/envs/conda_deeprvat/lib/python3.8/site-packages/torch/cuda/__init__.py", line 221, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
>>> 

When creating it using mamba cuda is enabled.

(base)  magnus@pc003:~/code/deeprvat (main) 🦖$ mamba env create -f deeprvat_env.yaml
...
(conda_deeprvat) magnus@pc003:~/code/deeprvat (main) 🦖$  conda activate deeprvat
(deeprvat) magnus@pc003:~/code/deeprvat (main) 🦖$  python
Python 3.8.17 | packaged by conda-forge | (default, Jun 16 2023, 07:06:00) 
[GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.device_count()
2
>>> print('Current cuda device ', torch.cuda.current_device())
Current cuda device  0