589
社区成员




// 如题: vs2022, cuda 12.6
__device__ volatile int a = 0;
__device__ volatile int b = 0;
__global__ void ga() // 使用流1
{
a = 1;
for (; !b;)void(); // 多流串行??卡死
}
__global__ void gb() // 使用流1
{
b = 1;
for (; !a;)void(); // 多流串行??卡死
}
void TsetCu()
{
cudaStream_t s1, s2;
cudaStreamCreate(&s1);
cudaStreamCreate(&s2);
ga << <1, 1, 0, s1 >> > (); // 使用流1
gb << <1, 1, 0, s2 >> > (); // 使用流2
cudaDeviceSynchronize(); // 卡死
}