Check availability of csrmvEx
@@ -139,16 +139,16 @@ class csr_matrix(compressed._compressed_sparse_matrix):
elif other.ndim == 1:
self.sum_duplicates()
other = cupy.asfortranarray(other)
- # csrmvEx does not work if nnz == 0
- if self.nnz > 0 and cusparse.csrmvExIsAligned(self, other):
for accelerator in _accelerator.get_routine_accelerators():
if (accelerator == _accelerator.ACCELERATOR_CUB
and other.flags.c_contiguous):
return cub.device_csrmv(
self.shape[0], self.shape[1], self.nnz,
self.data, self.indptr, self.indices, other)
- return cusparse.csrmvEx(self, other)
- else:
+ if (cusparse.check_availability('csrmvEx') and self.nnz > 0 and
+ cusparse.csrmvExIsAligned(self, other)):
+ # csrmvEx does not work if nnz == 0
+ csrmv = cusparse.csrmvEx
if cusparse.check_availability('csrmv'):
csrmv = cusparse.csrmv
elif cusparse.check_availability('spmv'):
