[Openmp-commits] [openmp] r336087 - [OMPT] Add tests for runtime entry points from non-OpenMP threads
Joachim Protze via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jul 2 02:13:34 PDT 2018
Author: jprotze
Date: Mon Jul 2 02:13:34 2018
New Revision: 336087
URL: http://llvm.org/viewvc/llvm-project?rev=336087&view=rev
Log:
[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
Modified:
openmp/trunk/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
Modified: openmp/trunk/runtime/test/ompt/misc/api_calls_from_other_thread.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/misc/api_calls_from_other_thread.cpp?rev=336087&r1=336086&r2=336087&view=diff
==============================================================================
--- openmp/trunk/runtime/test/ompt/misc/api_calls_from_other_thread.cpp (original)
+++ openmp/trunk/runtime/test/ompt/misc/api_calls_from_other_thread.cpp Mon Jul 2 02:13:34 2018
@@ -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;
}
More information about the Openmp-commits
mailing list