以下程序使用'Cuda By Example'实现原子锁,但运行该程序会冻结我的机器。 有人能告诉我我的程序有什么问题吗?非常感谢 益肺 #include <stdio.h>
__global__ void test()
{
__shared__ int i, mutex;
if (threadIdx.x == 0) {
i = 0;
mute
我已经尝试使用atomicInc()程序下面的程序。 __global__ void ker(int *count)
{
int n=1;
int x = atomicInc ((unsigned int *)&count[0],n);
CUPRINTF("In kernel count is %d\n",count[0]);
}
int main()
{
我想CUDA来实现这个原子功能: __device__ float lowest; // global var
__device__ int lowIdx; // global var
float realNum; // thread reg var
int index; // thread reg var
if(realNum < lowest) {
lowest= realNum