Converting sparse matrix errors
See original GitHub issueAm seeing the following error when trying to convert a csc_matrix
to a coo_matrix
. Though also see some variation of this when trying to go to a csr_matrix
from a csc_matrix
and other similar conversions.
- Conditions (you can just paste the output of
python -c 'import cupy; cupy.show_config()'
)
CuPy Version : 7.2.0
CUDA Root : /datasets/jkirkham/miniconda/envs/rapids13dev
CUDA Build Version : 10010
CUDA Driver Version : 10020
CUDA Runtime Version : 10010
cuBLAS Version : 10201
cuFFT Version : 10101
cuRAND Version : 10101
cuSOLVER Version : (10, 2, 0)
cuSPARSE Version : 10300
NVRTC Version : (10, 1)
cuDNN Build Version : 7605
cuDNN Version : 7605
NCCL Build Version : 2406
NCCL Runtime Version : 2507
- Code to reproduce
In [1]: import cupy
In [2]: a = cupy.array([[0, 1, 0],
...: [2, 0, 3],
...: [0, 4, 0]], dtype=float)
In [3]: a2 = cupy.sparse.csc_matrix(a)
In [4]: a3 = a2.tocoo()
- Error messages, stack traces, or logs
---------------------------------------------------------------------------
CUDADriverError Traceback (most recent call last)
<ipython-input-4-14bf9613c858> in <module>
----> 1 a3 = a2.tocoo()
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupyx/scipy/sparse/csc.py in tocoo(self, copy)
179
180 """
--> 181 return self.T.tocoo(copy).T
182
183 def tocsc(self, copy=None):
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupyx/scipy/sparse/csr.py in tocoo(self, copy)
239 indices = self.indices
240
--> 241 return cusparse.csr2coo(self, data, indices)
242
243 def tocsc(self, copy=False):
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupy/cusparse.py in csr2coo(x, data, indices)
631 # data and indices did not need to be copied already
632 return cupyx.scipy.sparse.coo_matrix(
--> 633 (data, (row, indices)), shape=x.shape)
634
635
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupyx/scipy/sparse/coo.py in __init__(self, arg1, shape, dtype, copy)
128
129 if len(data) > 0:
--> 130 if row.max() >= shape[0]:
131 raise ValueError('row index exceeds matrix dimensions')
132 if col.max() >= shape[1]:
cupy/core/core.pyx in cupy.core.core.ndarray.__richcmp__()
cupy/core/_kernel.pyx in cupy.core._kernel.ufunc.__call__()
cupy/core/_kernel.pyx in cupy.core._kernel.ufunc._get_ufunc_kernel()
cupy/core/_kernel.pyx in cupy.core._kernel._get_ufunc_kernel()
cupy/core/_kernel.pyx in cupy.core._kernel._get_simple_elementwise_kernel()
cupy/core/carray.pxi in cupy.core.core.compile_with_cache()
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupy/cuda/compiler.py in compile_with_cache(source, options, arch, cache_dir, extra_source, backend)
285 else:
286 return _compile_with_cache_cuda(source, options, arch, cache_dir,
--> 287 extra_source, backend)
288
289
/datasets/jkirkham/miniconda/envs/rapids13dev/lib/python3.7/site-packages/cupy/cuda/compiler.py in _compile_with_cache_cuda(source, options, arch, cache_dir, extra_source, backend)
333 cubin_hash = six.b(hashlib.md5(cubin).hexdigest())
334 if hash == cubin_hash:
--> 335 mod.load(cubin)
336 return mod
337
cupy/cuda/function.pyx in cupy.cuda.function.Module.load()
cupy/cuda/function.pyx in cupy.cuda.function.Module.load()
cupy/cuda/driver.pyx in cupy.cuda.driver.moduleLoadData()
cupy/cuda/driver.pyx in cupy.cuda.driver.check_status()
CUDADriverError: CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
python - Memory error when converting matrix to sparse matrix ...
Purpose: I want to invert the dense matrix first and then convert it to a sparse matrix, but it will report a memory...
Read more >Sparse matrices (scipy.sparse) — SciPy v1.9.3 Manual
To perform manipulations such as multiplication or inversion, first convert the matrix to either CSC or CSR format. The lil_matrix format is row-based,...
Read more >Convert matrix or dataframe to sparse Matrix in R
Example: Converting matrix to sparse matrix in R ... We will convert the dataframe to a sparse matrix by using the sparseMatrix() function ......
Read more >Matrix package bug?
Hi @robertc , I face an error when trying to run gsva function from the GSVA package using a big sparse matrix (class...
Read more >Converting scipy sparse csr_matrix to dask array
We are getting OOM error on scipy sparse csr matrix on slicing the matrix. So to avoid OOM we are planning on converting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed this is fixed in the updated conda package (conda-forge/cupy-feedstock#39).
Sure if it is helpful to have open. No objections. Reopening…
Thanks Leo 🙂