In my test, the function torch.gesv is slower on GPU than on CPU, especially the matrix A is small, such as 30*30. How can I solve it? Thank you.
Here is my code:
import pdb
import time
import torch

x = torch.rand([30,30])
x = x.cuda()
y = torch.rand([30,1])
y = y.cuda()

w = torch.gesv(y,x)

start = time.time()
for i in range(10):
  w = torch.gesv(y,x)
end = time.time()

print (end-start)/10.0

x = torch.rand([30,30])
y = torch.rand([30,1])

w = torch.gesv(y,x)

start = time.time()
for i in range(10):
  w = torch.gesv(y,x)
end = time.time()

print (end-start)/10.0

The test resuls is:
0.0037206888198 s on GPU and 2.36988067627e-05 s on CPU