I'm trying to use nvvp to profile opencl kernels.
I'm running ubuntu 12.04 64b with a GTX 580 and have verified the CUDA toolkit is working fine (i can run and profile cuda code).
When  trying to debug my opencl code i get:
Warning: No CUDA application was profiled, exiting
Any hints?
 
    
    - 2,724
- 5
- 30
- 38
- 
                    Possible duplicate of [Is there a way to profile an OpenCL or a pyOpenCL program?](http://stackoverflow.com/questions/29068229/is-there-a-way-to-profile-an-opencl-or-a-pyopencl-program) – Dschoni Feb 17 '16 at 13:21
- 
                    See my answer on http://stackoverflow.com/questions/29068229/is-there-a-way-to-profile-an-opencl-or-a-pyopencl-program/35016313#35016313 – Dschoni Feb 17 '16 at 13:22
2 Answers
Nvidia's visual profiler (nvvp) can be used to profile OpenCL programs, but it is more of a pain than profiling in CUDA directly.
Simon McIntosh's High Performance Computing group over at the University of Bristol came up with the original solution (here), and I can verify it works.
I'll summarise the basics:
- Firstly, the environment variable COMPUTE_PROFILE must be set, this is done with COMPUTE_PROFILE=1
- Secondly a - COMPUTE_PROFILE_CONFIGmust be provided, a sample I use (called nvvp.cfg) contains:- profilelogformat CSV streamid gpustarttimestamp gpuendtimestamp
- Next to perform the actual profiling, in this case I'll profile an OpenCL application called HuffFramework, using: - COMPUTE_PROFILE=1 COMPUTE_PROFILE_CONFIG=nvvp.cfg ./HuffFramework
- This then generates a series of opencl_profile_*.log files, where * is the number of threads. 
- These log files can't be loaded by nvvp just yet as all kernel function symbols have a leading - OPENCL_instead of an expected- CUDA_, thus replace these symbols with a quick script like so:- sed 's/OPENCL_/CUDA_/g' opencl_profile_0.log > cuda_profile_0.log
- Finally cuda_profile_0.log can now be imported by nvvp, by starting nvvp and going File->Import...->Command-line Profiler, point it to cuda_profile_0.log and preso! 
 
    
    - 116
- 1
- 4
- 
                    As sad as it makes me this answer only works below CUDA version 7.5 – Dávid Tóth Jul 25 '22 at 06:00
nvvp can only profile CUDA applications.
 
    
    - 9,242
- 2
- 30
- 29
- 
                    I feared as much, although i can find no mention of this anywhere in NVidia's documentation... Is there an alternative? – Emanuel Ey Aug 23 '12 at 15:55
- 
                    1Although it is still an under development project, you can obtain a timeline view of your OpenCL application using LTPV: http://code.google.com/p/ltpv/ – simon.denel Sep 06 '13 at 12:11
- 
                    Actually, this is not 100% true. http://uob-hpc.github.io/2015/05/27/nvvp-import-opencl/ – Dschoni Feb 17 '16 at 13:20
- 
                    It's now here: http://uob-hpc.github.io/2015/05/27/nvvp-import-opencl.html – Lars Oct 19 '17 at 10:15
