Search code examples
cupy

C headers to create cupy.array() from C code


I would like to create a cupy.array() in C code, similar to how I can with numpy via PyArray_SimpleNew(). So far I'm unable to find the C headers that I should use to do this though. Is this currently possible? Thanks


Solution

  • As far as I could tell there is no C headers to create cupy objects. The solution I ended up using was creating my own C defined object which held the CUDA pointer, and using the memory.UnownedMemory feature of cupy to wrap that into a cupy object in Python code.