aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Protze <protze@itc.rwth-aachen.de>2018-07-02 09:13:34 +0000
committerJoachim Protze <protze@itc.rwth-aachen.de>2018-07-02 09:13:34 +0000
commit5aaa641dc2ea0cf926502d31445fd038458fe2c2 (patch)
tree5f49906d814724fc9b62582b510a936abd9ae32c
parentc5d7f1d333b0607613da5d6c183da775675925ca (diff)
[OMPT] Add tests for runtime entry points from non-OpenMP threads
Several runtime entry points have not been tested from non-OpenMP threads. This adds tests to an existing testcase. While at it, the testcase was reformatted Patch provided by Simon Convent Differential Revision: https://reviews.llvm.org/D48124 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@336087 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--runtime/test/ompt/misc/api_calls_from_other_thread.cpp65
1 files changed, 53 insertions, 12 deletions
diff --git a/runtime/test/ompt/misc/api_calls_from_other_thread.cpp b/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
index f14759f..470d7cd 100644
--- a/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
+++ b/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
@@ -5,26 +5,54 @@
#include "callback.h"
void f() {
- ompt_data_t* tdata = ompt_get_thread_data();
- uint64_t tvalue = tdata ? tdata->value : 0;
+ ompt_data_t *tdata = ompt_get_thread_data();
+ uint64_t tvalue = tdata ? tdata->value : 0;
- printf("%" PRIu64 ": ompt_get_num_places()=%d\n", tvalue, ompt_get_num_places());
+ printf("%" PRIu64 ": ompt_get_num_places()=%d\n", tvalue,
+ ompt_get_num_places());
- printf("%" PRIu64 ": ompt_get_place_proc_ids()=%d\n", tvalue, ompt_get_place_proc_ids(0, 0, NULL));
+ printf("%" PRIu64 ": ompt_get_place_proc_ids()=%d\n", tvalue,
+ ompt_get_place_proc_ids(0, 0, NULL));
- printf("%" PRIu64 ": ompt_get_place_num()=%d\n", tvalue, ompt_get_place_num());
+ printf("%" PRIu64 ": ompt_get_place_num()=%d\n", tvalue,
+ ompt_get_place_num());
- printf("%" PRIu64 ": ompt_get_partition_place_nums()=%d\n", tvalue, ompt_get_partition_place_nums(0, NULL));
+ printf("%" PRIu64 ": ompt_get_partition_place_nums()=%d\n", tvalue,
+ ompt_get_partition_place_nums(0, NULL));
- printf("%" PRIu64 ": ompt_get_proc_id()=%d\n", tvalue, ompt_get_proc_id());
+ printf("%" PRIu64 ": ompt_get_proc_id()=%d\n", tvalue, ompt_get_proc_id());
- printf("%" PRIu64 ": ompt_get_num_procs()=%d\n", tvalue, ompt_get_num_procs());
-}
+ printf("%" PRIu64 ": ompt_get_num_procs()=%d\n", tvalue,
+ ompt_get_num_procs());
+
+ ompt_callback_t callback;
+ printf("%" PRIu64 ": ompt_get_callback()=%d\n", tvalue,
+ ompt_get_callback(ompt_callback_thread_begin, &callback));
+
+ printf("%" PRIu64 ": ompt_get_state()=%d\n", tvalue, ompt_get_state(NULL));
+
+ int state = omp_state_undefined;
+ const char *state_name;
+ printf("%" PRIu64 ": ompt_enumerate_states()=%d\n", tvalue,
+ ompt_enumerate_states(state, &state, &state_name));
+
+ int impl = ompt_mutex_impl_unknown;
+ const char *impl_name;
+ printf("%" PRIu64 ": ompt_enumerate_mutex_impls()=%d\n", tvalue,
+ ompt_enumerate_mutex_impls(impl, &impl, &impl_name));
+
+ printf("%" PRIu64 ": ompt_get_thread_data()=%p\n", tvalue,
+ ompt_get_thread_data());
+
+ printf("%" PRIu64 ": ompt_get_parallel_info()=%d\n", tvalue,
+ ompt_get_parallel_info(0, NULL, NULL));
+ printf("%" PRIu64 ": ompt_get_task_info()=%d\n", tvalue,
+ ompt_get_task_info(0, NULL, NULL, NULL, NULL, NULL));
+}
-int main()
-{
- #pragma omp parallel num_threads(1)
+int main() {
+#pragma omp parallel num_threads(1)
{}
std::thread t1(f);
@@ -46,6 +74,19 @@ int main()
// CHECK: {{^}}[[MASTER_ID]]: ompt_get_num_procs()={{[0-9]+}}
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_callback()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_state()=0
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_enumerate_states()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_enumerate_mutex_impls()=1
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_thread_data()=[[NULL]]
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_parallel_info()=0
+
+ // CHECK: {{^}}[[MASTER_ID]]: ompt_get_task_info()=0
return 0;
}