Error when compiling Cuda samples

I installed Cuda Toolkit:
sudo apt install cuda-toolkit-12-2

and downloaded Cuda samples:
git clone GitHub - NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit

When I tried to build Cuda samples, I got the following errors.
Thanks in advance for troubleshooting suggections.

make
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/cudaGraphsPerfScaling’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/cudaGraphsPerfScaling’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/UnifiedMemoryPerf’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/UnifiedMemoryPerf’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/transpose’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/transpose’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/LargeKernelParameter’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/LargeKernelParameter’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/alignedTypes’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/6_Performance/alignedTypes’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/graphMemoryFootprint’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/graphMemoryFootprint’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/warpAggregatedAtomicsCG’

GCC Version is greater or equal to 4.7.0 <<<
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/warpAggregatedAtomicsCG’
make[1]: Entering directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/graphConditionalNodes’
/usr/local/cuda/bin/nvcc -ccbin g++ -I…/…/…/Common -m64 --threads 0 --std=c++11 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_87,code=sm_87 -gencode arch=compute_90,code=sm_90 -gencode arch=compute_90,code=compute_90 -o graphConditionalNodes.o -c graphConditionalNodes.cu
graphConditionalNodes.cu(60): error: identifier “cudaGraphConditionalHandle” is undefined
attribute((global)) void ifGraphKernelA(char *dPtr, cudaGraphConditionalHandle handle)
^

graphConditionalNodes.cu(64): error: identifier “cudaGraphSetConditional” is undefined
cudaGraphSetConditional(handle, value);
^

graphConditionalNodes.cu(91): error: identifier “cudaGraphConditionalHandle” is undefined
cudaGraphConditionalHandle handle;
^

graphConditionalNodes.cu(92): error: identifier “cudaGraphConditionalHandleCreate” is undefined
cudaGraphConditionalHandleCreate(&handle, graph);
^

graphConditionalNodes.cu(104): error: identifier “cudaGraphNodeTypeConditional” is undefined
cudaGraphNodeParams cParams = { cudaGraphNodeTypeConditional };
^

graphConditionalNodes.cu(105): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.handle = handle;
^

graphConditionalNodes.cu(106): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.type = cudaGraphCondTypeIf;
^

graphConditionalNodes.cu(106): error: identifier “cudaGraphCondTypeIf” is undefined
cParams.conditional.type = cudaGraphCondTypeIf;
^

graphConditionalNodes.cu(107): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.size = 1;
^

graphConditionalNodes.cu(110): error: class “cudaGraphNodeParams” has no member “conditional”
cudaGraph_t bodyGraph = cParams.conditional.phGraph_out[0];
^

graphConditionalNodes.cu(159): error: identifier “cudaGraphConditionalHandle” is undefined
attribute((global)) void doWhileLoopKernel(char *dPtr, cudaGraphConditionalHandle handle)
^

graphConditionalNodes.cu(162): error: identifier “cudaGraphSetConditional” is undefined
cudaGraphSetConditional(handle, 0);
^

graphConditionalNodes.cu(180): error: identifier “cudaGraphConditionalHandle” is undefined
cudaGraphConditionalHandle handle;
^

graphConditionalNodes.cu(181): error: identifier “cudaGraphCondAssignDefault” is undefined
check((cudaGraphConditionalHandleCreate(&handle, graph, 1, cudaGraphCondAssignDefault)), “cudaGraphConditionalHandleCreate(&handle, graph, 1, cudaGraphCondAssignDefault)”, “graphConditionalNodes.cu”, 181);
^

graphConditionalNodes.cu(181): error: identifier “cudaGraphConditionalHandleCreate” is undefined
check((cudaGraphConditionalHandleCreate(&handle, graph, 1, cudaGraphCondAssignDefault)), “cudaGraphConditionalHandleCreate(&handle, graph, 1, cudaGraphCondAssignDefault)”, “graphConditionalNodes.cu”, 181);
^

graphConditionalNodes.cu(183): error: identifier “cudaGraphNodeTypeConditional” is undefined
cudaGraphNodeParams cParams = { cudaGraphNodeTypeConditional };
^

graphConditionalNodes.cu(184): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.handle = handle;
^

graphConditionalNodes.cu(185): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.type = cudaGraphCondTypeWhile;
^

graphConditionalNodes.cu(185): error: identifier “cudaGraphCondTypeWhile” is undefined
cParams.conditional.type = cudaGraphCondTypeWhile;
^

graphConditionalNodes.cu(186): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.size = 1;
^

graphConditionalNodes.cu(189): error: class “cudaGraphNodeParams” has no member “conditional”
cudaGraph_t bodyGraph = cParams.conditional.phGraph_out[0];
^

graphConditionalNodes.cu(194): error: identifier “cudaStreamBeginCaptureToGraph” is undefined
check((cudaStreamBeginCaptureToGraph(captureStream, bodyGraph, nullptr, nullptr, 0, cudaStreamCaptureModeRelaxed)), “cudaStreamBeginCaptureToGraph(captureStream, bodyGraph, nullptr, nullptr, 0, cudaStreamCaptureModeRelaxed)”, “graphConditionalNodes.cu”, 194);
^

graphConditionalNodes.cu(236): error: identifier “cudaGraphConditionalHandle” is undefined
attribute((global)) void capturedWhileKernel(char *dPtr, cudaGraphConditionalHandle handle)
^

graphConditionalNodes.cu(242): error: identifier “cudaGraphSetConditional” is undefined
cudaGraphSetConditional(handle, *dPtr);
^

graphConditionalNodes.cu(274): error: identifier “cudaGraphConditionalHandle” is undefined
cudaGraphConditionalHandle handle;
^

graphConditionalNodes.cu(275): error: identifier “cudaGraphConditionalHandleCreate” is undefined
check((cudaGraphConditionalHandleCreate(&handle, graph)), “cudaGraphConditionalHandleCreate(&handle, graph)”, “graphConditionalNodes.cu”, 275);
^

graphConditionalNodes.cu(285): error: identifier “cudaGraphNodeTypeConditional” is undefined
cudaGraphNodeParams cParams = { cudaGraphNodeTypeConditional };
^

graphConditionalNodes.cu(286): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.handle = handle;
^

graphConditionalNodes.cu(287): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.type = cudaGraphCondTypeWhile;
^

graphConditionalNodes.cu(287): error: identifier “cudaGraphCondTypeWhile” is undefined
cParams.conditional.type = cudaGraphCondTypeWhile;
^

graphConditionalNodes.cu(288): error: class “cudaGraphNodeParams” has no member “conditional”
cParams.conditional.size = 1;
^

graphConditionalNodes.cu(291): error: class “cudaGraphNodeParams” has no member “conditional”
cudaGraph_t bodyGraph = cParams.conditional.phGraph_out[0];
^

graphConditionalNodes.cu(306): error: identifier “cudaStreamBeginCaptureToGraph” is undefined
check((cudaStreamBeginCaptureToGraph(bodyStream, bodyGraph, nullptr, nullptr, 0, cudaStreamCaptureModeRelaxed)), “cudaStreamBeginCaptureToGraph(bodyStream, bodyGraph, nullptr, nullptr, 0, cudaStreamCaptureModeRelaxed)”, “graphConditionalNodes.cu”, 306);
^

33 errors detected in the compilation of “graphConditionalNodes.cu”.
make[1]: *** [Makefile:347: graphConditionalNodes.o] Error 255
make[1]: Leaving directory ‘/home/ubuntu/nvidia/cuda-samples/Samples/3_CUDA_Features/graphConditionalNodes’
make: *** [Makefile:45: Samples/3_CUDA_Features/graphConditionalNodes/Makefile.ph_build] Error 2

Hi,

Could you checkout the v12.2 branch and try it again?
Thanks.

I reinstalled everything and still got the same errors from the following Cuda samples.
NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit (github.com)

There is only one branch. Where can I find Cuda 12.2 samples ?

Thanks

Hi,

Sorry that v12.2 is a tag rather than a branch.
Please try the below command:

$ git clone https://github.com/NVIDIA/cuda-samples.git
$ cd cuda-samples
$ git checkout v12.2
$ make

Thanks.

It worked, Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.