This folder contains examples of custom user structures in cupy.RawKernel (see https://docs.cupy.dev/en/stable/tutorial/kernel.html for corresponding documentation).
This folder provides three scripts ranked by increasing complexity:
builtins_vectors.pyshows how to use CUDA builtin vectors such asfloat4both as scalar parameter (pass by value from host) and array parameter in RawKernels.packed_matrix.pydemonstrates how to create and use templated packed structures in RawModules.complex_struct.pyillustrates the possibility to recursively build complex NumPy dtypes matching device structure memory layout.
All examples can be run as simple python scripts: python3.x example_name.py.