From 9621e3e11c03a30811ca1eaa91ee8a3bf554cf24 Mon Sep 17 00:00:00 2001
From: Thierry <thierry.gautier@inrialpes.fr>
Date: Tue, 12 May 2020 17:09:53 +0200
Subject: [PATCH] Update numbering parallel region

---
 tool/ompt_callbacks.cpp | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tool/ompt_callbacks.cpp b/tool/ompt_callbacks.cpp
index 6fbcdc2..6ad6bf8 100644
--- a/tool/ompt_callbacks.cpp
+++ b/tool/ompt_callbacks.cpp
@@ -80,6 +80,7 @@ static ompt_get_parallel_id_t ompt_get_parallel_id;
 #endif
 
 std::atomic<uint64_t> unique_thread_id(1);
+std::atomic<uint64_t> unique_parallel_id(1);
 
 typedef struct tikki_task_id_s {
   uint64_t id;
@@ -312,7 +313,8 @@ void ompt_callback_parallel_begin_action (
 )
 {
   ompt_data_t *thread_data = ompt_get_thread_data();
-  parallel_data->value = ompt_get_unique_id();
+  //parallel_data->value = ompt_get_unique_id();
+  parallel_data->value = unique_parallel_id++;
   uint64_t thread_id = thread_data->value;
   tikki_task_id_t *task = (tikki_task_id_t *)encountering_task_data->ptr;
 
@@ -403,7 +405,7 @@ ompt_callback_task_create_action(
   task->id = ompt_get_unique_id();
   task->task_ptr = codeptr_ra;
   task->ndeps = 0;
-#if LOG
+#if 1//LOG
   if (parent_task_data) {
     tikki_task_id_t *parent_task = (tikki_task_id_t*)parent_task_data->ptr;
     printf("%" PRIu64 ": ompt_task_create: parent_id=%" PRIu64 ", task_id=%" PRIu64\
@@ -523,16 +525,21 @@ ompt_callback_implicit_task_action (
     task->task_ptr = 0;
     task_data->ptr = task;
     task->ndeps = 0;
-#if LOG
+#if 1//LOG
     printf("%" PRIu64 ": ompt_event_implicit_task_action: begin. parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", thread_id, parallel_data->value, task->id);
 #endif
+ inew_task->task_ptr, new_task->id);
+    char buff[30];
+    sprintf(buff, "<%p>\0", 
+#endif
+
     kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id];
     kaapi_descrformat_t* fdescr = kaapi_tracelib_register_fmtdescr(
         1,
         //team->key, [> same key as the team. Not implicit task ? why ? [TG] <]
         (void *)task->id,
         //team->name,
-        "<implicit>",
+        buff,
         0,
         0          /* no filter: team name should be already well formed */
         );
@@ -605,6 +612,8 @@ ompt_callback_implicit_task_action (
 #endif
 }
 
+
+
 void
 ompt_callback_dependences_action (
     ompt_data_t *task_data,
@@ -623,6 +632,7 @@ ompt_callback_dependences_action (
 }
 
 
+
 void
 ompt_callback_task_dependence_action (
   ompt_data_t *src_task_data,
-- 
GitLab