nvprof not picking up any API calls or kernels
<p>I'm trying to get some benchmark timings in my CUDA program with nvprof but unfortunately it doesn't seem to be profiling any API calls or kernels. I looked for a simple  beginners example to make sure I was doing it right and found one on the Nvidia dev blogs here:</p>

<p><a href="https://devblogs.nvidia.com/parallelforall/how-optimize-data-transfers-cuda-cc/" rel="nofollow">https://devblogs.nvidia.com/parallelforall/how-optimize-data-transfers-cuda-cc/</a></p>

<p>Code: </p>

<pre><code>int main()
{
    const unsigned int N = 1048576;
    const unsigned int bytes = N * sizeof(int);
    int *h_a = (int*)malloc(bytes);
    int *d_a;
    cudaMalloc((int**)&amp;d_a, bytes);

    memset(h_a, 0, bytes);
    cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice);
    cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost);

    return 0;
}
</code></pre>

<p>Command line:</p>

<pre><code>-bash-4.2$ nvcc profile.cu -o profile_test
-bash-4.2$ nvprof ./profile_test
</code></pre>

<p>So I replicated it word for word, line by line, and ran identical command line arguments. Unfortunately my result was the same:</p>

<pre><code>-bash-4.2$ nvprof ./profile_test
==85454== NVPROF is profiling process 85454, command: ./profile_test
==85454== Profiling application: ./profile_test
==85454== Profiling result:
No kernels were profiled.

==85454== API calls:
No API activities were profiled. 
</code></pre>

<p>I am running Nvidia toolkit 7.5</p>

<p>If anyone knows what what I'm doing wrong I'd be grateful to know the answer.</p>

<p>-----<em>EDIT</em>-----</p>

<p>So I modified the code to be</p>

<pre><code>#include&lt;cuda_profiler_api.h&gt;

int main()
{
    cudaProfilerStart();
    const unsigned int N = 1048576;
    const unsigned int bytes = N * sizeof(int);
    int *h_a = (int*)malloc(bytes);
    int *d_a;
    cudaMalloc((int**)&amp;d_a, bytes);

    memset(h_a, 0, bytes);
    cudaMemcpy(d_a, h_a, bytes, cudaMemcpyHostToDevice);
    cudaMemcpy(h_a, d_a, bytes, cudaMemcpyDeviceToHost);

    cudaProfilerStop();
    return 0;
}
</code></pre>

<p>Unfortunately it did not change things.</p>