关于何时使用cudaDeviceSynchronize
来源:互联网 发布:腾讯通rtx2009 mac 编辑:程序博客网 时间:2024/06/03 21:20
转自:http://blog.csdn.net/mathgeophysics/article/details/19905935
When to call cudaDeviceSynchronize
why do we need cudaDeviceSynchronize(); in kernels with device-printf?
Although CUDA kernel launches are asynchronous, all GPU-related tasks placed in one stream (which is default behaviour) are executed sequentially.
So, for example,
kernel1<<<X,Y>>>(...); // kernel start execution, CPU continues to next statement
kernel2<<<X,Y>>>(...); // kernel is placed in queue and will start after kernel1 finishes, CPU continues to next statement
cudaMemcpy(...); // CPU blocks until ememory is copied, memory copy starts only
而GOOGLE中文排名第二的解释是不太完整的:
哪些情况下应当使用cudaDeviceSynchronize()?-CSDN论坛-CSDN
cudaStreamSynchronize vs CudaDeviceSynchronize vs cudaThreadSynchronize
These are all barriers. Barriers prevent code execution beyond the barrier until some condition is met.
- cudaDeviceSynchronize() halts execution in the CPU/host thread (that the cudaDeviceSynchronize was issued in) until the GPU has finished processing all previously requested cuda tasks (kernels, data copies, etc.)
- cudaThreadSynchronize() as you've discovered, is just a deprecated version of
cudaDeviceSynchronize
. Deprecated just means that it still works for now, but it's recommended not to use it (use cudaDeviceSynchronize instead) and in the future, it may become unsupported. ButcudaThreadSynchronize
() andcudaDeviceSynchronize
() are basically identical. - cudaStreamSynchronize() is similar to the above two functions, but it prevents further execution in the CPU host thread until the GPU has finished processing all previously requested cuda tasks that were issued in the referenced stream. So
cudaStreamSynchronize
() takes a stream id as it's only parameter. cuda tasks issued in other streams may or may not be complete when CPU code execution continues beyond this barrier.
0 0
- 关于何时使用cudaDeviceSynchronize
- 关于何时使用cudaDeviceSynchronize
- 关于何时使用接口
- 关于何时使用数据库索引
- 关于何时使用继承和何时使用组合的做法
- 关于layoutSubviews方法何时使用的总结
- 何时使用@()
- 关于block 中 何时使用 __weak/__block MyViewController * weakSelf 分析
- 关于FD_WRITE何时触发
- 何时使用 Parallel.ForEach,何时使用 PLINQ
- 1 何时使用Class?何时使用Struct?
- 何时使用copy,何时使用strong
- mysql何时使用myisam, 何时使用innodb ?
- android 何时使用Service 何时使用Thread
- 何时使用 Parallel.ForEach,何时使用 PLINQ
- 何时使用注解
- 何时应该使用struts?
- [C++] 何时使用vector
- c++stl泛型编程
- 『IOS』workspace & subProject & target
- C# 文件与二进制互转数据库写入读出--还包含选择文件~
- arm汇编指令之数据块传输(LDM,STM)
- 小问题系列
- 关于何时使用cudaDeviceSynchronize
- iOS开发ASIHTTPRequest使用download cache【10】
- lnmp---环境搭建
- ByteBuffer用法小结
- 每行显示n个(js)
- myeclipse notepad++ SecureCRTPortable等工具背景颜色设置
- 网络带宽与速率
- 手机生成二维码
- libzdb