0

I'm currently designing a dll (and so) library, that will build offload tasks to CUDA, SYCL, OpenCL or Vulkan (not yet decided). As it is unknown what the application will do (might also use the same APIs), my question is, whether there might arise runtime issues for one of the APIs, when using it it in the DLL and in the application.

I'd guess that, creating two contexts in SYCL/OpenCL/Vulkan wouldn't hurt and should separate the API calls accordingly. Is that right and is it sufficient to just explicitly create a context / stream (in CUDA) in the DLL?

Would it additionally be possible to hand a buffer object from the DLL to the application, so that the calling application could directly use the same buffer on their context or is it required to copy to the host first?

talonmies
  • 70,661
  • 34
  • 192
  • 269
fodinabor
  • 451
  • 5
  • 15

1 Answers1

0

I have the feeling that it should work if you keep using the same API.

Of course if you are mixing a lot of API it might be quite more complex.

If for example you have a SYCL implementation with an OpenCL back-end, you can share the buffer on the device between some SYCL and OpenCL use cases. Buy if you want to use the same data between SYCL implementation incompatible with CUDA and CUDA, then you need probably to involve some intermediate host storage.