occa
occa copied to clipboard
Add method to get current stream object
This can be useful coupling occa application codes with other device accelerated libs.
Currently you could use
modeStream_t* backend_stream = occa_device->getStream()->getModeStream();
and then dynamic_cast
this to the appropriate type before passing it to another library.
Are you looking for this to happen in a single step?
In general, I agree that we should have a complete set of easy-to-use interoperability functions (some of which exist) and document them, similar to this: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:backend-interoperability
Currently there is no way to access the member cuStream of occa::cuda::stream. It's not part of the API.
You are correct. We will need to add a function to the frontend device API to make this happen.
I would also be very interested in a principled way to get this out. We currently use a hack similar to https://github.com/libocca/occa/pull/606 to punch through the abstractions and pull out a stream.
I second that this is definitely needed to utilize 3rdparty libraries with APIs expecting native device data pointers. To the @SFrijters point, I am wondering if it would be a good idea/possible to provide a general API which returns native pointer (void*) of the actual data from occaType (although not all occaType has it). I think this could be useful especially for types like occaStream or occaMemory to communicate with 3rdparty libraries designed for a certain device target/platform. Just a thought.