Nvprof export to txt

Hello.
I have a project and i want the run it with deference numbers of threads etc.
I have a script to make all the combinations for profiler.
I want to know if i could export the results of nvprof to text file.
If dont… any other idea for that?

And something else…
Could i get only average value of --metrics achieved_occupancy?

Thanks to all.

Hi,

nvprof option --log-file <filename> can be used to redirect output to the specified file. Another option --csv can be used to generate the output in the comma-separated values format.

There is no switch in nvprof to generate just the average value of a metric, but see if --csv option makes it more convenient as you can do the filtering in the post processing step.
$nvprof --csv --metrics achieved_occupancy <application>

Thank you.
I used:
nvprof --log-file --metrics achieved_occupancy
nvprof --csv --log-file --metrics achieved_occupancy
nvprof --csv --metrics achieved_occupancy `
First and second syntax create a txt file with only nvprof info.
That is ok, but i would like to have only min, max, avg values.
Specifically avg.
The second command have not csv format.
The file is same like the first.

The third syntax did not create any file.

Hi

Can you please provide few details about the system:

  1. CUDA toolkit version
  2. OS
  3. GPU

I checked that --csv option works when I tried to profile the CUDA sample asyncAPI using CUDA 11.2 toolkit on a Windows machine.
>nvprof --csv --log-file profiler_output.txt --metrics achieved_occupancy asyncAPI.exe

profiler_output.txt:

==20772== NVPROF is profiling process 20772, command: asyncAPI.exe
==20772== Profiling application: asyncAPI.exe
==20772== Profiling result:
==20772== Metric result:
"Device","Kernel","Invocations","Metric Name","Metric Description","Min","Max","Avg"
"GeForce GTX 1050 (0)","increment_kernel(int*, int)",1,"achieved_occupancy","Achieved Occupancy",0.788937,0.788937,0.7889371

Third syntax - since no option was given to redirect the profiler output to any file, nvprof dumps output on the terminal.

cuda 11.2.0 460.89
win 10, 64bit, 20H2, 1902.804
GTX960

I have this output:

==5976== NVPROF is profiling process 5976, command: MonteCarloPiHitOrMiss.exe 4096 8192 32
==5976== Profiling application: MonteCarloPiHitOrMiss.exe 4096 8192 32
==5976== Profiling result:
==5976== Metric result:
“Device”,“Kernel”,“Invocations”,“Metric Name”,“Metric Description”,“Min”,“Max”,“Avg”
“GeForce GTX 960 (0)”,“GPGPUKernel(unsigned int, unsigned int, unsigned int*, curandStateXORWOW*)”,2,“achieved_occupancy”,“Achieved Occupancy”,0.246230,0.246250,0.246240

But this output dont have csv style format.

Thanks, I now see what issue you are pointing to. Except for the profiling meta data (lines with ==xxx==), rest of the profiling data is in the CSV format.

For this case, column names and the values are in the CSV format:

“Device”,“Kernel”,“Invocations”,“Metric Name”,“Metric Description”,“Min”,“Max”,“Avg”
“GeForce GTX 960 (0)”,“GPGPUKernel(unsigned int, unsigned int, unsigned int*, curandStateXORWOW*)”,2,“achieved_occupancy”,“Achieved Occupancy”,0.246230,0.246250,0.246240

ok.
Thank you for the answer.
I must delete this manual from the file,
or there is some parameter in nvprof to do this auto?

And something else…
Could i append others nvprof result in the same file?
I have a script to run app with many arguments in nvprof.

No, there is no option to remove the profiling meta data.

Option --log-file doesn’t support append operation. Pasting description from the help:

   --log-file <filename>
                    Make nvprof send all its output to the specified file, or
                    one of the standard channels. The file will be overwritten.
                    If the file doesn't exist, a new one will be created.
                            "%1" as the whole file name indicates standard output
                    channel (stdout).
                            "%2" as the whole file name indicates standard error
                    channel (stderr). Note: This is the default.
                            "%p" in the file name string is replaced with the
                    process ID of the application being profiled.
                            "%q{<ENV>}" in the file name string is replaced
                    with the value of the environment variable "<ENV>". If the
                    environment variable is not set it's an error.
                            "%h" in the file name string is replaced with the
                    hostname of the system.
                            "%%" in the file name is replaced with "%".
                            Any other character following "%" is illegal.

Thank you again.
This is bad for me.
Maybe in some newer version of nvprof like a feature?

ok.
Now i get in csv files some metrics.
Could i have in the some (or other file) in the same time the gpu-summary?

Now i get:
nvprof --csv --log-file $File1 --print-gpu-summary $exeFile
nvprof --csv --log-file $File2 --metrics achieved_occupancy $exeFile

I tried:
nvprof --csv --log-file $File --print-gpu-summary --metrics achieved_occupancy $exeFile
but write only the metrics.

Additional i tried:
nvprof --csv --log-file $File1 --print-gpu-summary --csv --log-file $File2 --metrics achieved_occupancy $exeFile
but didnt work.

Any idea?
Thanks.

when we open these csv files, data is in unreadable format. Do we need to use any other tool to open it? If so, please mention here.

Thank you