Cuda 4 GPU 间同步
有人在 Cuda4 上成功测试过这个功能吗?看来我无法让它正常工作,不确定这是我的代码中的错误还是该功能尚未完全实现。
例如,我想在将内存从 1 个 GPU 复制到另一个 GPU 后执行内核调用。流0,mem0在gpu0上创建流1,mem1在gpu1上创建。两者都是 Fermi Tesla (C2070)
cudaMemcpyAsync( mem1, mem0, size, cudaMemcpyDefault, stream0 );
cudaEventRecord(P2Pevent, stream0);
cudaStreamWaitEvent(stream1, P2Pevent, 0);
cudaKernel<<<block,thread,0,stream1>>>(mem1);
有时内存似乎还没有为内核准备好,因此结果不正确。如果我在 Gpu0 上添加 cudaDeviceSynchronize 那么它工作正常。
谢谢
Did anyone successfully test this feature on Cuda4 ? It seems I can't have it worked correctly, not sure if it's a bug in my code or the feature is not fully implemented yet.
For example, I want to do a kernel call after copying a memory from 1 gpu to another. Stream 0, mem0 is created on gpu0 stream 1,mem1 is created on gpu1. Both are Fermi Tesla (C2070)
cudaMemcpyAsync( mem1, mem0, size, cudaMemcpyDefault, stream0 );
cudaEventRecord(P2Pevent, stream0);
cudaStreamWaitEvent(stream1, P2Pevent, 0);
cudaKernel<<<block,thread,0,stream1>>>(mem1);
Sometime it seems the memory is not ready for the kernel yet so the result is incorrect. If I add an cudaDeviceSynchronize on Gpu0 then it works fine.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我的代码中的一个错误!它确实工作正常
谢谢大家
It's a bug in my code ! It does work correctly
Thanks guys