Post

Getting started with CUDA

First example I used was the even easier introduction to CUDA blog post. First thing that did not quite work is the call to nvprof:

1
2
3
4
5
6
7
8
9
$ nvprof ./add_cuda
==7511== NVPROF is profiling process 7511, command: ./add_cuda
Max error: 0
==7511== Profiling application: ./add_cuda
==7511== Profiling result:
No kernels were profiled.
No API activities were profiled.
==7511== Warning: Some profiling data are not recorded. Make sure cudaProfilerStop() or cuProfilerStop() is called before application exit to flush profile data.
======== Error: Application received signal 11

"Signal 11" is SIGSEGV (segmentation fault). I did some web search to find out that I need to add an option for nvprof to work: $ nvprof --unified-memory-profiling off ./add_cuda

But why doesn’t it work like in the example? Because NVidia profiler is deprecated since the Volta GPU generation, which is the last to still support it.

So the call failed but it’s also not supported any more. I tried using the replacement nsys instead. Turns out you need to install NsightSystems first. To do so, register at https://developer.nvidia.com/ and go to the Download section. After installation, run from the console:

1
$ nsys nvprof ./add_cuda

So, that works fine and I was able to finish the excercise.

The Cuda-10 manual also mentions that “Nvidia Nsight Eclipse Edition” is going to be removed by the next release, so Cuda-11 and newer only come with the Nvidia Nsight Eclipse plug-ins. /usr/local/cuda-xyz/doc/pdf/Nsight_Eclipse_Plugins_Installation_Guide.pdf explains how to install them into an existing Eclipse. cuda-10.0 Nsight Eclipse plug-ins were compatible with the newest Eclipse version as of the time of writing this (2020.12).

This post is licensed under CC BY-ND 4.0 by the author.