Class NvtxRange

java.lang.Object
ai.rapids.cudf.NvtxRange
All Implemented Interfaces:
AutoCloseable

public class NvtxRange extends Object implements AutoCloseable
This class supports push/pop NVTX profiling ranges, or "scoped" ranges. The constructor pushes an NVTX range and the close method pops off the most recent range that was pushed. Therefore instances of this class should always be used in a try-with-resources block to guarantee that ranges are always closed in the proper order. For example:
   try (NvtxRange a = new NvtxRange("a", NvtxColor.RED)) {
     ...
     try (NvtxRange b = new NvtxRange("b", NvtxColor.BLUE)) {
       ...
     }
     ...
   }
 
Instances should be associated with a single thread to avoid pushing an NVTX range in one thread and then trying to pop the range in a different thread. Push/pop ranges show a stacking behavior in tools such as Nsight, where newly pushed ranges are correlated and enclosed by the prior pushed range (in the example above, "b" is enclosed by "a").
  • Constructor Details

    • NvtxRange

      public NvtxRange(String name, NvtxColor color)
    • NvtxRange

      public NvtxRange(String name, int colorBits)
  • Method Details

    • pushRange

      public static void pushRange(String name, NvtxColor color)
    • popRange

      public static void popRange()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable