From 8d000b818f7f87292a258397b56ebfb69cdf14e3 Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Tue, 15 Apr 2025 17:45:43 +0200
Subject: [PATCH] Use NVTX profiler in cfrfme.cpp

---
 src/trapping/cfrfme.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/trapping/cfrfme.cpp b/src/trapping/cfrfme.cpp
index d2c19f3c..9415909a 100644
--- a/src/trapping/cfrfme.cpp
+++ b/src/trapping/cfrfme.cpp
@@ -56,6 +56,10 @@
 #include "../include/tra_subs.h"
 #endif
 
+#ifdef USE_NVTX
+#include <nvtx3/nvToolsExt.h>
+#endif
+
 using namespace std;
 
 /*! \brief C++ implementation of FRFME
@@ -64,6 +68,9 @@ using namespace std;
  *  \param output_path: `string` Directory to write the output files in.
  */
 void frfme(string data_file, string output_path) {
+#ifdef USE_NVTX
+  nvtxRangePush("Running frfme()");
+#endif
   string tfrfme_name = output_path + "/c_TFRFME.hd5";
   TFRFME *tfrfme = NULL;
   Swap1 *tt1 = NULL;
@@ -410,4 +417,7 @@ void frfme(string data_file, string output_path) {
   if (wk != NULL) delete[] wk;
   if (tt1 != NULL) delete tt1;
   printf("FRFME: Done.\n");
+#ifdef USE_NVTX
+  nvtxRangePop();
+#endif
 }
-- 
GitLab