Hi, I am using the following command to extract gpu-metrics with NSYS:
nsys profile --gpu-metrics-device=0 --stats=true -t cuda --force-overwrite true python my_python_file.py
I can see GPU Metrics on the GUI, but I want to extract the metrics from the command line itself and dump into some file/console. I can achieve this behavior with NCU by using something like this for the desired metric:
ncu --log-file “log” --page raw --print-metric-instances=values --metrics dram__bytes_read --target-processes all python my_python_file.py
How can I get the desired metric ( for eg., nvlrx__bytes.avg.pct_of_peak_sustained_elapsed ) using nsys and dump on console/log file?
–stats=true spits out a standard set of information, rather than all the information.
To get specific information you will want to run “nsys stats [stats script]” You have the option to generate the results in several different file formats. See User Guide — nsight-systems 2024.6 documentation (that is a direct link, no matter what the visible text is) for the available scripts and options.
If there isn’t an existing stats script to get you the information, they are shipped in the tool as python scripts and the schema is available in the documentation (or by using the .schema command). So you can alter an existing script to pull out the data that you need.
If you need help with that, please @jkreibich can help you.
@hwilper , Thanks for your response. I looked into the python scripts, but I think it doesnot serve the purpose. I want to have the exact values of metrics such as “nvlrx__bytes.avg.pct_of_peak_sustained_elapsed”, " dramc__read_throughput.avg.pct_of_peak_sustained_elapsed" etc. that for eg., comes under GPU_METRICS.
I tried to look into the GPU_METRICS table in the sqlite file generated (see attached pic), but not able to understand what the columns represent.
It would be great if you or @jkreibich can help me how to get the metrics value with nsys.
It might make more sense if you look at the schema of the table:
sqlite> .schema GPU_METRICS
CREATE TABLE GPU_METRICS (
-- GPU Metrics, events and values.
rawTimestamp INTEGER NOT NULL, -- Raw event timestamp recorded during profiling.
timestamp INTEGER NOT NULL, -- Event timestamp (ns).
typeId INTEGER NOT NULL, -- REFERENCES TARGET_INFO_GPU_METRICS(typeId) and GENERIC_EVENT_TYPES(typeId)
metricId INTEGER NOT NULL, -- REFERENCES TARGET_INFO_GPU_METRICS(metricId)
value INTEGER NOT NULL -- Counter data value
);
If you join this table to the TARGET_INFO_GPU_METRICS
table via the typeId
and metricId
columns, you should be able to see the event and metric names.