diff options
| author | Joachim Protze <protze@itc.rwth-aachen.de> | 2018-07-02 09:13:34 +0000 |
|---|---|---|
| committer | Joachim Protze <protze@itc.rwth-aachen.de> | 2018-07-02 09:13:34 +0000 |
| commit | e2eec57a4f3a49ec1f0c95c721228e936f7b5dfe (patch) | |
| tree | 5728657a8f45884c2ebd9ae8aad8b714d9dc4d42 | |
| parent | 28d2d708d43eac3896bc3b411d3e1905c225f74a (diff) | |
| download | bcm5719-llvm-e2eec57a4f3a49ec1f0c95c721228e936f7b5dfe.tar.gz bcm5719-llvm-e2eec57a4f3a49ec1f0c95c721228e936f7b5dfe.zip | |
[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
llvm-svn: 336087
| -rw-r--r-- | openmp/runtime/test/ompt/misc/api_calls_from_other_thread.cpp | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/openmp/runtime/test/ompt/misc/api_calls_from_other_thread.cpp b/openmp/runtime/test/ompt/misc/api_calls_from_other_thread.cpp index f14759f2726..470d7cdda10 100644 --- a/openmp/runtime/test/ompt/misc/api_calls_from_other_thread.cpp +++ b/openmp/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; } |

