I have inherited some code that basically does stuff like this:
void *stream;
cudaStreamCreate((cudaStream_t *)&stream);
Looking at targets/x86_64-linux/driver_types.h
for CUDA 8, I see:
typedef __device_builtin__ struct CUStream_st *cudaStream_t;
As far as I understand it, the cast will work, but I worry about how future-proof this may be, and also if it is safe when the code is ported to ARM. How dangerous is the above code? Does the __device_builtin__
affect anything?
(Note: I plan to talk to the developer directly and tell them to use cudaStream_t
throughout and #include <cuda_runtime.h>
, so I am hoping to clarify the technical issues here.)