Below is the code which solves a sparse linear system: import cupyx import cupyx.scipy.sparse.linalg import time import scipy import scipy.sparse.linalg import pathlib file_dir = str(pathlib.Path(__file__).parent.resolve()) # ------------ cpu (scipy) ------------------------------- A_host = scipy.sparse.load_npz(file_dir+'/A.npz') B_host = scipy.sparse.load_npz(file_dir+'/B.npz') t00 = time.time() P_host = scipy.sparse.linalg.spsolve(A_host, B_host) t01 = time.time() # ------------ gpu (cupy) ------------------------------- A_device = cupyx.scipy.sparse.csr_matrix(A_host) B_device = cupyx.scipy.sparse.csr_matrix(B_host) t10 = time.time() # 2nd parameter of the below function must be cupy.ndarray P_seg = cupyx.scipy.sparse.linalg.spsolve(A_device, B_device.toarray()) t11 = time.time() # ------------ timing results ------------------------------- print('cpu:', t01-t00) print('gpu:', t11-t10) The size of matrix A is about 100000x100000, and size of matrix B is about 100000x8. The running results is 0.689s on CPU, 37.774s on GPU. Why so much slower speed on GPU? A.npz and B.npz can be downloaded here. Continue reading...