Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device

Hello.

I’m having an error in my terminal whenever I try to run torch that says exactly Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device. I’m not really sure this is similar to #18074 since I didn’t compile torch from source neither MAGMA. Also, it seems to work anyway, it gives me the warning about 6 times but it continues to generate stuff:

Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
generating:  22%|█████████▉                                   | 11/50 [00:05<00:07,  5.55iteration/s]
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
generating:  24%|██████████▊                                  | 12/50 [00:05<00:06,  5.92iteration

I’m using:

pytorch                   1.9.1           cuda112py39h4e14dd4_3    conda-forge
pytorch-gpu               1.9.1           cuda112py39h0bbbad9_3    conda-forge
PyTorch Version: 1.9.1.post3
OS (e.g., Linux): Linux Ubuntu 20.04
conda
Python version: 3.9.0 | packaged by conda-forge | (default, Nov 26 2020, 07:57:39)
CUDA 11.2
NVCC 11.2
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0
GPU models and configuration: RTX 3070

Any idea on how to solve this? Or just hide this from the terminal without grep buffer change.
Thank you.

It seems you are running into this already fixed issue so could you update to the latest stable release (1.10.0) or the nightly?
EDIT: based on your setup you might also run into this issue as it seems you are installing the conda-forge binaries, which are not an official build if I understand the linked GitHub issue correctly.

@ptrblck

I updated to:

pytorch                   1.10.0          cuda112py39h4e14dd4_0    conda-forge
pytorch-gpu               1.10.0          cuda112py39h0bbbad9_0    conda-forge

But I got this error…

Traceback (most recent call last):
  File "/home/luis/Desktop/cog/cogscan/scripts/test_both_libs.py", line 81, in <module>
    metadata_comment = generate.video_frames(num_video_frames=num_video_frames,
  File "/home/luis/Desktop/cog/vqgan-clip-generator/src/vqgan_clip/generate.py", line 345, in video_frames
    eng.initialize_VQGAN_CLIP()
  File "/home/luis/Desktop/cog/vqgan-clip-generator/src/vqgan_clip/engine.py", line 243, in initialize_VQGAN_CLIP
    self._perceptor = clip.load(self.conf.clip_model, jit=jit)[0].eval().requires_grad_(False).to(self._device)
  File "/home/luis/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/jit/_script.py", line 914, in fail
    raise RuntimeError(name + " is not supported on ScriptModules")
RuntimeError: requires_grad_ is not supported on ScriptModules

Ok, how do you recommend the installation on a conda environment? I literally did as the website says.

@ptrblck How can I hide this error?

It seems you are still using the conda-forge binaries, so would need to forward the issue to the authors of this build.
In case you are using the official 1.10.0 release and are still hitting the error, please let me know here.

Thanks that worked! I had the same issue on torch 1.9.1 installed with pip, and it went away after upgrading with pip to 1.10.0

2 Likes

Hey @ptrblck I am still getting the original error, Error in magma_getdevice_arch: MAGMA not initialized (call magma_init() first) or bad device
Although I installed using conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

Could you describe when this error is raised and the output of python -m torch.utils.collect_env, please?

Thanks, @ptrblck for your reply, but I managed to resolve the error.