Index: openmp/runtime/src/kmp_settings.cpp =================================================================== --- openmp/runtime/src/kmp_settings.cpp +++ openmp/runtime/src/kmp_settings.cpp @@ -4695,6 +4695,27 @@ } } // __kmp_stg_print_omp_tool_libraries +static char *__kmp_tool_verbose_init = NULL; + +static void __kmp_stg_parse_omp_tool_verbose_init(char const *name, + char const *value, void *data) { + __kmp_stg_parse_str(name, value, &__kmp_tool_verbose_init); +} // __kmp_stg_parse_omp_tool_libraries + +static void __kmp_stg_print_omp_tool_verbose_init(kmp_str_buf_t *buffer, + char const *name, void *data) { + if (__kmp_tool_verbose_init) + __kmp_stg_print_str(buffer, name, __kmp_tool_libraries); + else { + if (__kmp_env_format) { + KMP_STR_BUF_PRINT_NAME; + } else { + __kmp_str_buf_print(buffer, " %s", name); + } + __kmp_str_buf_print(buffer, ": %s\n", KMP_I18N_STR(NotDefined)); + } +} // __kmp_stg_print_omp_tool_verbose_init + #endif // Table. @@ -4937,6 +4958,8 @@ 0}, {"OMP_TOOL_LIBRARIES", __kmp_stg_parse_omp_tool_libraries, __kmp_stg_print_omp_tool_libraries, NULL, 0, 0}, + {"OMP_TOOL_VERBOSE_INIT", __kmp_stg_parse_omp_tool_verbose_init, + __kmp_stg_print_omp_tool_verbose_init, NULL, 0, 0}, #endif {"", NULL, NULL, NULL, 0, 0}}; // settings Index: openmp/runtime/src/ompt-general.cpp =================================================================== --- openmp/runtime/src/ompt-general.cpp +++ openmp/runtime/src/ompt-general.cpp @@ -45,6 +45,20 @@ #define OMPT_STR_MATCH(haystack, needle) (!strcasecmp(haystack, needle)) #endif +// prints for an enabled OMP_TOOL_VERBOSE_INIT. +// In the future a prefix could be added in the first define, the second define +// omits the prefix to allow for continued lines. Example: "PREFIX: Start +// tool... Success." instead of "PREFIX: Start tool... PREFIX: Success." +#define OMPT_VERBOSE_INIT_PRINT(...) \ + if (verbose_init) \ + fprintf(verbose_file, __VA_ARGS__) +#define OMPT_VERBOSE_INIT_CONTINUED_PRINT(...) \ + if (verbose_init) \ + fprintf(verbose_file, __VA_ARGS__) + +static FILE *verbose_file; +static int verbose_init; + /***************************************************************************** * types ****************************************************************************/ @@ -230,6 +244,9 @@ const char *sep = ":"; #endif + OMPT_VERBOSE_INIT_PRINT("----- START LOGGING OF TOOL REGISTRATION -----\n"); + OMPT_VERBOSE_INIT_PRINT("Search for OMP tool in current address space... "); + #if KMP_OS_DARWIN // Try in the current address space ret = ompt_tool_darwin(omp_version, runtime_version); @@ -240,50 +257,114 @@ #else #error Activation of OMPT is not supported on this platform. #endif - if (ret) + if (ret) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Sucess.\n"); + OMPT_VERBOSE_INIT_PRINT( + "Tool was started and is using the OMPT interface.\n"); + OMPT_VERBOSE_INIT_PRINT("----- END LOGGING OF TOOL REGISTRATION -----\n"); return ret; + } // Try tool-libraries-var ICV + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed.\n"); const char *tool_libs = getenv("OMP_TOOL_LIBRARIES"); if (tool_libs) { + OMPT_VERBOSE_INIT_PRINT("Searching tool libraries...\n"); + OMPT_VERBOSE_INIT_PRINT("OMP_TOOL_LIBRARIES = %s\n", tool_libs); char *libs = __kmp_str_format("%s", tool_libs); char *buf; char *fname = __kmp_str_token(libs, sep, &buf); + // Reset dl-error + dlerror(); + while (fname) { #if KMP_OS_UNIX + OMPT_VERBOSE_INIT_PRINT("Opening %s... ", fname); void *h = dlopen(fname, RTLD_LAZY); - if (h) { + if (!h) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", dlerror()); + } else { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success. \n"); + OMPT_VERBOSE_INIT_PRINT("Searching for ompt_start_tool in %s... ", + fname); start_tool = (ompt_start_tool_t)dlsym(h, "ompt_start_tool"); + if (!start_tool) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", dlerror()); + } else #elif KMP_OS_WINDOWS + OMPT_VERBOSE_INIT_PRINT("Opening %s... ", fname); HMODULE h = LoadLibrary(fname); - if (h) { + if (!h) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: Error %u\n", GetLastError()); + } else { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success. \n"); + OMPT_VERBOSE_INIT_PRINT("Searching for ompt_start_tool in %s... ", + fname); start_tool = (ompt_start_tool_t)GetProcAddress(h, "ompt_start_tool"); + if (!start_tool) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: Error %s\n", + GetLastError()); + } else #else #error Activation of OMPT is not supported on this platform. #endif - if (start_tool && (ret = (*start_tool)(omp_version, runtime_version))) - break; + {// if (start_tool) + ret = (*start_tool)(omp_version, runtime_version); + if (ret) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success.\n"); + OMPT_VERBOSE_INIT_PRINT( + "Tool was started and is using the OMPT interface.\n"); + break; + } + OMPT_VERBOSE_INIT_CONTINUED_PRINT( + "Found but not using the OMPT interface.\n"); + OMPT_VERBOSE_INIT_PRINT("Continuing search...\n"); + } } fname = __kmp_str_token(NULL, sep, &buf); } __kmp_str_free(&libs); + } else { + OMPT_VERBOSE_INIT_PRINT("No OMP_TOOL_LIBRARIES defined.\n"); } - if (ret) + + // usable tool found in tool-libraries + if (ret) { + OMPT_VERBOSE_INIT_PRINT("----- END LOGGING OF TOOL REGISTRATION -----\n"); return ret; + } #if KMP_OS_UNIX { // Non-standard: load archer tool if application is built with TSan const char *fname = "libarcher.so"; + OMPT_VERBOSE_INIT_PRINT( + "...searching tool libraries failed. Using archer tool.\n"); + OMPT_VERBOSE_INIT_PRINT("Opening %s... ", fname); void *h = dlopen(fname, RTLD_LAZY); if (h) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success.\n"); + OMPT_VERBOSE_INIT_PRINT("Searching for ompt_start_tool in %s... ", fname); start_tool = (ompt_start_tool_t)dlsym(h, "ompt_start_tool"); - if (start_tool) + if (start_tool) { ret = (*start_tool)(omp_version, runtime_version); - if (ret) - return ret; + if (ret) { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Success.\n"); + OMPT_VERBOSE_INIT_PRINT( + "Tool was started and is using the OMPT interface.\n"); + OMPT_VERBOSE_INIT_PRINT( + "----- END LOGGING OF TOOL REGISTRATION -----\n"); + return ret; + } + OMPT_VERBOSE_INIT_CONTINUED_PRINT( + "Found but not using the OMPT interface.\n"); + } else { + OMPT_VERBOSE_INIT_CONTINUED_PRINT("Failed: %s\n", dlerror()); + } } } #endif + OMPT_VERBOSE_INIT_PRINT("No OMP tool loaded.\n"); + OMPT_VERBOSE_INIT_PRINT("----- END LOGGING OF TOOL REGISTRATION -----\n"); return ret; } @@ -311,11 +392,27 @@ else if (OMPT_STR_MATCH(ompt_env_var, "enabled")) tool_setting = omp_tool_enabled; + const char *ompt_env_verbose_init = getenv("OMP_TOOL_VERBOSE_INIT"); + // possible options: disabled | stdout | stderr | + // if set, not empty and not disabled -> prepare for logging + if (ompt_env_verbose_init && strcmp(ompt_env_verbose_init, "") && + !OMPT_STR_MATCH(ompt_env_verbose_init, "disabled")) { + verbose_init = 1; + if (OMPT_STR_MATCH(ompt_env_verbose_init, "STDERR")) + verbose_file = stderr; + else if (OMPT_STR_MATCH(ompt_env_verbose_init, "STDOUT")) + verbose_file = stdout; + else + verbose_file = fopen(ompt_env_verbose_init, "w"); + } else + verbose_init = 0; + #if OMPT_DEBUG printf("ompt_pre_init(): tool_setting = %d\n", tool_setting); #endif switch (tool_setting) { case omp_tool_disabled: + OMPT_VERBOSE_INIT_PRINT("OMP tool disabled. \n"); break; case omp_tool_unset: @@ -337,6 +434,8 @@ ompt_env_var); break; } + if (verbose_init && verbose_file != stderr && verbose_file != stdout) + fclose(verbose_file); #if OMPT_DEBUG printf("ompt_pre_init(): ompt_enabled = %d\n", ompt_enabled); #endif Index: openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c =================================================================== --- openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c +++ openmp/runtime/test/ompt/loadtool/tool_available/tool_available.c @@ -1,20 +1,75 @@ // The OpenMP standard defines 3 ways of providing ompt_start_tool: -// 1. "statically-linking the tool’s definition of ompt_start_tool into an OpenMP application" -// RUN: %libomp-compile -DCODE -DTOOL && %libomp-run | FileCheck %s + +// 1. "statically-linking the tool’s definition of ompt_start_tool into an +// OpenMP application" + +// RUN: %libomp-compile -DCODE -DTOOL && env OMP_TOOL_VERBOSE_INIT=stdout \ +// RUN: %libomp-run | FileCheck %s --check-prefixes CHECK,ADDRSPACE // Note: We should compile the tool without -fopenmp as other tools developer -// would do. Otherwise this test may pass for the wrong reasons on Darwin. +// would do. Otherwise this test may pass for the wrong reasons on Darwin. + // RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/tool.so -// 2. "introducing a dynamically-linked library that includes the tool’s definition of ompt_start_tool into the application’s address space" + +// 2. "introducing a dynamically-linked library that includes the tool’s +// definition of ompt_start_tool into the application’s address space" + // 2.1 Link with tool during compilation -// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && %libomp-run | FileCheck %s + +// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s \ +// RUN: --check-prefixes CHECK,ADDRSPACE + // 2.2 Link with tool during compilation, but AFTER the runtime -// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && %libomp-run | FileCheck %s + +// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s \ +// RUN: --check-prefixes CHECK,ADDRSPACE + // 2.3 Inject tool via the dynamic loader -// RUN: %libomp-compile -DCODE && %preload-tool %libomp-run | FileCheck %s -// 3. "providing the name of a dynamically-linked library appropriate for the architecture and operating system used by the application in the tool-libraries-var ICV" -// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so %libomp-run | FileCheck %s +// RUN: %libomp-compile -DCODE && env OMP_TOOL_VERBOSE_INIT=stdout \ +// RUN: %preload-tool %libomp-run | FileCheck %s \ +// RUN: --check-prefixes CHECK,ADDRSPACE + +// 3. "providing the name of a dynamically-linked library appropriate for the +// architecture and operating system used by the application in the +// tool-libraries-var ICV" + +// 3.1 OMP_TOOL_VERBOSE_INIT not set + +// RUN: %libomp-compile -DCODE && \ +// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so %libomp-run | FileCheck %s + +// 3.2 OMP_TOOL_VERBOSE_INIT disabled + +// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=disabled \ +// RUN: %libomp-run | FileCheck %s + +// 3.3 OMP_TOOL_VERBOSE_INIT to stdout + +// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so \ +// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB + +// 3.4 OMP_TOOL_VERBOSE_INIT to stderr, check merged stdout and stderr + +// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=stderr \ +// RUN: %libomp-run 2>&1 | \ +// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB + +// 3.5 OMP_TOOL_VERBOSE_INIT to stderr, check just stderr + +// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=stderr \ +// RUN: %libomp-run 2>&1 >/dev/null | \ +// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes TOOLLIB + +// 3.6 OMP_TOOL_VERBOSE_INIT to file "init.log" + +// RUN: env OMP_TOOL_LIBRARIES=%T/tool.so OMP_TOOL_VERBOSE_INIT=%T/init.log \ +// RUN: %libomp-run | FileCheck %s && cat %T/init.log | \ +// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes TOOLLIB + // REQUIRES: ompt @@ -25,6 +80,24 @@ * -DCODE enables the code for the executable during compilation */ +// Check if libomp supports the callbacks for this test. +// CHECK-NOT: {{^}}0: Could not register callback + +// ADDRSPACE: ----- START LOGGING OF TOOL REGISTRATION ----- +// ADDRSPACE-NEXT: Search for OMP tool in current address space... Sucess. +// ADDRSPACE-NEXT: Tool was started and is using the OMPT interface. +// ADDRSPACE-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + +// TOOLLIB: ----- START LOGGING OF TOOL REGISTRATION ----- +// TOOLLIB-NEXT: Search for OMP tool in current address space... Failed. +// TOOLLIB-NEXT: Searching tool libraries... +// TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/tool.so +// TOOLLIB-NEXT: Opening [[PARENTPATH]]/tool.so... Success. +// TOOLLIB-NEXT: Searching for ompt_start_tool in +// TOOLLIB-SAME: [[PARENTPATH]]/tool.so... Success. +// TOOLLIB-NEXT: Tool was started and is using the OMPT interface. +// TOOLLIB-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + #ifdef CODE #include "omp.h" @@ -34,9 +107,8 @@ { } - - // Check if libomp supports the callbacks for this test. - // CHECK-NOT: {{^}}0: Could not register callback + // CHECK-NOT: ----- START LOGGING OF TOOL REGISTRATION ----- + // CHECK-NOT: ----- END LOGGING OF TOOL REGISTRATION ----- // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] // CHECK: {{^}}0: ompt_event_runtime_shutdown Index: openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c =================================================================== --- openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c +++ openmp/runtime/test/ompt/loadtool/tool_available_search/tool_available_search.c @@ -1,7 +1,9 @@ // RUN: %clang %flags -shared -fPIC %s -o %T/first_tool.so // RUN: %clang %flags -DTOOL -DSECOND_TOOL -shared -fPIC %s -o %T/second_tool.so // RUN: %clang %flags -DTOOL -DTHIRD_TOOL -shared -fPIC %s -o %T/third_tool.so -// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/non_existing_file.so:%T/first_tool.so:%T/second_tool.so:%T/third_tool.so %libomp-run | FileCheck %s +// RUN: %libomp-compile -DCODE +// RUN: env OMP_TOOL_LIBRARIES=%T/non_existing_file.so:%T/first_tool.so:%T/second_tool.so:%T/third_tool.so \ +// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | FileCheck %s -DPARENTPATH=%T // REQUIRES: ompt @@ -15,6 +17,42 @@ * -DCODE enables the code for the executable during compilation */ +// CHECK: ----- START LOGGING OF TOOL REGISTRATION ----- +// CHECK-NEXT: Search for OMP tool in current address space... Failed. +// CHECK-NEXT: Searching tool libraries... +// CHECK-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/non_existing_file.so +// CHECK-SAME: [[PARENTPATH]]/first_tool.so +// CHECK-SAME: [[PARENTPATH]]/second_tool.so +// CHECK-SAME: [[PARENTPATH]]/third_tool.so +// CHECK-NEXT: Opening [[PARENTPATH]]/non_existing_file.so... Failed: +// CHECK-SAME: [[PARENTPATH]]/non_existing_file.so: cannot open shared object +// CHECK-SAME: file: No such file or directory +// CHECK-NEXT: Opening [[PARENTPATH]]/first_tool.so... Success. +// CHECK-NEXT: Searching for ompt_start_tool in +// CHECK-SAME: [[PARENTPATH]]/first_tool.so... Failed: +// CHECK-SAME: [[PARENTPATH]]/first_tool.so: undefined symbol: ompt_start_tool +// CHECK-NEXT: Opening [[PARENTPATH]]/second_tool.so... Success. +// CHECK-NEXT: Searching for ompt_start_tool in +// CHECK-SAME: [[PARENTPATH]]/second_tool.so... 0: Do not initialize tool +// CHECK-NEXT: Found but not using the OMPT interface. +// CHECK-NEXT: Continuing search... +// CHECK-NEXT: Opening [[PARENTPATH]]/third_tool.so... Success. +// CHECK-NEXT: Searching for ompt_start_tool in +// CHECK-SAME: [[PARENTPATH]]/third_tool.so... 0: Do initialize tool +// CHECK-NEXT: Success. +// CHECK-NEXT: Tool was started and is using the OMPT interface. +// CHECK-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + +// Check if libomp supports the callbacks for this test. + +// CHECK-NOT: {{^}}0: Could not register callback +// CHECK: {{^}}0: Tool initialized +// CHECK: {{^}}0: ompt_event_thread_begin +// CHECK-DAG: {{^}}0: ompt_event_thread_begin +// CHECK-DAG: {{^}}0: control_tool()=-1 +// CHECK: {{^}}0: Tool finalized + + #ifdef CODE #include "stdio.h" #include "omp.h" @@ -32,19 +70,6 @@ } - // Check if libomp supports the callbacks for this test. - // CHECK-NOT: {{^}}0: Could not register callback - - // CHECK: {{^}}0: Do not initialize tool - - // CHECK: {{^}}0: Do initialize tool - // CHECK: {{^}}0: Tool initialized - // CHECK: {{^}}0: ompt_event_thread_begin - // CHECK-DAG: {{^}}0: ompt_event_thread_begin - // CHECK-DAG: {{^}}0: control_tool()=-1 - // CHECK: {{^}}0: Tool finalized - - return 0; } Index: openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c =================================================================== --- openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c +++ openmp/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c @@ -1,20 +1,45 @@ // The OpenMP standard defines 3 ways of providing ompt_start_tool: -// 1. "statically-linking the tool’s definition of ompt_start_tool into an OpenMP application" -// RUN: %libomp-compile -DCODE -DTOOL && %libomp-run | FileCheck %s + +// 1. "statically-linking the tool’s definition of ompt_start_tool into an +// OpenMP application" + +// RUN: %libomp-compile -DCODE -DTOOL && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE // Note: We should compile the tool without -fopenmp as other tools developer -// would do. Otherwise this test may pass for the wrong reasons on Darwin. +// would do. Otherwise this test may pass for the wrong reasons on Darwin. + // RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/tool.so -// 2. "introducing a dynamically-linked library that includes the tool’s definition of ompt_start_tool into the application’s address space" + +// 2. "introducing a dynamically-linked library that includes the tool’s +// definition of ompt_start_tool into the application’s address space" + // 2.1 Link with tool during compilation -// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && %libomp-run | FileCheck %s + +// RUN: %libomp-compile -DCODE %no-as-needed-flag %T/tool.so && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE + // 2.2 Link with tool during compilation, but AFTER the runtime -// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && %libomp-run | FileCheck %s + +// RUN: %libomp-compile -DCODE -lomp %no-as-needed-flag %T/tool.so && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE + // 2.3 Inject tool via the dynamic loader -// RUN: %libomp-compile -DCODE && %preload-tool %libomp-run | FileCheck %s -// 3. "providing the name of a dynamically-linked library appropriate for the architecture and operating system used by the application in the tool-libraries-var ICV" -// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so %libomp-run | FileCheck %s +// RUN: %libomp-compile -DCODE && \ +// RUN: env OMP_TOOL_VERBOSE_INIT=stdout %preload-tool %libomp-run | \ +// RUN: FileCheck %s --check-prefixes CHECK,ADDRSPACE + +// 3. "providing the name of a dynamically-linked library appropriate for the +// architecture and operating system used by the application in the +// tool-libraries-var ICV" + +// RUN: %libomp-compile -DCODE && env OMP_TOOL_LIBRARIES=%T/tool.so \ +// RUN: OMP_TOOL_VERBOSE_INIT=stdout %libomp-run | \ +// RUN: FileCheck %s -DPARENTPATH=%T --check-prefixes CHECK,TOOLLIB // REQUIRES: ompt @@ -43,9 +68,33 @@ // Check if libomp supports the callbacks for this test. - // CHECK-NOT: {{^}}0: Could not register callback - - // CHECK: {{^}}0: Do not initialize tool + // CHECK-NOT: {{^}}0: Could not register callback + + // ADDRSPACE: ----- START LOGGING OF TOOL REGISTRATION ----- + // ADDRSPACE-NEXT: Search for OMP tool in current address space... + + // TOOLLIB: ----- START LOGGING OF TOOL REGISTRATION ----- + // TOOLLIB-NEXT: Search for OMP tool in current address space... Failed. + // TOOLLIB-NEXT: Searching tool libraries... + // TOOLLIB-NEXT: OMP_TOOL_LIBRARIES = [[PARENTPATH]]/tool.so + // TOOLLIB-NEXT: Opening [[PARENTPATH]]/tool.so... Success. + // TOOLLIB-NEXT: Searching for ompt_start_tool in + // TOOLLIB-SAME: [[PARENTPATH]]/tool.so... + + // CHECK: 0: Do not initialize tool + + // ADDRSPACE-NEXT: Failed. + // ADDRSPACE-NEXT: No OMP_TOOL_LIBRARIES defined. + // ADDRSPACE-NEXT: ...searching tool libraries failed. + // ADDRSPACE: No OMP tool loaded. + // ADDRSPACE-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + + // TOOLLIB-NEXT: Found but not using the OMPT interface. + // TOOLLIB-NEXT: Continuing search... + // TOOLLIB-NEXT: ...searching tool libraries failed. + // TOOLLIB: No OMP tool loaded. + // TOOLLIB-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + // CHECK: {{^}}0: control_tool()=-2 Index: openmp/tools/archer/tests/parallel/parallel-simple.c =================================================================== --- openmp/tools/archer/tests/parallel/parallel-simple.c +++ openmp/tools/archer/tests/parallel/parallel-simple.c @@ -12,11 +12,31 @@ //===----------------------------------------------------------------------===// -// RUN: %libarcher-compile-and-run | FileCheck %s +// RUN: %libarcher-compile && env OMP_TOOL_VERBOSE_INIT=stderr %libarcher-run 2>&1 | FileCheck %s --check-prefixes CHECK,OMPT_ON +// RUN: %clang-archer %openmp_flags %flags %s -o %t && env OMP_TOOL_VERBOSE_INIT=stderr %t 2>&1 | FileCheck %s --check-prefixes CHECK,OMPT_OFF // REQUIRES: tsan #include #include +// OMPT_ON: ----- START LOGGING OF TOOL REGISTRATION ----- +// OMPT_ON-NEXT: Search for OMP tool in current address space... Failed. +// OMPT_ON-NEXT: Searching tool libraries... +// OMPT_ON-NEXT: ...searching tool libraries failed. Using archer tool. +// OMPT_ON-NEXT: Opening libarcher.so... Success. +// OMPT_ON-NEXT: Searching for ompt_start_tool in libarcher.so... Success. +// OMPT_ON-NEXT: Tool was started and is using the OMPT interface. +// OMPT_ON-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + +// OMPT_OFF: ----- START LOGGING OF TOOL REGISTRATION ----- +// OMPT_OFF-NEXT: Search for OMP tool in current address space... Failed. +// OMPT_OFF-NEXT: Searching tool libraries... +// OMPT_OFF-NEXT: ...searching tool libraries failed. Using archer tool. +// OMPT_OFF-NEXT: Opening libarcher.so... Success. +// OMPT_OFF-NEXT: Searching for ompt_start_tool in libarcher.so... Found but not using the OMPT interface. +// OMPT_OFF-NEXT: No OMP tool loaded. +// OMPT_OFF-NEXT: ----- END LOGGING OF TOOL REGISTRATION ----- + + int main(int argc, char *argv[]) { int var = 0;