summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test
diff options
context:
space:
mode:
authorJoachim Protze <protze@itc.rwth-aachen.de>2017-11-03 17:09:00 +0000
committerJoachim Protze <protze@itc.rwth-aachen.de>2017-11-03 17:09:00 +0000
commit924cff0a3988975996bd5808d3b64e320ee73c84 (patch)
tree5edc1962bf09dd928fb534aa288d7c7b0c525c96 /openmp/runtime/test
parent741572593f56d054dcd01118960ace51b6f27b71 (diff)
downloadbcm5719-llvm-924cff0a3988975996bd5808d3b64e320ee73c84.tar.gz
bcm5719-llvm-924cff0a3988975996bd5808d3b64e320ee73c84.zip
Updating implementation of OMPT as specified in OpenMP 5.0 Preview 2 (TR6)
The TR6 document is expected to be publically released around November 15. This patch does not implement OMPT for libomptarget. Patch by Simon Convent and Joachim Protze Differential Revision: https://reviews.llvm.org/D39182 llvm-svn: 317339
Diffstat (limited to 'openmp/runtime/test')
-rw-r--r--openmp/runtime/test/lock/omp_init_lock.c42
-rwxr-xr-xopenmp/runtime/test/ompt/callback.h32
-rw-r--r--openmp/runtime/test/ompt/cancel/cancel_parallel.c2
-rw-r--r--openmp/runtime/test/ompt/cancel/cancel_worksharing.c4
-rw-r--r--openmp/runtime/test/ompt/loadtool/tool_available.c10
-rw-r--r--openmp/runtime/test/ompt/ompt-signal.h11
-rw-r--r--openmp/runtime/test/ompt/tasks/dependences.c2
7 files changed, 27 insertions, 76 deletions
diff --git a/openmp/runtime/test/lock/omp_init_lock.c b/openmp/runtime/test/lock/omp_init_lock.c
deleted file mode 100644
index 24b60d1ab6b..00000000000
--- a/openmp/runtime/test/lock/omp_init_lock.c
+++ /dev/null
@@ -1,42 +0,0 @@
-// RUN: %libomp-compile-and-run
-#include "omp_testsuite.h"
-#include <stdio.h>
-
-// This should be slightly less than KMP_I_LOCK_CHUNK, which is 1024
-#define LOCKS_PER_ITER 1000
-#define ITERATIONS (REPETITIONS + 1)
-
-// This tests concurrently using locks on one thread while initializing new
-// ones on another thread. This exercises the global lock pool.
-int test_omp_init_lock() {
- int i;
- omp_lock_t lcks[ITERATIONS * LOCKS_PER_ITER];
-#pragma omp parallel for schedule(static) num_threads(NUM_TASKS)
- for (i = 0; i < ITERATIONS; i++) {
- int j;
- omp_lock_t *my_lcks = &lcks[i * LOCKS_PER_ITER];
- for (j = 0; j < LOCKS_PER_ITER; j++) {
- omp_init_lock(&my_lcks[j]);
- }
- for (j = 0; j < LOCKS_PER_ITER * 100; j++) {
- omp_set_lock(&my_lcks[j % LOCKS_PER_ITER]);
- omp_unset_lock(&my_lcks[j % LOCKS_PER_ITER]);
- }
- }
- // Wait until all repititions are done. The test is exercising growth of
- // the global lock pool, which does not shrink when no locks are allocated.
- {
- int j;
- for (j = 0; j < ITERATIONS * LOCKS_PER_ITER; j++) {
- omp_destroy_lock(&lcks[j]);
- }
- }
-
- return 0;
-}
-
-int main() {
- // No use repeating this test, since it's exercising a private global pool
- // which is not reset between test iterations.
- return test_omp_init_lock();
-}
diff --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h
index 69efd8305fe..56d763afbf9 100755
--- a/openmp/runtime/test/ompt/callback.h
+++ b/openmp/runtime/test/ompt/callback.h
@@ -477,8 +477,8 @@ on_ompt_callback_master(
static void
on_ompt_callback_parallel_begin(
- ompt_data_t *parent_task_data,
- const ompt_frame_t *parent_task_frame,
+ ompt_data_t *encountering_task_data,
+ const ompt_frame_t *encountering_task_frame,
ompt_data_t* parallel_data,
uint32_t requested_team_size,
ompt_invoker_t invoker,
@@ -487,27 +487,27 @@ on_ompt_callback_parallel_begin(
if(parallel_data->ptr)
printf("%s\n", "0: parallel_data initially not null");
parallel_data->value = ompt_get_unique_id();
- printf("%" PRIu64 ": ompt_event_parallel_begin: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, parallel_id=%" PRIu64 ", requested_team_size=%" PRIu32 ", codeptr_ra=%p, invoker=%d\n", ompt_get_thread_data()->value, parent_task_data->value, parent_task_frame->exit_frame, parent_task_frame->enter_frame, parallel_data->value, requested_team_size, codeptr_ra, invoker);
+ printf("%" PRIu64 ": ompt_event_parallel_begin: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, parallel_id=%" PRIu64 ", requested_team_size=%" PRIu32 ", codeptr_ra=%p, invoker=%d\n", ompt_get_thread_data()->value, encountering_task_data->value, encountering_task_frame->exit_frame, encountering_task_frame->enter_frame, parallel_data->value, requested_team_size, codeptr_ra, invoker);
}
static void
on_ompt_callback_parallel_end(
ompt_data_t *parallel_data,
- ompt_data_t *task_data,
+ ompt_data_t *encountering_task_data,
ompt_invoker_t invoker,
const void *codeptr_ra)
{
- printf("%" PRIu64 ": ompt_event_parallel_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", invoker=%d, codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, invoker, codeptr_ra);
+ printf("%" PRIu64 ": ompt_event_parallel_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", invoker=%d, codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, encountering_task_data->value, invoker, codeptr_ra);
}
static void
on_ompt_callback_task_create(
- ompt_data_t *parent_task_data, /* id of parent task */
- const ompt_frame_t *parent_frame, /* frame data for parent task */
- ompt_data_t* new_task_data, /* id of created task */
+ ompt_data_t *encountering_task_data,
+ const ompt_frame_t *encountering_task_frame,
+ ompt_data_t* new_task_data,
int type,
int has_dependences,
- const void *codeptr_ra) /* pointer to outlined function */
+ const void *codeptr_ra)
{
if(new_task_data->ptr)
printf("%s\n", "0: new_task_data initially not null");
@@ -516,7 +516,7 @@ on_ompt_callback_task_create(
format_task_type(type, buffer);
- //there is no paralllel_begin callback for implicit parallel region
+ //there is no parallel_begin callback for implicit parallel region
//thus it is initialized in initial task
if(type & ompt_task_initial)
{
@@ -527,7 +527,7 @@ on_ompt_callback_task_create(
parallel_data->value = ompt_get_unique_id();
}
- printf("%" PRIu64 ": ompt_event_task_create: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, new_task_id=%" PRIu64 ", codeptr_ra=%p, task_type=%s=%d, has_dependences=%s\n", ompt_get_thread_data()->value, parent_task_data ? parent_task_data->value : 0, parent_frame ? parent_frame->exit_frame : NULL, parent_frame ? parent_frame->enter_frame : NULL, new_task_data->value, codeptr_ra, buffer, type, has_dependences ? "yes" : "no");
+ printf("%" PRIu64 ": ompt_event_task_create: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, new_task_id=%" PRIu64 ", codeptr_ra=%p, task_type=%s=%d, has_dependences=%s\n", ompt_get_thread_data()->value, encountering_task_data ? encountering_task_data->value : 0, encountering_task_frame ? encountering_task_frame->exit_frame : NULL, encountering_task_frame ? encountering_task_frame->enter_frame : NULL, new_task_data->value, codeptr_ra, buffer, type, has_dependences ? "yes" : "no");
}
static void
@@ -603,7 +603,7 @@ do{ \
int ompt_initialize(
ompt_function_lookup_t lookup,
- ompt_fns_t* fns)
+ ompt_data_t *tool_data)
{
ompt_set_callback = (ompt_set_callback_t) lookup("ompt_set_callback");
ompt_get_task_info = (ompt_get_task_info_t) lookup("ompt_get_task_info");
@@ -646,15 +646,15 @@ int ompt_initialize(
return 1; //success
}
-void ompt_finalize(ompt_fns_t* fns)
+void ompt_finalize(ompt_data_t *tool_data)
{
printf("0: ompt_event_runtime_shutdown\n");
}
-ompt_fns_t* ompt_start_tool(
+ompt_start_tool_result_t* ompt_start_tool(
unsigned int omp_version,
const char *runtime_version)
{
- static ompt_fns_t ompt_fns = {&ompt_initialize,&ompt_finalize};
- return &ompt_fns;
+ static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
+ return &ompt_start_tool_result;
}
diff --git a/openmp/runtime/test/ompt/cancel/cancel_parallel.c b/openmp/runtime/test/ompt/cancel/cancel_parallel.c
index a37480107e7..7339989e45f 100644
--- a/openmp/runtime/test/ompt/cancel/cancel_parallel.c
+++ b/openmp/runtime/test/ompt/cancel/cancel_parallel.c
@@ -18,7 +18,7 @@ int main()
}
else
{
- delay(100);
+ usleep(100);
printf("%" PRIu64 ": fuzzy_address=0x%lx or 0x%lx\n", ompt_get_thread_data()->value, ((uint64_t)(char*)(&& ompt_label_2))/256-1, ((uint64_t)(char*)(&& ompt_label_2))/256);
#pragma omp cancellation point parallel
print_fuzzy_address(2); //does not actually print the address but provides a label
diff --git a/openmp/runtime/test/ompt/cancel/cancel_worksharing.c b/openmp/runtime/test/ompt/cancel/cancel_worksharing.c
index 41073362a3a..9e0889a325a 100644
--- a/openmp/runtime/test/ompt/cancel/cancel_worksharing.c
+++ b/openmp/runtime/test/ompt/cancel/cancel_worksharing.c
@@ -27,7 +27,7 @@ int main()
{
x++;
OMPT_WAIT(condition,1);
- delay(10000);
+ usleep(10000);
#pragma omp cancellation point for
}
}
@@ -44,7 +44,7 @@ int main()
#pragma omp section
{
OMPT_WAIT(condition,2);
- delay(10000);
+ usleep(10000);
#pragma omp cancellation point sections
}
}
diff --git a/openmp/runtime/test/ompt/loadtool/tool_available.c b/openmp/runtime/test/ompt/loadtool/tool_available.c
index 0205193176e..22fdadeeda7 100644
--- a/openmp/runtime/test/ompt/loadtool/tool_available.c
+++ b/openmp/runtime/test/ompt/loadtool/tool_available.c
@@ -38,22 +38,22 @@ int main()
int ompt_initialize(
ompt_function_lookup_t lookup,
- ompt_fns_t* fns)
+ ompt_data_t* tool_data)
{
printf("0: NULL_POINTER=%p\n", (void*)NULL);
return 1; //success
}
-void ompt_finalize(ompt_fns_t* fns)
+void ompt_finalize(ompt_data_t* tool_data)
{
printf("%d: ompt_event_runtime_shutdown\n", omp_get_thread_num());
}
-ompt_fns_t* ompt_start_tool(
+ompt_start_tool_result_t* ompt_start_tool(
unsigned int omp_version,
const char *runtime_version)
{
- static ompt_fns_t ompt_fns = {&ompt_initialize,&ompt_finalize};
- return &ompt_fns;
+ static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
+ return &ompt_start_tool_result;
}
#endif /* TOOL */
diff --git a/openmp/runtime/test/ompt/ompt-signal.h b/openmp/runtime/test/ompt/ompt-signal.h
index b5c28cf5dee..76e49ba4517 100644
--- a/openmp/runtime/test/ompt/ompt-signal.h
+++ b/openmp/runtime/test/ompt/ompt-signal.h
@@ -1,13 +1,6 @@
-#if defined(WIN32) || defined(_WIN32)
-#include <windows.h>
-#define delay() Sleep(1);
-#else
-#include <unistd.h>
-#define delay(t) usleep(t);
-#endif
-
// These functions are used to provide a signal-wait mechanism to enforce expected scheduling for the test cases.
// Conditional variable (s) needs to be shared! Initialize to 0
+#include <unistd.h>
#define OMPT_SIGNAL(s) ompt_signal(&s)
//inline
@@ -24,7 +17,7 @@ void ompt_wait(int *s, int v)
{
int wait=0;
do{
- delay(10);
+ usleep(10);
#pragma omp atomic read
wait = (*s);
}while(wait<v);
diff --git a/openmp/runtime/test/ompt/tasks/dependences.c b/openmp/runtime/test/ompt/tasks/dependences.c
index 32817c4e2dd..fa1b984cc17 100644
--- a/openmp/runtime/test/ompt/tasks/dependences.c
+++ b/openmp/runtime/test/ompt/tasks/dependences.c
@@ -16,7 +16,7 @@ int main()
#pragma omp task depend(out:x)
{
x++;
- delay(100);
+ usleep(100);
}
print_fuzzy_address(1);
OpenPOWER on IntegriCloud