-
-
Notifications
You must be signed in to change notification settings - Fork 956
Open
Labels
Description
Description
Thanks to Cupy, I'm able to migrate my project from CPU to GPU.
However, I rely on scipy.sparse.diag_block
operation, which is not available in Cupy. I have to do this on CPU with scipy and transfer the data to GPU. We have linalg.block_diag
but that only takes dense matrix. Is there any plan to implement it for sparse matrix as well? If not, is there a way around or I have to implement it myself? Following is an example of my usage.
ideal:
matricies = []
for i in range(num):
data, row, col = cp.random.rand(size), cp.random.rand(size), cp.random.rand(size)
coo_matrix = cupyx.scipy.sparse.coo_matrix(data, (row, col)
matricies.append(coo_matrix )
block = cupyx.scipy.sparse.block_diag(matricies)
Currently, I have to diag block it with scipy and transfer it to GPU, lossing a lot of performance.
matricies = []
for i in range(num):
data, row, col = np.random.rand(size), np.random.rand(size), np.random.rand(size)
coo_matrix = scipy.sparse.coo_matrix(data, (row, col)
matricies.append(coo_matrix )
block = scipy.sparse.block_diag(matricies)
block_cp = cupyx.scipy.sparse.csr_matrix(block)
Thanks
Additional Information
No response