cudajcuda

Convert cudaStream_t object to CUStream object


Is there any way to convert cudaStream_t object to CUStream?

I found this hack but I don't think its safe to use. Or, is there any way to call cudaLaunchKernel in JCuda application using cudaStream_t object in CUDA 7.5 only?


Solution

  • At a C level within the runtime and driver APIs, cudaStream_t and CUStream are the same type and can be used interchangeably in either API.

    At a JCUDA level, it appears that CUstream has a specialization of its constructor for initializing an instance with an existing cudaStream_t instance. The provision of this alternative constructor eliminates the need for the pointer swap you linked to in the question.