Is it possible to fill a custom struct (or an array of custom structs) with random values after I have registered its type?
For a "primitive" type, I can to it like this:
from pyopencl.clrandom import rand as clrand
import pyopencl.cltypes as cltypes
a = clrand(queue, (1024,), dtype=cltypes.float, a=-10.0, b=10.0)
It even works for vector types:
a = clrand(queue, (1024,), dtype=cltypes.float4, a=-10.0, b=10.0)
Is there a way to do it for structs? E.g. if I have a struct with an int16 and a float32, I would expect a similar syntax to create such random structs, where each struct in the array has been initialized recursively, using the respective RNG of the "primitive" types that constitute the struct type.
I am extremely sorry in advance in case I missed something from the documentation and/or the examples and tests.
Is it possible to fill a custom struct (or an array of custom structs) with random values after I have registered its type? For a "primitive" type, I can to it like this:
It even works for vector types:
Is there a way to do it for structs? E.g. if I have a struct with an int16 and a float32, I would expect a similar syntax to create such random structs, where each struct in the array has been initialized recursively, using the respective RNG of the "primitive" types that constitute the struct type.
I am extremely sorry in advance in case I missed something from the documentation and/or the examples and tests.