[Openmp-commits] [openmp] r324587 - [OMPT] Add tool_not_available testcase

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 8 02:04:28 PST 2018


Author: jprotze
Date: Thu Feb  8 02:04:28 2018
New Revision: 324587

URL: http://llvm.org/viewvc/llvm-project?rev=324587&view=rev
Log:
[OMPT] Add tool_not_available testcase

Add a testcase that checks wheter the runtime can handle an ompt_start_tool
method that returns NULL indicating that no tool shall be loaded.

All tool_available testcases need a separate folder to avoid file conflicts for
the generated tools.

Differential Revision: https://reviews.llvm.org/D41904

Added:
    openmp/trunk/runtime/test/ompt/loadtool/tool_available/
    openmp/trunk/runtime/test/ompt/loadtool/tool_available/tool_available.c
      - copied, changed from r324495, openmp/trunk/runtime/test/ompt/loadtool/tool_available.c
    openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/
    openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c
      - copied, changed from r324495, openmp/trunk/runtime/test/ompt/loadtool/tool_available.c
Removed:
    openmp/trunk/runtime/test/ompt/loadtool/tool_available.c

Removed: openmp/trunk/runtime/test/ompt/loadtool/tool_available.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/loadtool/tool_available.c?rev=324586&view=auto
==============================================================================
--- openmp/trunk/runtime/test/ompt/loadtool/tool_available.c (original)
+++ openmp/trunk/runtime/test/ompt/loadtool/tool_available.c (removed)
@@ -1,74 +0,0 @@
-// 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
-
-// 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.
-// 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.1 Link with tool during compilation
-// RUN: %libomp-compile -DCODE -Wl,--no-as-needed %T/tool.so && %libomp-run | FileCheck %s
-// 2.2 Link with tool during compilation, but AFTER the runtime
-// RUN: %libomp-compile -DCODE -lomp -Wl,--no-as-needed %T/tool.so && %libomp-run | FileCheck %s
-// 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
-
-// REQUIRES: ompt
-
-/*
- *  This file contains code for an OMPT shared library tool to be
- *  loaded and the code for the OpenMP executable.
- *  -DTOOL enables the code for the tool during compilation
- *  -DCODE enables the code for the executable during compilation
- */
-
-#ifdef CODE
-#include "omp.h"
-
-int main()
-{
-  #pragma omp parallel num_threads(2)
-  {
-  }
-
-
-  // Check if libomp supports the callbacks for this test.
-  // CHECK-NOT: {{^}}0: Could not register callback
-
-  // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
-  // CHECK: {{^}}0: ompt_event_runtime_shutdown
-
-  return 0;
-}
-
-#endif /* CODE */
-
-#ifdef TOOL
-
-#include <stdio.h>
-#include <ompt.h>
-
-int ompt_initialize(
-  ompt_function_lookup_t lookup,
-  ompt_data_t* tool_data)
-{
-  printf("0: NULL_POINTER=%p\n", (void*)NULL);
-  return 1; //success
-}
-
-void ompt_finalize(ompt_data_t* tool_data)
-{
-  printf("0: ompt_event_runtime_shutdown\n");
-}
-
-ompt_start_tool_result_t* ompt_start_tool(
-  unsigned int omp_version,
-  const char *runtime_version)
-{
-  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
-  return &ompt_start_tool_result;
-}
-#endif /* TOOL */

Copied: openmp/trunk/runtime/test/ompt/loadtool/tool_available/tool_available.c (from r324495, openmp/trunk/runtime/test/ompt/loadtool/tool_available.c)
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/loadtool/tool_available/tool_available.c?p2=openmp/trunk/runtime/test/ompt/loadtool/tool_available/tool_available.c&p1=openmp/trunk/runtime/test/ompt/loadtool/tool_available.c&r1=324495&r2=324587&rev=324587&view=diff
==============================================================================
    (empty)

Copied: openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c (from r324495, openmp/trunk/runtime/test/ompt/loadtool/tool_available.c)
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c?p2=openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c&p1=openmp/trunk/runtime/test/ompt/loadtool/tool_available.c&r1=324495&r2=324587&rev=324587&view=diff
==============================================================================
--- openmp/trunk/runtime/test/ompt/loadtool/tool_available.c (original)
+++ openmp/trunk/runtime/test/ompt/loadtool/tool_not_available/tool_not_available.c Thu Feb  8 02:04:28 2018
@@ -19,27 +19,35 @@
 // REQUIRES: ompt
 
 /*
- *  This file contains code for an OMPT shared library tool to be
- *  loaded and the code for the OpenMP executable.
+ *  This file contains code for an OMPT shared library tool to be 
+ *  loaded and the code for the OpenMP executable. 
  *  -DTOOL enables the code for the tool during compilation
  *  -DCODE enables the code for the executable during compilation
  */
 
 #ifdef CODE
+#include "stdio.h"
 #include "omp.h"
+#include "ompt.h"
 
 int main()
 {
   #pragma omp parallel num_threads(2)
   {
+    #pragma omp master
+    {
+      int result = omp_control_tool(omp_control_tool_start, 0, NULL);
+      printf("0: control_tool()=%d\n", result);
+    }
   }
 
 
   // Check if libomp supports the callbacks for this test.
-  // CHECK-NOT: {{^}}0: Could not register callback
-
-  // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
-  // CHECK: {{^}}0: ompt_event_runtime_shutdown
+  // CHECK-NOT: {{^}}0: Could not register callback 
+  
+  // CHECK: {{^}}0: Do not initialize tool
+  // CHECK: {{^}}0: control_tool()=-2
+  
 
   return 0;
 }
@@ -48,27 +56,14 @@ int main()
 
 #ifdef TOOL
 
-#include <stdio.h>
 #include <ompt.h>
-
-int ompt_initialize(
-  ompt_function_lookup_t lookup,
-  ompt_data_t* tool_data)
-{
-  printf("0: NULL_POINTER=%p\n", (void*)NULL);
-  return 1; //success
-}
-
-void ompt_finalize(ompt_data_t* tool_data)
-{
-  printf("0: ompt_event_runtime_shutdown\n");
-}
+#include "stdio.h"
 
 ompt_start_tool_result_t* ompt_start_tool(
   unsigned int omp_version,
   const char *runtime_version)
 {
-  static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
-  return &ompt_start_tool_result;
+  printf("0: Do not initialize tool\n");
+  return NULL;
 }
 #endif /* TOOL */




More information about the Openmp-commits mailing list