======== Warning: No profile data collected. nvprof not working when compiling

I try to compile simple Jacobi Iteration c code on Google colab. I use nvprof for compiling using GPU. It is not profiling and shows the same results without using GPU with “Warning: No profile data collected.”. Please anyone could advise

I use nvprof for compiling using GPU

I assuming you mean profiling? nvprof can’t be used for compiling.

It sounds like you didn’t compile the code to offload to the GPU so the binary isn’t running on the GPU and hence no profile. Though, this is just a guess. What compiler and flags are you using? Are you using OpenACC? CUDA? OpenMP?

Exactly I use nvprof for profiling and nvcc for compiling, I am using CUDA toolkit version 11.3.58 below is the code I used and the compiler. (Note: I use google colab runtime on GPU)

%%writefile task2.c

#include <math.h>

#include <string.h>

#include <openacc.h>

#include <stdio.h>

#include “timer.h”

#define NN 1024

#define NM 1024

double A[NN][NM];

double Anew[NN][NM];

int main(int argc, char** argv)


const int n = NN;

const int m = NM;

const int iter_max = 1000;

const double tol = 1.0e-6;

double error     = 1.0;

memset(A, 0, n * m * sizeof(double));

memset(Anew, 0, n * m * sizeof(double));


for (int j = 0; j < n; j++)


    A[j][0]    = 1.0;

    Anew[j][0] = 1.0;


printf("Jacobi relaxation Calculation: %d x %d mesh\n", n, m);


int iter = 0;

#pragma acc data copy(A[:n][:m]) create(Anew[:n][:m])

while ( error > tol && iter < iter_max )


    error = 0.0;

#pragma acc parallel loop reduction(max:error)

    for( int j = 1; j < n-1; j++)


        for( int i = 1; i < m-1; i++ )


            Anew[j][i] = 0.25 * ( A[j][i+1] + A[j][i-1]

                                + A[j-1][i] + A[j+1][i]);

            error = fmax( error, fabs(Anew[j][i] - A[j][i]));



#pragma acc parallel loop

    for( int j = 1; j < n-1; j++)


        for( int i = 1; i < m-1; i++ )


            A[j][i] = Anew[j][i];    



    if(iter % 100 == 0) printf("%5d, %0.6f\n", iter, error);




double runtime = GetTimer();

printf(" total: %f s\n", runtime / 1000);

return 0;


!nvcc -o task2 task2.c

!nvprof ./task2

Jacobi relaxation Calculation: 1024 x 1024 mesh
0, 0.250000
100, 0.002397
200, 0.001204
300, 0.000804
400, 0.000603
500, 0.000483
600, 0.000403
700, 0.000345
800, 0.000302
900, 0.000269
total: 12.514867 s
======== Warning: No profile data collected.

NVCC is the CUDA C++ compiler. For OpenACC, you’ll want to use the C compiler, “nvc”, with the “-acc” flag to enable OpenACC.

!nvc -acc -Minfo=accel -o task2 task2.c


Thanks for your support. I tried Mat it is not compiling. generating error

/bin/bash: nvc: command not found.

“nvc” is included as part of the NVIDIA HPC SDK: High Performance Computing (HPC) SDK | NVIDIA

Does Google Colab have the NVIDIA HPC SDK installed? I’ve never used Colabs myself so don’t know what they have available.

No, it hasn’t; that’s why I installed NVIDIA HPC SDK 21.3 at Google Colab before running and still generating the same error.

Do you have the compiler bin directory in your environment’s PATH?

Yes, everything I installed in Google Colab is in environment’s PATH.

Ok, though the only reasons I know of as to why you’d get a “command not found” error is if the NV HPC SDK isn’t installed or not in your PATH.

I’ve never used Colabs so you’ll need to investigate what’s causing this.

Sure, I will thank you for your help and support.