pyopencl icon indicating copy to clipboard operation
pyopencl copied to clipboard

missing example for using vector types defined in cltypes

Open yxliang01 opened this issue 4 years ago • 4 comments

Looks like there's no example using vector types defined in cltypes while the doc itself for these types are not so understandable. There are many examples having kernels taking vector type arguments, but the python code is using the numpy type, instead of the defined vector type. E.g. https://github.com/inducer/pyopencl/blob/master/examples/demo_elementwise_complex.py

yxliang01 avatar Mar 02 '20 17:03 yxliang01

I'm having a hard time understanding what you're asking for. If you look at test_array.py, you can see sample code using, e.g. cltypes.float4. Does that help?

inducer avatar Mar 02 '20 21:03 inducer

Right, thanks @inducer for pointing the test_array.py. This is the kind of example I was looking for. I feel there should be documentation on the vector types. Functions like cltypes.make_float4 is very useful but I couldn't see it anywhere nor in the examples.

yxliang01 avatar Mar 03 '20 16:03 yxliang01

Could you draft a PR that improves the documentation in the way you're suggesting?

inducer avatar Mar 03 '20 22:03 inducer

I can do it after I have more free time later :) (working on conference deadline now)

yxliang01 avatar Mar 04 '20 16:03 yxliang01