0

所以我使用 GTX 1050,计算能力为 6.1 和 CUDA 11.0。我需要在我的程序中使用网格同步,所以cudaLaunchCooperativeKernel()需要。我检查了我的设备查询,所以 GPU 确实支持合作组。我无法执行以下功能

 extern "C" __global__ void test(int x) {
    if (x) {
       printf("%d", x);
       if (threadIdx.x == 0)
          test<<<1, 1>>>(--x);
    }
}

打电话后,

cudaLaunchCooperativeKernel((void *)test, 1, 1, (void **) (&x));

收到错误“不允许操作”(代码为 800)。现在,当设备不支持协作组时返回(在这种情况下不支持)。那么,什么可能导致这个问题呢?

4

1 回答 1

2

您的内核利用了动态并行性。但是,在通过以下方式启动的内核中不允许动态并行cudaLaunchCooperativeKernel

这在运行时 API 的文档中有所提及。https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EXECUTION.html

于 2020-12-22T11:22:02.837 回答