CUDA 11: conversion cupyx.scipy.sparse.csr_matrix does not work device to device

101 views
Skip to first unread message

Andras Balogh

unread,
Oct 17, 2020, 3:57:05 PM10/17/20
to CuPy User Group
coo_matrix => csr_matrix conversion does not seem to work on CUDA 11 with cupy-cuda110 (it only works if the coo_matrix is on the host)
On CUDA 10 with cupy-cuda100 this works correctly

import cupy 
import cupyx.scipy.sparse 
rows = cupy.array([0, 0, 1, 2, 2, 2],'i') 
cols= cupy.array([0, 2, 2, 0, 1, 2],'i') 
entries = cupy.array([1, 2, 3, 4, 5, 6],'f') 
A=cupyx.scipy.sparse.coo_matrix((entries,(rows,cols)),shape=(4,4))
print(A.get().toarray(),"\n",type(A),"\n")
B1 = cupyx.scipy.sparse.csr_matrix(A)  # this does not work, matrix is not correct
print(B1.get().toarray(), "\n", type(B1),"\n")  # does not show matrix correctly
B2 = cupyx.scipy.sparse.csr_matrix(A.get())  # this works
print(B2.get().toarray(), "\n", type(B2),"\n") #shows matrix correctly  
Reply all
Reply to author
Forward
0 new messages