I’m having trouble performing matrix inversion on the GPU - on a matrix that inverts fine on the CPU. I am using Google Colab with torch version 1.3.0+cu100. Here is my code:
import torch dim = 100 # CPU inversion A = torch.rand(dim,dim,device='cpu') Ainv = A.inverse() print(torch.matmul(A,Ainv)) # GPU inversion A = A.to('cuda') Ainv = A.inverse() print(torch.matmul(A,Ainv))
For a small matrix (i.e. setting dim = 100), I get the following error:
RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling
cublasSgemm( handle, opa, opb, m, n, k, &alpha, a, lda, b, ldb, &beta, c, ldc)
For a large matrix (i.e. setting dim = 1000), I get the following error:
RuntimeError: inverse_cuda: U(1,1) is zero, singular U.
In both cases, the inversion goes fine on the CPU, but inverting the same matrix on the GPU fails. Any help is appreciated!
Edit: Running the above code on another workstation with torch version 1.0.1.post2 does not produce this error.