Another case of Undefined reference to 'cudaCGGetIntrinsicHandle'

There have been a few threads here on the forum reporting a failure to resolve the symbol ‘cudaCGGetIntrinsicHandle’ or other cooperative-group-related symbols. Example: this one.

I’m now encountering the same problem myself. Here’s a minimal program triggering it:

#include <cooperative_groups.h>
#include <stdio.h>

__global__ void my_kernel() {
    auto g = cooperative_groups::this_grid();
    g.sync();
}

int main(int, char **) {
    cudaLaunchCooperativeKernel( (const void*) my_kernel, 2, 2, nullptr, 0, nullptr);
    cudaDeviceSynchronize();
}

Trying to build this program (named foo.cu) this happens:

$ nvcc -o foo  -gencode arch=compute_61,code=sm_61 foo.cu 
ptxas fatal   : Unresolved extern function 'cudaCGGetIntrinsicHandle'

Why? What am I doing wrong?

Note: Also posted this question on SO.

https://stackoverflow.com/questions/59481008/why-does-nvcc-refuse-to-link-this-simple-cooperative-groups-program

@RobertCrovella: That solved half the problem… this is the other half.

Update:

Apparently, this is the result of a packaging bug on Debian/Devuan. The file /etc/nvcc.profile should have added /usr/lib/X86_64-linux-gnu/ to the LIBRARIES environment variable for nvlink to use, but is not doing that.

I’ve filed a bug against Devuan and also sent a message to the Debian package maintainers.

Neither Debian nor Devuan is a currently officially supported distro for CUDA development, regardless of what the Debian or Devuan folks do or don’t do. I’m aware you are aware of this, but others reading this thread may not be.

@Robert_Crovella: (Belated reply), that’s a valid comment, but it’s also a problem. IMHO, CUDA support should be (in adfor “reasonable Debian-based distributions” (in addition to other distros), not for “Specific distributions X, Y and Z”.