0 sized array operations fail
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 298
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
Here's the MWE
```python
>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import numpy as np
>>> empty = np.array([])
>>> empty_gpu = gpuarray.to_gpu(empty)
>>> empty + empty # Passes
>>> empty_gpu + empty_gpu # Fails
```
Here's the error trace
```console
---------------------------------------------------------------------------
error Traceback (most recent call last)
Input In [7], in ()
5 empty_gpu = gpuarray.to_gpu(empty)
6 empty + empty # Passes
----> 7 empty_gpu + empty_gpu
File ~/pycuda/pycuda/gpuarray.py:588, in GPUArray.__add__(self, other)
585 if isinstance(other, GPUArray):
586 # add another vector
587 result = _get_broadcasted_binary_op_result(self, other)
--> 588 return self._axpbyz(1, other, 1, result)
590 elif np.isscalar(other):
591 # add a scalar
592 if other == 0:
File ~/pycuda/pycuda/gpuarray.py:445, in GPUArray._axpbyz(self, selffac, other, otherfac, out, add_timer, stream)
432 add_timer(
433 3 * self.size,
434 func.prepared_timed_call(
(...)
442 ),
443 )
444 else:
--> 445 func.prepared_async_call(
446 out._grid,
447 out._block,
448 stream,
449 selffac,
450 self.gpudata,
451 otherfac,
452 other.gpudata,
453 out.gpudata,
454 out.mem_size,
455 )
457 return out
File ~/pycuda/pycuda/driver.py:625, in _add_functionality..function_prepared_async_call(func, grid, block, stream, *args, **kwargs)
619 raise TypeError(
620 "unknown keyword arguments: " + ", ".join(kwargs.keys())
621 )
623 from pycuda._pvt_struct import pack
--> 625 arg_buf = pack(func.arg_format, *args)
627 for texref in func.texrefs:
628 func.param_set_texref(texref)
error: required argument is not an integer
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.