CUDA Programming with GPUFlight: C++ Scope Tracing

A draft outline for the first CUDA programming article in the GPUFlight blog series.


This draft is a starting point for the C++ CUDA programming series.

Working Angle

  • Introduce the problem: CUDA kernels are fast, but the host-side story around launches, ranges, and training steps gets hard to see.
  • Show the smallest C++ program worth profiling.
  • Add GPUFlight initialization.
  • Add a GFL_SCOPE around one logical unit of work.
  • Capture a trace and explain what the reader should see.

C++ Sketch

#include <gpufl/gpufl.hpp>

int main() {
    // TODO: initialize GPUFlight for a trace session.

    {
        GFL_SCOPE("vector-add");
        // TODO: launch the CUDA kernel and synchronize.
    }

    // TODO: shut down GPUFlight and inspect the trace.
}

Notes To Fill In

  • Required CUDA Toolkit and GPUFlight setup.
  • What the scope means in the trace view.
  • When to use Trace, Monitor, Range Profiler, and PC Sampling.