NVlabs / NVBit

200 stars 18 forks source link

Instrumenting a specific kernel #23

Closed trinayan closed 3 years ago

trinayan commented 3 years ago

Thanks for making this really useful tool public. I want to know if it is possible to instrument a specific kernel of interest rather than a whole application. Or some mechanism in which the metrics can be collected kernel wise when a application has multiple kernels. Thank you.

x-y-z commented 3 years ago

You can use the function below to specify which kernel to instrument. The function is declared in core/nvbit.h.

/* Run instrumented on original function (and its related functions)
 * based on flag value */
void nvbit_enable_instrumented(CUcontext ctx, CUfunction func, bool flag,
                               bool apply_to_related = true);
trinayan commented 3 years ago

thanks for the info. Also applications that use internal libraries where the kernel names are mangled in nvprof output, do we have to insert the demangled kernel name in this function?

x-y-z commented 3 years ago

No. You only need to keep apply_to_related = true, which will enable instrumentation for functions called by this function.

trinayan commented 3 years ago

Thanks for the guidance. :)