Skip to content

[cl.array] Prefer input arrays' constructor instead of cla.Array to instantiate the output - #531

Merged
inducer merged 4 commits into
inducer:mainfrom
kaushikcfd:use_arg_constructor
Jan 16, 2022
Merged

[cl.array] Prefer input arrays' constructor instead of cla.Array to instantiate the output#531
inducer merged 4 commits into
inducer:mainfrom
kaushikcfd:use_arg_constructor

Conversation

@kaushikcfd

Copy link
Copy Markdown
Contributor
  • For the best viewing experience please switch to the commit-by-commit view.
  • Version bump because of the following incoherence with numpy:
>>> import numpy as np
>>> np.hstack([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<__array_function__ internals>", line 180, in hstack
  File "/home/kgk2/projects/ceesd/miniforge3/envs/ceesd/lib/python3.8/site-packages/numpy/core/shape_base.py", line 345, in hstack
    return _nx.concatenate(arrs, 1)
  File "<__array_function__ internals>", line 180, in concatenate
ValueError: need at least one array to concatenate

need at least one array to concatenate
>>> import pyopencl.array as cla
>>> cla.hstack([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kgk2/projects/ceesd/pyopencl/pyopencl/array.py", line 2700, in hstack
    return empty(queue, (), dtype=np.float64)
  File "/home/kgk2/projects/ceesd/pyopencl/pyopencl/array.py", line 580, in __init__
    self.base_data = cl.Buffer(
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. pyopencl._cl.Buffer(context: pyopencl._cl.Context, flags: int, size: int = 0, hostbuf: object = None)

Invoked with: None, 1, 8

__init__(): incompatible constructor arguments. The following argument types are supported:
    1. pyopencl._cl.Buffer(context: pyopencl._cl.Context, flags: int, size: int = 0, hostbuf: object = None)

Invoked with: None, 1, 8

@inducer

inducer commented Jan 16, 2022

Copy link
Copy Markdown
Owner

LGTM, thanks!

@inducer
inducer merged commit 114309f into inducer:main Jan 16, 2022
@inducer

inducer commented Jan 16, 2022

Copy link
Copy Markdown
Owner

https://pypi.org/project/pyopencl/2021.2.12/, should wind its way to conda soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants