English 中文(简体)
CUDA 线索执行令
原标题:CUDA Threads execution order
  • 时间:2012-05-23 17:46:16
  •  标签:
  • cuda

在CUDA,当我们谈论 平行线 执行相同的代码 是否有命令 执行它们?

For-example:

If, I have 4 threads,for a 1D array of 4 elements.All four threads perfom some operation on some index of the array. Will thread 4 always execute after thread 3 or there is no specific order in the execution?

谢谢!

最佳回答

一般来说, 线条执行没有顺序。 依赖线条顺序来设计您的算法是错误的 。

问题回答

线索执行没有确定性命令,如果需要特定命令,应该按顺序编程,而不是使用平行执行模式。

在 CUDA 执行模型中, 线索被分组为“ 扭曲 ” 。 取决于底部装置的计算能力, 每一个曲盘( 半曲盘) 都同时执行 - 完全同时执行。 执行过程一直持续到代码锁定为止, 原因是等待记忆传输和另一个曲盘( 半曲盘) 。

不过,文件非常具体地说明了 你可以对这件事的假设: 最好的执行屏障是内核呼叫结束。





相关问题
Why won t OpenCV compile in NVCC?

I am trying to integrate CUDA and openCV in a project. Problem is openCV won t compile when NVCC is used, while a normal c++ project compiles just fine. This seems odd to me, as I thought NVCC ...

error in CUDA compilation

I m getting this error while trying to run sample codes in CUDA SDK. I have CUDA 2.3 and Visual studio 2008 LINK : fatal error LNK1181: cannot open input file cutil32D.lib Any pointers how to ...

CUDA Memory Allocation accessible for both host and device

I m trying to figure out a way to allocate a block of memory that is accessible by both the host (CPU) and device (GPU). Other than using cudaHostAlloc() function to allocate page-locked memory that ...

热门标签