In CUDA, is it guaranteed that the default stream equals nullptr? -


in cuda's driver_types.h have:

typedef __device_builtin__ struct custream_st *cudastream_t; 

and in cuda_runtime.h have, in many places, default-initialized stream parameters. example:

template<class t>     static __inline__ __host__ cudaerror_t cudalaunchkernel(     const t *func,     dim3 griddim,     dim3 blockdim,     void **args,     size_t sharedmem = 0,     cudastream_t stream = 0 ) 

how safe assume default stream (cudastream) nullptr?

this documented case in multiple places:

  1. programming guide:

kernel launches , host <-> device memory copies not specify stream parameter, or equivalently set stream parameter zero, issued default stream.

  1. for example, cudamemcpyasync:

the copy can optionally associated stream passing non-zero stream argument.

it seems quite safe assume default stream equivalent (cudastream_t) 0


Comments