occa icon indicating copy to clipboard operation
occa copied to clipboard

Add method to get current stream object

Open stgeke opened this issue 2 years ago • 5 comments

This can be useful coupling occa application codes with other device accelerated libs.

stgeke avatar Jun 23 '22 06:06 stgeke

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

kris-rowe avatar Jun 23 '22 16:06 kris-rowe

Currently there is no way to access the member cuStream of occa::cuda::stream. It's not part of the API.

stgeke avatar Jun 30 '22 10:06 stgeke

You are correct. We will need to add a function to the frontend device API to make this happen.

kris-rowe avatar Jun 30 '22 15:06 kris-rowe

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.

SFrijters avatar Jul 05 '22 10:07 SFrijters

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.

deukhyun-cha avatar Jul 27 '22 16:07 deukhyun-cha