meatball1982 发表于 2024-3-15 09:35:05

RuntimeError: cusolver error: CUSOLVER_STATUS_NOT_INITIALIZED, when calling

安装 alphaflow,
https://github.com/bjing2016/alphaflow

出现了很多的问题,

libstdc++.so.6出问题,GLIBC3.4.4之类。
安装新的,把新的libstdc++.so.6.0.24copy到libstdc++.so.6所在目录,rm libstdc++.so.6
ln -s libstdc++.so.6.0.24libstdc++.so.6

如果是OOM的问题.
set PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:32

其它的,
基本上是pytorch和cuda版本不一致导致。
主要是通过pip在安装 。


但出现“RuntimeError: cusolver error: CUSOLVER_STATUS_NOT_INITIALIZED, when calling”
这个问题时,安装了不同版本的pytorch和对应的cuda,gcc后,还是解决不了。

从一个16G显存的,换到24G显存的。都不行(文献里是48G显存的,口水)。



根据
https://blog.csdn.net/w05072/article/details/135460257
https://github.com/rosinality/glow-pytorch/issues/21
https://www.tutorialspoint.com/how-to-move-a-torch-tensor-from-cpu-to-gpu-and-vice-versa
https://blog.csdn.net/yaoyao_chen/article/details/130688639

大体思路是,正在跑model , 显示还差不多够用。当需要一些大的矩阵运算时,比如求逆。显卡就搞不定了。

这时,要把数据 copy back to cpu ,计算数学习相关的东西,再把结果copy 给gpu.

尝试,可行。

我是修改
alphaflow-master/alphaflow/utils/diffusion.py


16 # u, s, vh = torch.linalg.svd(B)
17 device = torch.device("cuda:6" if torch.cuda.is_available() else "cpu")#这一行好像没啥用。
18 B_cpu=B.to('cpu')
19 u_cpu, s_cpu, vh_cpu = torch.linalg.svd(B_cpu)
20 u = u_cpu.to("cuda")
21 s = s_cpu.to("cuda")
22 vh = vh_cpu.to("cuda")19 行是用cpu去计算svd。
然后再copy给gpu

这样,计算时间会变长(我没测试,想想也会变长),但对于显存比较小的机器(比如16,24G),至少是可以运行。




页: [1]
查看完整版本: RuntimeError: cusolver error: CUSOLVER_STATUS_NOT_INITIALIZED, when calling