cupy: Missing error checks for cuSOLVER calls

Some linalg routines do not check the dev_info variable for errors after calling cuSOLVER. If it is a negative number, then linalg.LinAlgError should be raised.

Missing checks: inv https://github.com/cupy/cupy/blob/master/cupy/linalg/solve.py#L287-L295 qr https://github.com/cupy/cupy/blob/master/cupy/linalg/decomposition.py#L163-L176

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments

@hvy Unfortunately it’s not documented, but if my understanding is correct, it has been the central policy since the beginning of the development.

For example, many functions do not accept numpy.ndarrays because supporting that would expose users to unexpected synchronization that is difficult to even notice.

Another case that performs sync to retrieve devInfo to follow NumPy spec:

If the determinant is zero, then sign will be 0 and logdet will be -Inf.

https://github.com/cupy/cupy/blob/97c72a3c729f63fe86bc2349fb9c4433bbd9eeab/cupy/linalg/norms.py#L246-L249