I have encountered the following error when I tried to run a python code that imports dgl.
torch version: 2.2.1
dgl version: 2.1.0 (Not used `dgl-cu*)
CUDA version: 12.2 (the result of nvidia-smi
but not nvcc --version
)
I have checked that dgl does not support CUDA 12.2 and does this error occur because of that? Or just because I have not installed the CUDA version of dgl? (I am not sure what is the difference between dgl
and dgl-cu*
packages, too. See the note below.)
I would appreciate it if you could help me or give me some advice. Thank you.
/home/usr/Programs/work/myvenv/lib/python3.10/site-packages/torch/cuda/__init__.py:628: UserWarning: Can't initialize NVML
warnings.warn("Can't initialize NVML")
Traceback (most recent call last):
File "/home/usr/Programs/work/src/train.py", line 188, in EvalEpoch
sample_batched = {'g': sample_batched['g'].to('cuda:0'), 'e': sample_batched['e'].to('cuda:0'),
File "/home/usr/Programs/work/myvenv/lib/python3.10/site-packages/dgl/heterograph.py", line 5714, in to
ret._graph = self._graph.copy_to(utils.to_dgl_context(device))
File "/home/usr/Programs/work/myvenv/lib/python3.10/site-packages/dgl/heterograph_index.py", line 255, in copy_to
return _CAPI_DGLHeteroCopyTo(self, ctx.device_type, ctx.device_id)
File "dgl/_ffi/_cython/./function.pxi", line 295, in dgl._ffi._cy3.core.FunctionBase.__call__
File "dgl/_ffi/_cython/./function.pxi", line 227, in dgl._ffi._cy3.core.FuncCall
File "dgl/_ffi/_cython/./function.pxi", line 217, in dgl._ffi._cy3.core.FuncCall3
dgl._ffi.base.DGLError: [23:12:37] /opt/dgl/src/runtime/c_runtime_api.cc:82: Check failed: allow_missing: Device API cuda is not enabled. Please install the cuda version of dgl.
Note:
I have also checked this discussion:
But I am wondering are there any versions of dgl that support CUDA 12.1? Is it enough to use dgl 2.1.0
or should I use something like dgl-cu12*
?