[Openmp-commits] [PATCH] D43882: [OMPT] Fix interoperability test with GCC

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 1 06:05:42 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rOMP326435: [OMPT] Fix interoperability test with GCC (authored by Hahnfeld, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43882?vs=136330&id=136506#toc

Repository:
  rOMP OpenMP

https://reviews.llvm.org/D43882

Files:
  runtime/test/ompt/misc/interoperability.cpp


Index: runtime/test/ompt/misc/interoperability.cpp
===================================================================
--- runtime/test/ompt/misc/interoperability.cpp
+++ runtime/test/ompt/misc/interoperability.cpp
@@ -3,19 +3,31 @@
 
 #include <iostream>
 #include <thread>
+
 #include "callback.h"
+#include "omp.h"
+
 int condition = 0;
+
 void f() {
+  // Call OpenMP API function to force initialization of OMPT.
+  // (omp_get_thread_num() does not work because it just returns 0 if the
+  // runtime isn't initialized yet...)
+  omp_get_num_threads();
+
   OMPT_SIGNAL(condition);
-  // wait for both pthreads to arrive
+  // Wait for both initial threads to arrive that will eventually become the
+  // master threads in the following parallel region.
   OMPT_WAIT(condition, 2);
-  int i = 0;
+
 #pragma omp parallel num_threads(2)
   {
+    // Wait for all threads to arrive so that no worker thread can be reused...
     OMPT_SIGNAL(condition);
     OMPT_WAIT(condition, 6);
   }
 }
+
 int main() {
   std::thread t1(f);
   std::thread t2(f);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43882.136506.patch
Type: text/x-patch
Size: 1054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180301/91e22343/attachment.bin>


More information about the Openmp-commits mailing list