fynv / ThrustRTC

CUDA tool set for non-C++ languages that provides similar functionality like Thrust, with NVRTC at its core.
Other
59 stars 6 forks source link

better error handling for 0-size vector creation #23

Closed slayoo closed 2 years ago

slayoo commented 2 years ago

as of now, passing a zero value for vector size causes the following behaviour:

import ThrustRTC as trtc
trtc.device_vector('double', 0)
cuMemAlloc() failed with Error code: 1
Error Name: CUDA_ERROR_INVALID_VALUE
Error Description: invalid argument
Out[4]: <ThrustRTC.DVVector.DVVector at 0x7f8bca0b1d90>
fynv commented 2 years ago

Fixed in 0.3.17 release, current behavior:

>>> import ThrustRTC as trtc
>>> trtc.device_vector('double', 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\workspace\ThrustRTC_local\install\test_python\ThrustRTC\DVVector.py", line 62, in device_vector
    raise ValueError("0-size vector not allowed")
ValueError: 0-size vector not allowed

Also merged pull request #22

slayoo commented 2 years ago

Thank you, @fynv !