What does Body and its subitems mean in some official section files?

I’m studying how Nsight Compute calculates Roofline Chart. So I check $CUDA_HOME/nsight-compute/sections/SpeedOfLight_RooflineChart.section. I understand all other header like Metrics, MetricDefinitions and so on, which can be found in Customization Guide.
However, I don’t understand what is the usage rule of Body which I don’t find anything in that documentation. For example, the subitem Rooflines is defined as follow:

      Rooflines {
        PeakWork {
          ValueCyclesPerSecondExpression {
            ValuePerCycleMetrics {
              Name: "derived__sm__sass_thread_inst_executed_op_ffma_pred_on_x2"
            }
            CyclesPerSecondMetric {
              Name: "sm__cycles_elapsed.avg.per_second"
            }
          }
        }
        PeakTraffic {
          ValueCyclesPerSecondExpression {
            ValuePerCycleMetrics {
              Name: "dram__bytes.sum.peak_sustained"
            }
            CyclesPerSecondMetric {
              Name: "dram__cycles_elapsed.avg.per_second"
            }
          }
        }
        Options {
          Label: "Single Precision Roofline"
        }
      }

It seems that PeakWork calculates throught(op/s) and PeakTraffic bandwith(B/s). The quotient of them seems to be the arithemtic intensity.
My question is how ncu command line knows it should divide PeakTraffic by PeakWork? The PeakWork, ValueCyclesPerSecondExpression, CyclesPerSecondMetric and so on seems undefined in that documentation I provide.

Hi, @viruxzheng

See below screenshot. The metric of peak work/traffic is defined in the body part.


@veraj Thanks for your replay! For Nsight-Compute or ncu, how does it know it should divide
sm__cycles_elpased.avg.per_second to derived__sm__sass_thread_inst_executed_op_ffma_pred_on_x2 to get the PeakWork metric? What if I want to define some metrics calculated from more complex expression, like log?

The roofline computations are intrinsic to the tool’s model, they are not captured in the section file. You cannot modify them, you can only modify the input metrics as they are listed in the section files. If you want to compute a custom model, I would recommend you use the Python Report Interface to access the metric data from a captured report in a custom Python script and do the plotting e.g. in jupyter notebooks, or similar. You can find related samples here. If you need it to be within the tool UI, you can implement something similar using the rule system, have it create a custom metric, and specify this metric as part of a roofline field or ProfilerSectionLineChart in a section file. However, I would recommend to do such customized post-processing outside the tool for better flexibility.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.