[Openmp-commits] [PATCH] D41942: [OMPT] Add interoperability testcase

Simon Convent via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 14 02:54:45 PST 2018


sconvent updated this revision to Diff 134182.
sconvent added a comment.

Implemented suggestions


https://reviews.llvm.org/D41942

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


Index: runtime/test/ompt/misc/interoperability.cpp
===================================================================
--- /dev/null
+++ runtime/test/ompt/misc/interoperability.cpp
@@ -0,0 +1,51 @@
+// RUN: %libomp-cxx-compile-and-run | %sort-threads | FileCheck %s
+// REQUIRES: ompt
+
+#include <iostream>
+#include <thread>
+#include "callback.h"
+int condition=0;
+void f() {
+    OMPT_SIGNAL(condition);
+    // wait for both pthreads to arrive
+    OMPT_WAIT(condition,2);
+    int i=0;
+    #pragma omp parallel num_threads(2)
+    {
+    OMPT_SIGNAL(condition);
+    OMPT_WAIT(condition,6);
+    }
+}
+int main() {
+    std::thread t1(f);
+    std::thread t2(f);
+    t1.join();
+    t2.join();
+}
+
+  // Check if libomp supports the callbacks for this test.
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
+  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'
+
+  // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
+  // CHECK: {{^}}[[MASTER_ID_1:[0-9]+]]: ompt_event_thread_begin: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID_1]]
+  // CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_task_create: parent_task_id=0, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id=[[PARENT_TASK_ID_1:[0-9]+]], codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no
+  // CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID_1]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID_1:[0-9]+]], requested_team_size=2, codeptr_ra=0x{{[0-f]+}}, invoker={{.*}}
+  // CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID_1]], task_id=[[PARENT_TASK_ID_1]], invoker={{[0-9]+}}
+  // CHECK: {{^}}[[MASTER_ID_1]]: ompt_event_thread_end: thread_id=[[MASTER_ID_1]]
+
+  // CHECK: {{^}}[[MASTER_ID_2:[0-9]+]]: ompt_event_thread_begin: thread_type=ompt_thread_initial=1, thread_id=[[MASTER_ID_2]]
+  // CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_task_create: parent_task_id=0, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id=[[PARENT_TASK_ID_2:[0-9]+]], codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no
+  // CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID_2]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID_2:[0-9]+]], requested_team_size=2, codeptr_ra=0x{{[0-f]+}}, invoker={{.*}}
+  // CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID_2]], task_id=[[PARENT_TASK_ID_2]], invoker={{[0-9]+}}
+  // CHECK: {{^}}[[MASTER_ID_2]]: ompt_event_thread_end: thread_id=[[MASTER_ID_2]]
+
+  // CHECK: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_thread_begin: thread_type=ompt_thread_worker=2, thread_id=[[THREAD_ID_1]]
+  // CHECK: {{^}}[[THREAD_ID_1]]: ompt_event_thread_end: thread_id=[[THREAD_ID_1]]
+
+  // CHECK: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_thread_begin: thread_type=ompt_thread_worker=2, thread_id=[[THREAD_ID_2]]
+  // CHECK: {{^}}[[THREAD_ID_2]]: ompt_event_thread_end: thread_id=[[THREAD_ID_2]]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41942.134182.patch
Type: text/x-patch
Size: 3552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180214/3f5d6559/attachment.bin>


More information about the Openmp-commits mailing list