在CUDA中,是否保证默认流等于nullptr?
在CUDA的在CUDA中,是否保证默认流等于nullptr?,cuda,default-value,cuda-streams,Cuda,Default Value,Cuda Streams,在CUDA的driver\u types.h中,我们有: typedef __device_builtin__ struct CUstream_st *cudaStream_t; 在cuda_runtime.h中,我们在许多地方都有默认的初始化流参数。例如: template<class T> static __inline__ __host__ cudaError_t cudaLaunchKernel( const T *func, dim3 gridDi
driver\u types.h
中,我们有:
typedef __device_builtin__ struct CUstream_st *cudaStream_t;
在cuda_runtime.h
中,我们在许多地方都有默认的初始化流参数。例如:
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
)
模板
静态uuuu内联uuuuu主机uuuuuu错误uuu t cudaLaunchKernel(
常数T*func,
dim3网格DIM,
dim3块DIM,
void**args,
大小\u t sharedMem=0,
cudaStream\u t stream=0
)
假设默认流是
(cudaStream)nullptr
,安全性如何?这在多个地方都有记录:
cudaMemcpyAsync
:出于好奇,假设默认流相当于
(cudaStream_t)0
似乎很安全:您为什么需要知道这一点?@m.s.:我没有注意到cudaGetDefaultStream()
函数,我想做一些类似my_stream=condition的事情?foo():cudaGetDefaultStream()
。