Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.35 KB

README.md

File metadata and controls

43 lines (31 loc) · 1.35 KB

README for mynvtx.h

Overview

mynvtx.h is a convenience header that simplifies the process of pushing and popping NVTX ranges with custom colors, for profiling in Nvidia Nsight system.

It provides two functions, mynvtxRangePushand mynvtxRangePop which corresponds to nvtx's nvtxRangePush and nvtxRangePop with a less verbose, easier to use color argument as well as cross-backend compilation compatibility.

An example of use of this header to monitor Kokkos functions can be found there: https://gitlab.com/rbourgeois1/some_timings_kokkos

Usage Example

#include "mynvtx.h"
void myFunction() {
    // Push a red-colored range with the message "myOperation"
    // Default color is black
    mynvtxRangePush("my region name", "red");
    
    // ... your code here ...
    
    // Pop the range after your code segment completes
    mynvtxRangePop();
}

The input can be both const char * or std::string:

#include "mynvtx.h"
void myFunction() {
    std::string some_name=name_generator(...)
    std::string some_color=color_generator(...)
    mynvtxRangePush(some_name, some_color);
    
    // ... your code here ...
    
    // Pop the range after your code segment completes
    mynvtxRangePop();
}

Portability

If no cuda compiler is detected, the provided function will do nothing. This allows compilation on non-cuda backend