├── .gitignore ├── cmake ├── has_ompt.guess ├── config-ix.cmake ├── DetectTestCompiler │ └── CMakeLists.txt ├── FindArcher.cmake ├── FindOmpt.cmake ├── FindOmp.cmake └── FindLLVM.cmake ├── resources └── images │ ├── llnl_logo.pdf │ ├── llnl_logo.png │ ├── uofu_logo.pdf │ ├── uofu_logo.png │ ├── archer_logo.pdf │ ├── archer_logo.png │ ├── pruners_icon.png │ ├── pruners_logo.pdf │ ├── pruners_logo.png │ ├── archerurl_logo.pdf │ ├── archerurl_logo.png │ ├── rwthaachen_logo.pdf │ └── rwthaachen_logo.png ├── .gitattributes ├── test ├── ompt │ ├── worksharing │ │ ├── for │ │ │ ├── dynamic.c │ │ │ ├── guided.c │ │ │ ├── runtime.c │ │ │ ├── guided_serialized.c │ │ │ ├── dynamic_serialized.c │ │ │ ├── runtime_serialized.c │ │ │ ├── auto.c │ │ │ ├── static.c │ │ │ ├── static_serialized.c │ │ │ ├── auto_serialized.c │ │ │ ├── dynamic_split.c │ │ │ ├── guided_split.c │ │ │ ├── runtime_split.c │ │ │ ├── auto_split.c │ │ │ ├── static_split.c │ │ │ ├── base_serialized.h │ │ │ ├── base.h │ │ │ └── base_split.h │ │ ├── single.c │ │ └── sections.c │ ├── misc │ │ ├── control_tool_no_ompt_support.c │ │ ├── idle.c │ │ ├── unset_callback.c │ │ └── control_tool.c │ ├── ompt-signal.h │ ├── synchronization │ │ ├── flush.c │ │ ├── barrier │ │ │ ├── for_simd.c │ │ │ ├── parallel_region.c │ │ │ ├── for_loop.c │ │ │ ├── explicit.c │ │ │ ├── sections.c │ │ │ └── single.c │ │ ├── master.c │ │ ├── critical.c │ │ ├── ordered.c │ │ ├── taskwait.c │ │ ├── taskgroup.c │ │ ├── lock.c │ │ ├── test_nest_lock.c │ │ ├── test_lock.c │ │ ├── nest_lock.c │ │ └── test_nest_lock_parallel.c │ ├── cancel │ │ ├── cancel_parallel.c │ │ └── cancel_worksharing.c │ ├── parallel │ │ ├── dynamic_enough_threads.c │ │ └── dynamic_not_enough_threads.c │ └── tasks │ │ ├── taskyield.c │ │ ├── dependences.c │ │ └── task_types.c ├── deflake.bash ├── CMakeLists.txt ├── parallel │ ├── parallel-firstprivate.c │ ├── parallel-simple.c │ └── parallel-simple2.c ├── critical │ ├── critical.c │ ├── lock.c │ └── lock-nested.c ├── worksharing │ └── ordered.c ├── barrier │ └── barrier.c ├── reduction │ ├── parallel-reduction.c │ └── parallel-reduction-nowait.c ├── races │ ├── parallel-simple.c │ ├── critical-unrelated.c │ ├── lock-unrelated.c │ ├── lock-nested-unrelated.c │ ├── task-two.c │ ├── task-taskwait-nested.c │ ├── task-taskgroup-unrelated.c │ └── task-dependency.c ├── task │ ├── task-create.c │ ├── task-taskwait.c │ ├── task-taskgroup.c │ ├── task-barrier.c │ ├── task-taskwait-nested.c │ ├── task-taskgroup-nested.c │ └── task-dependency.c └── lit.site.cfg.in ├── hooks ├── post-commit ├── pre-commit └── README.md ├── rtl ├── suppressions.txt ├── CMakeLists.txt └── ftsan.c ├── ci └── DockerFile.ubuntu-16.04 ├── CREDITS ├── tools ├── CMakeLists.txt ├── clang-archer.in └── clang-archer++.in ├── lib ├── Support │ ├── Util.cpp │ └── RegisterPasses.cpp ├── Archer.cpp └── CMakeLists.txt ├── include └── archer │ ├── RegisterPasses.h │ ├── Util.h │ └── LinkAllPasses.h └── .travis.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .cproject 3 | .pydevproject 4 | .commit -------------------------------------------------------------------------------- /cmake/has_ompt.guess: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | nm $1 | grep -w "$2" > /dev/null 4 | rc=$? 5 | 6 | echo $rc 7 | -------------------------------------------------------------------------------- /resources/images/llnl_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/llnl_logo.pdf -------------------------------------------------------------------------------- /resources/images/llnl_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/llnl_logo.png -------------------------------------------------------------------------------- /resources/images/uofu_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/uofu_logo.pdf -------------------------------------------------------------------------------- /resources/images/uofu_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/uofu_logo.png -------------------------------------------------------------------------------- /resources/images/archer_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/archer_logo.pdf -------------------------------------------------------------------------------- /resources/images/archer_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/archer_logo.png -------------------------------------------------------------------------------- /resources/images/pruners_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/pruners_icon.png -------------------------------------------------------------------------------- /resources/images/pruners_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/pruners_logo.pdf -------------------------------------------------------------------------------- /resources/images/pruners_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/pruners_logo.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text eol=lf 3 | *.png -text 4 | *.pdf -text 5 | -------------------------------------------------------------------------------- /resources/images/archerurl_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/archerurl_logo.pdf -------------------------------------------------------------------------------- /resources/images/archerurl_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/archerurl_logo.png -------------------------------------------------------------------------------- /resources/images/rwthaachen_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/rwthaachen_logo.pdf -------------------------------------------------------------------------------- /resources/images/rwthaachen_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PRUNERS/archer/HEAD/resources/images/rwthaachen_logo.png -------------------------------------------------------------------------------- /test/ompt/worksharing/for/dynamic.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE dynamic 5 | #include "base.h" 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/guided.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE guided 5 | #include "base.h" 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/runtime.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE runtime 5 | #include "base.h" 6 | -------------------------------------------------------------------------------- /hooks/post-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -a .commit ] 4 | then 5 | rm .commit 6 | rm -rf README.md~ 7 | git commit README.md -m "Updated Markdown README" > /dev/null 8 | fi 9 | exit 0 10 | -------------------------------------------------------------------------------- /rtl/suppressions.txt: -------------------------------------------------------------------------------- 1 | # Assume that the runtime itself is race free. 2 | called_from_lib:libomp.* 3 | 4 | # TSan reports "thread leak" because the threads are joined on shutdown. 5 | thread:^__kmp_create_worker$ 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/guided_serialized.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE guided 5 | #include "base_serialized.h" 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/dynamic_serialized.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE dynamic 5 | #include "base_serialized.h" 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/runtime_serialized.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h 2 | // REQUIRES: ompt 3 | 4 | #define SCHEDULE runtime 5 | #include "base_serialized.h" 6 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/auto.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h 2 | // REQUIRES: ompt 3 | // GCC doesn't call runtime for auto = static schedule 4 | // XFAIL: gcc 5 | 6 | #define SCHEDULE auto 7 | #include "base.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/static.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base.h 2 | // REQUIRES: ompt 3 | // GCC doesn't call runtime for static schedule 4 | // XFAIL: gcc 5 | 6 | #define SCHEDULE static 7 | #include "base.h" 8 | -------------------------------------------------------------------------------- /test/ompt/misc/control_tool_no_ompt_support.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run 2 | #include 3 | 4 | int main() 5 | { 6 | #pragma omp parallel num_threads(1) 7 | { 8 | omp_control_tool(omp_control_tool_flush, 1, NULL); 9 | } 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/static_serialized.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h 2 | // REQUIRES: ompt 3 | // GCC doesn't call runtime for static schedule 4 | // XFAIL: gcc 5 | 6 | #define SCHEDULE static 7 | #include "base_serialized.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/auto_serialized.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_serialized.h 2 | // REQUIRES: ompt 3 | // GCC doesn't call runtime for auto = static schedule 4 | // XFAIL: gcc 5 | 6 | #define SCHEDULE auto 7 | #include "base_serialized.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/dynamic_split.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_split.h 2 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=CHECK-LOOP %S/base_split.h 3 | // REQUIRES: ompt 4 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 5 | 6 | #define SCHEDULE dynamic 7 | #include "base_split.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/guided_split.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_split.h 2 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=CHECK-LOOP %S/base_split.h 3 | // REQUIRES: ompt 4 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 5 | 6 | #define SCHEDULE guided 7 | #include "base_split.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/runtime_split.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_split.h 2 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=CHECK-LOOP %S/base_split.h 3 | // REQUIRES: ompt 4 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 5 | 6 | #define SCHEDULE runtime 7 | #include "base_split.h" 8 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/auto_split.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_split.h 2 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=CHECK-LOOP %S/base_split.h 3 | // REQUIRES: ompt 4 | // GCC doesn't call runtime for auto = static schedule 5 | // XFAIL: gcc 6 | 7 | #define SCHEDULE auto 8 | #include "base_split.h" 9 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/static_split.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %S/base_split.h 2 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck --check-prefix=CHECK-LOOP %S/base_split.h 3 | // REQUIRES: ompt 4 | // GCC doesn't call runtime for static schedule 5 | // XFAIL: gcc 6 | 7 | #define SCHEDULE static 8 | #include "base_split.h" 9 | -------------------------------------------------------------------------------- /ci/DockerFile.ubuntu-16.04: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | RUN apt-get update 3 | 4 | # Set the locale 5 | RUN locale-gen en_US.UTF-8 6 | ENV LANG en_US.UTF-8 7 | ENV LANGUAGE en_US:en 8 | ENV LC_ALL en_US.UTF-8 9 | 10 | # Install dependencies 11 | ENV DEBIAN_FRONTEND noninteractive 12 | RUN apt-get update 13 | RUN apt-get install -qq build-essential cmake ninja-build 14 | 15 | # Grab the checked out source 16 | # RUN mkdir -p /workdir 17 | # WORKDIR /workdir 18 | # COPY . /workdir 19 | # RUN make 20 | # RUN make pkg 21 | -------------------------------------------------------------------------------- /test/deflake.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This script is used to deflake inherently flaky archer tests. 3 | # It is invoked from lit tests as: 4 | # %deflake mybinary 5 | # which is then substituted by lit to: 6 | # $(dirname %s)/deflake.bash mybinary 7 | # The script runs the target program up to 10 times, 8 | # until it fails (i.e. produces a race report). 9 | 10 | for i in $(seq 1 10); do 11 | OUT=`$@ 2>&1` 12 | if [[ $? != 0 ]]; then 13 | echo "$OUT" 14 | exit 0 15 | fi 16 | done 17 | exit 1 18 | -------------------------------------------------------------------------------- /hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SRC_FILE="$(git diff --cached --name-only | grep README.org)" 4 | 5 | if [ ! -z "$SRC_FILE" ]; 6 | then 7 | type "emacs" > /dev/null 8 | if [ $? -eq 0 ]; 9 | then 10 | touch .commit 11 | emacs README.org --batch -f org-md-export-to-markdown --kill 12 | echo -e "[![Build Status](https://travis-ci.org/PRUNERS/archer.svg?branch=master)](https://travis-ci.org/PRUNERS/archer)\n" | cat - README.md > temp && mv temp README.md 13 | fi 14 | fi 15 | exit 0 16 | -------------------------------------------------------------------------------- /test/ompt/misc/idle.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | 6 | int main() 7 | { 8 | int x = 0; 9 | #pragma omp parallel num_threads(3) 10 | { 11 | #pragma omp atomic 12 | x++; 13 | } 14 | #pragma omp parallel num_threads(2) 15 | { 16 | #pragma omp atomic 17 | x++; 18 | } 19 | 20 | 21 | printf("x=%d\n", x); 22 | 23 | // Check if libomp supports the callbacks for this test. 24 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_idle' 25 | 26 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 27 | 28 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_idle_begin: 29 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_idle_end: 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /test/ompt/ompt-signal.h: -------------------------------------------------------------------------------- 1 | #if defined(WIN32) || defined(_WIN32) 2 | #include 3 | #define delay() Sleep(1); 4 | #else 5 | #include 6 | #define delay(t) usleep(t); 7 | #endif 8 | 9 | // These functions are used to provide a signal-wait mechanism to enforce expected scheduling for the test cases. 10 | // Conditional variable (s) needs to be shared! Initialize to 0 11 | 12 | #define OMPT_SIGNAL(s) ompt_signal(&s) 13 | //inline 14 | void ompt_signal(int* s) 15 | { 16 | #pragma omp atomic 17 | (*s)++; 18 | } 19 | 20 | #define OMPT_WAIT(s,v) ompt_wait(&s,v) 21 | // wait for s >= v 22 | //inline 23 | void ompt_wait(int *s, int v) 24 | { 25 | int wait=0; 26 | do{ 27 | delay(10); 28 | #pragma omp atomic read 29 | wait = (*s); 30 | }while(wait 5 | 6 | int main() 7 | { 8 | #pragma omp parallel num_threads(1) 9 | { 10 | 11 | } 12 | ompt_set_callback(ompt_callback_parallel_begin, NULL); 13 | #pragma omp parallel num_threads(1) 14 | { 15 | 16 | } 17 | 18 | // Check if libomp supports the callbacks for this test. 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_idle' 20 | 21 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 22 | 23 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_parallel_begin: 24 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_end: 25 | // CHECK-NOT: {{^}}[[THREAD_ID]]: ompt_event_parallel_begin: 26 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_end: 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | This file is a partial list of people who have contributed to Archer. 2 | If you have contributed a patch or made some other contribution to 3 | Archer, please submit a patch to this file to add yourself, and it will be 4 | done! 5 | 6 | The list is sorted by surname and formatted to allow easy grepping and 7 | beautification by scripts. The fields are: name (N), email (E), web-address 8 | (W), PGP key ID and fingerprint (P), description (D), and snail-mail address 9 | (S). 10 | 11 | N: Simone Atzeni 12 | E: simone@cs.utah.edu 13 | D: Co-founder 14 | D: Ph.D. Student at University of Utah 15 | 16 | N: Joachim Protze 17 | E: protze@itc.rwth-aachen.de 18 | D: Co-founder 19 | D: Ph.D. Student at RWTH Aachen University 20 | 21 | N: Jonas Hahnfeld 22 | E: hahnfeld@itc.rwth-aachen.de 23 | D: OMPT-Tsan Annotation Runtime 24 | D: Undergraduate at RWTH Aachen University 25 | -------------------------------------------------------------------------------- /cmake/config-ix.cmake: -------------------------------------------------------------------------------- 1 | include(CheckCCompilerFlag) 2 | include(CheckCXXCompilerFlag) 3 | 4 | check_c_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG) 5 | 6 | check_cxx_compiler_flag(-std=c++11 OPENMP_HAVE_STD_CPP11_FLAG) 7 | 8 | # Returns the host triple. 9 | # Invokes has_ompt.guess 10 | 11 | function(has_ompt_support path library symbol var) 12 | set(has_ompt_guess ${CMAKE_CURRENT_SOURCE_DIR}/cmake/has_ompt.guess) 13 | execute_process(COMMAND sh ${has_ompt_guess} ${path}/${library} ${symbol} 14 | RESULT_VARIABLE TT_RV 15 | OUTPUT_VARIABLE TT_OUT 16 | OUTPUT_STRIP_TRAILING_WHITESPACE) 17 | if( NOT TT_OUT EQUAL 0 ) 18 | message(FATAL_ERROR "OpenMP library does not have OMPT support. Please recompile your OpenMP library with support for OMPT.") 19 | endif( NOT TT_OUT EQUAL 0 ) 20 | set( ${var} TRUE PARENT_SCOPE ) 21 | endfunction(has_ompt_support var) 22 | -------------------------------------------------------------------------------- /test/ompt/synchronization/flush.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // GCC generates code that does not call the runtime for the flush construct 4 | // XFAIL: gcc 5 | 6 | #include "callback.h" 7 | #include 8 | 9 | int main() 10 | { 11 | #pragma omp parallel num_threads(2) 12 | { 13 | int tid = omp_get_thread_num(); 14 | 15 | #pragma omp flush 16 | print_current_address(1); 17 | } 18 | 19 | // Check if libomp supports the callbacks for this test. 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_flush' 21 | 22 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 23 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_flush: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 24 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: current_address=[[RETURN_ADDRESS]] 25 | // 26 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_flush: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 27 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: current_address=[[RETURN_ADDRESS]] 28 | 29 | 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /test/ompt/misc/control_tool.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #define TEST_NEED_PRINT_FRAME_FROM_OUTLINED_FN 5 | #include "callback.h" 6 | #include 7 | 8 | int main() 9 | { 10 | #pragma omp parallel num_threads(1) 11 | { 12 | print_frame_from_outlined_fn(1); 13 | print_frame(0); 14 | omp_control_tool(omp_control_tool_flush, 1, NULL); 15 | print_current_address(0); 16 | } 17 | 18 | // Check if libomp supports the callbacks for this test. 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_control_tool' 20 | 21 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 22 | 23 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address({{.}})=[[EXIT_FRAME:0x[0-f]*]] 24 | // CHECK: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER_FRAME:0x[0-f]*]] 25 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_control_tool: command=3, modifier=1, arg=[[NULL]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]*]], current_task_frame.exit=[[EXIT_FRAME]], current_task_frame.reenter=[[REENTER_FRAME]] 26 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/for_simd.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | // XFAIL: gcc-4 4 | 5 | #include "callback.h" 6 | #include 7 | 8 | int main() 9 | { 10 | int y[] = {0,1,2,3}; 11 | 12 | int i; 13 | #pragma omp for simd 14 | for (i = 0; i < 4; i++) 15 | { 16 | y[i]++; 17 | } 18 | 19 | 20 | // Check if libomp supports the callbacks for this test. 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 22 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 23 | 24 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 25 | 26 | // master thread implicit barrier at simd loop end 27 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 28 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 29 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 30 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /test/ompt/synchronization/master.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | // GCC generates code that does not call the runtime for the master construct 4 | // XFAIL: gcc 5 | 6 | #include "callback.h" 7 | #include 8 | 9 | int main() 10 | { 11 | int x = 0; 12 | #pragma omp parallel num_threads(2) 13 | { 14 | #pragma omp master 15 | { 16 | print_fuzzy_address(1); 17 | x++; 18 | } 19 | print_current_address(2); 20 | } 21 | 22 | printf("%" PRIu64 ": x=%d\n", ompt_get_thread_data()->value, x); 23 | 24 | // Check if libomp supports the callbacks for this test. 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_master' 26 | 27 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 28 | 29 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_master_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 30 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 31 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_master_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS_END:0x[0-f]+]] 32 | // CHECK: {{^}}[[MASTER_ID]]: current_address=[[RETURN_ADDRESS_END]] 33 | 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /test/ompt/synchronization/critical.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | #pragma omp critical 10 | { 11 | print_current_address(1); 12 | print_ids(0); 13 | } 14 | print_current_address(2); 15 | 16 | 17 | // Check if libomp supports the callbacks for this test. 18 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 22 | 23 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 24 | 25 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_wait_critical: wait_id=[[WAIT_ID:[0-9]+]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 26 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_critical: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 27 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 28 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_critical: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 29 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /test/ompt/synchronization/ordered.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | #pragma omp ordered 10 | { 11 | print_current_address(1); 12 | print_ids(0); 13 | } 14 | print_current_address(2); 15 | 16 | 17 | // Check if libomp supports the callbacks for this test. 18 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 22 | 23 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 24 | 25 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_wait_ordered: wait_id=[[WAIT_ID:[0-9]+]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 26 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_ordered: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 27 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 28 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_ordered: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 29 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /test/ompt/synchronization/taskwait.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | int x = 0; 10 | #pragma omp parallel num_threads(2) 11 | { 12 | #pragma omp master 13 | { 14 | #pragma omp task 15 | { 16 | x++; 17 | } 18 | #pragma omp taskwait 19 | print_current_address(1); 20 | } 21 | } 22 | 23 | // Check if libomp supports the callbacks for this test. 24 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 26 | 27 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 28 | 29 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 30 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 31 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 32 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: ompt_event_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 33 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /test/ompt/worksharing/single.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // GCC generates code that does not call the runtime for the single construct 4 | // XFAIL: gcc 5 | 6 | #include "callback.h" 7 | #include 8 | 9 | int main() 10 | { 11 | int x = 0; 12 | #pragma omp parallel num_threads(2) 13 | { 14 | #pragma omp single 15 | { 16 | printf("%" PRIu64 ": in single\n", ompt_get_thread_data()->value); 17 | x++; 18 | } 19 | } 20 | 21 | printf("x=%d\n", x); 22 | 23 | // Check if libomp supports the callbacks for this test. 24 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' 25 | 26 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 27 | 28 | // CHECK-DAG: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1 29 | // CHECK-DAG: {{^}}[[THREAD_ID_1]]: in single 30 | // CHECK-DAG: {{^}}[[THREAD_ID_1]]: ompt_event_single_in_block_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1 31 | 32 | // CHECK-DAG: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_single_others_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1 33 | // CHECK-DAG: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /hooks/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/PRUNERS/archer.svg?branch=master)](https://travis-ci.org/PRUNERS/archer) 2 | 3 |
4 |

Table of Contents

5 | 16 |
17 | 18 | 19 | 20 | 21 | # How to setup the hooks 22 | 23 | These hooks allow to automatically generate the Markdown README from 24 | the Org-Mode README. 25 | 26 | 27 | 28 | 29 | # Prerequisites 30 | 31 | In order to generate the Markdown README from the Org-Mode README you 32 | need a recent version of Emacs (>= 24.4) and the "org" package 33 | installed. 34 | 35 | To install the "org" package open Emacs, type M-x list-packages to 36 | open the package list. Look for "org" package, press ‘i’ to mark for 37 | installation, and ‘x’ to perform the installation. 38 | 39 | From the root folder of the git repository run the follwing commands: 40 | 41 | 42 | 43 | 44 | ## Pre-Commit Hook 45 | 46 | ln -s -f ../../hooks/pre-commit .git/hooks/pre-commit 47 | 48 | 49 | 50 | 51 | ## Post-Commit Hook 52 | 53 | ln -s -f ../../hooks/post-commit .git/hooks/post-commit 54 | -------------------------------------------------------------------------------- /test/ompt/worksharing/sections.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // Some compilers generate code that does not distinguish between sections and loops 4 | // XFAIL: gcc, clang-3, clang-4, clang-5, icc-16, icc-17 5 | // UNSUPPORTED: icc-18 6 | 7 | #include "callback.h" 8 | #include 9 | 10 | int main() 11 | { 12 | #pragma omp parallel sections num_threads(2) 13 | { 14 | #pragma omp section 15 | { 16 | printf("%lu: section 1\n", ompt_get_thread_data()->value); 17 | } 18 | #pragma omp section 19 | { 20 | printf("%lu: section 2\n", ompt_get_thread_data()->value); 21 | } 22 | } 23 | 24 | // Check if libomp supports the callbacks for this test. 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' 26 | 27 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 28 | 29 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN:0x[0-f]+]], count=2 30 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END:0x[0-f]+]] 31 | 32 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN]], count=2 33 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END]] 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/base_serialized.h: -------------------------------------------------------------------------------- 1 | #include "callback.h" 2 | #include 3 | 4 | int main() 5 | { 6 | unsigned int i; 7 | 8 | #pragma omp parallel for num_threads(1) schedule(SCHEDULE) 9 | for (i = 0; i < 1; i++) { 10 | } 11 | 12 | // Check if libomp supports the callbacks for this test. 13 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' 14 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' 15 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 16 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' 17 | 18 | 19 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 20 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=1, codeptr_ra=0x{{[0-f]+}}, invoker={{[0-9]+}} 21 | 22 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 23 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra=0x{{[0-f]+}} 24 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 25 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[PARALLEL_ID,0]}}, task_id=[[IMPLICIT_TASK_ID]] 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /cmake/DetectTestCompiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(DetectTestCompiler C CXX) 3 | 4 | include(CheckCCompilerFlag) 5 | include(CheckCXXCompilerFlag) 6 | 7 | function(write_compiler_information lang) 8 | set(information "${CMAKE_${lang}_COMPILER}") 9 | set(information "${information}\\;${CMAKE_${lang}_COMPILER_ID}") 10 | set(information "${information}\\;${CMAKE_${lang}_COMPILER_VERSION}") 11 | set(information "${information}\\;${${lang}_FLAGS}") 12 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${lang}CompilerInformation.txt ${information}) 13 | endfunction(write_compiler_information) 14 | 15 | find_package(OpenMP) 16 | if (NOT OpenMP_Found) 17 | set(OpenMP_C_FLAGS "-fopenmp") 18 | set(OpenMP_CXX_FLAGS "-fopenmp") 19 | endif() 20 | 21 | set(C_FLAGS ${flags} ${OpenMP_C_FLAGS}) 22 | set(CXX_FLAGS ${flags} ${OpenMP_CXX_FLAGS}) 23 | 24 | # TODO: Implement blockaddress in GlobalISel and remove this flag! 25 | if (CMAKE_C_COMPILER_ID STREQUAL "Clang") 26 | check_c_compiler_flag("-fno-experimental-isel" C_HAS_EXPERIMENTAL_ISEL_FLAG) 27 | check_cxx_compiler_flag("-fno-experimental-isel" CXX_HAS_EXPERIMENTAL_ISEL_FLAG) 28 | macro(add_experimental_isel_flag lang) 29 | if (${lang}_HAS_EXPERIMENTAL_ISEL_FLAG) 30 | set(${lang}_FLAGS "-fno-experimental-isel ${${lang}_FLAGS}") 31 | endif() 32 | endmacro(add_experimental_isel_flag) 33 | 34 | add_experimental_isel_flag(C) 35 | add_experimental_isel_flag(CXX) 36 | endif() 37 | 38 | write_compiler_information(C) 39 | write_compiler_information(CXX) 40 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # CMakeLists.txt file for unit testing Archer runtime library. 2 | include(CheckFunctionExists) 3 | include(CheckLibraryExists) 4 | 5 | # Some tests use math functions 6 | check_library_exists(m sqrt "" LIBARCHER_HAVE_LIBM) 7 | # When using libgcc, -latomic may be needed for atomics 8 | # (but when using compiler-rt, the atomics will be built-in) 9 | # Note: we can not check for __atomic_load because clang treats it 10 | # as special built-in and that breaks CMake checks 11 | check_function_exists(__atomic_load_1 LIBARCHER_HAVE_BUILTIN_ATOMIC) 12 | if(NOT LIBARCHER_HAVE_BUILTIN_ATOMIC) 13 | check_library_exists(atomic __atomic_load_1 "" LIBARCHER_HAVE_LIBATOMIC) 14 | else() 15 | # not needed 16 | set(LIBARCHER_HAVE_LIBATOMIC 0) 17 | endif() 18 | 19 | set(LIBARCHER_TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 20 | set(LIBARCHER_HAVE_ARCHER_LIBRARY ${LIBARCHER_LIB_PATH}) 21 | set(LIBARCHER_HAVE_ARCHER_RUNTIME ${LIBARCHER_RUNTIME_PATH}) 22 | 23 | macro(pythonize_bool var) 24 | if (${var}) 25 | set(${var} True) 26 | else() 27 | set(${var} False) 28 | endif() 29 | endmacro() 30 | 31 | pythonize_bool(LIBARCHER_HAVE_ARCHER_LIBRARY) 32 | pythonize_bool(LIBARCHER_HAVE_ARCHER_RUNTIME) 33 | pythonize_bool(LIBARCHER_OMPT_SUPPORT) 34 | pythonize_bool(LIBARCHER_OMPT_OPTIONAL) 35 | pythonize_bool(LIBARCHER_HAVE_LIBM) 36 | pythonize_bool(LIBARCHER_HAVE_LIBATOMIC) 37 | 38 | add_archer_testsuite(check-libarcher "Running libarcher tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS archer LLVMArcher) 39 | 40 | # Configure the lit.site.cfg.in file 41 | set(AUTO_GEN_COMMENT "## Autogenerated by libarcher configuration.\n# Do not edit!") 42 | configure_file(lit.site.cfg.in lit.site.cfg @ONLY) 43 | -------------------------------------------------------------------------------- /test/ompt/synchronization/taskgroup.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | 5 | #include "callback.h" 6 | #include 7 | #include 8 | 9 | int main() 10 | { 11 | int condition=0; 12 | int x=0; 13 | #pragma omp parallel num_threads(2) 14 | { 15 | #pragma omp master 16 | { 17 | #pragma omp taskgroup 18 | { 19 | print_current_address(1); 20 | #pragma omp task 21 | { 22 | #pragma omp atomic 23 | x++; 24 | } 25 | } 26 | print_current_address(2); 27 | } 28 | } 29 | 30 | 31 | // Check if libomp supports the callbacks for this test. 32 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_master' 33 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 34 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule' 35 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel' 36 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin' 37 | 38 | 39 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 40 | 41 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskgroup_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 42 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 43 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 44 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]] 45 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]] 46 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/parallel_region.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | 6 | int main() 7 | { 8 | int x = 0; 9 | 10 | //implicit barrier at end of a parallel region 11 | #pragma omp parallel num_threads(2) 12 | { 13 | #pragma omp atomic 14 | x++; 15 | } 16 | print_fuzzy_address(); 17 | 18 | 19 | // Check if libomp supports the callbacks for this test. 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 22 | 23 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 24 | 25 | // master thread implicit barrier at parallel end 26 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 27 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 28 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 29 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 30 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 31 | 32 | 33 | // worker thread implicit barrier at parallel end 34 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 35 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 36 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 37 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /test/ompt/cancel/cancel_parallel.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile && env OMP_CANCELLATION=true %libomp-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // Current GOMP interface implementation does not support cancellation 4 | // XFAIL: gcc 5 | 6 | #include "callback.h" 7 | #include "omp.h" 8 | 9 | int main() { 10 | #pragma omp parallel num_threads(2) 11 | { 12 | if (omp_get_thread_num() == 0) { 13 | print_fuzzy_address_blocks(get_ompt_label_address(1)); 14 | #pragma omp cancel parallel 15 | define_ompt_label(1); 16 | // We cannot print at this location because the parallel region is cancelled! 17 | } else { 18 | delay(100); 19 | print_fuzzy_address_blocks(get_ompt_label_address(2)); 20 | #pragma omp cancellation point parallel 21 | define_ompt_label(2); 22 | // We cannot print at this location because the parallel region is cancelled! 23 | } 24 | } 25 | 26 | // Check if libomp supports the callbacks for this test. 27 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 28 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel' 29 | 30 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 31 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no 32 | // CHECK-DAG: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_parallel|ompt_cancel_activated=17, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 33 | // CHECK-DAG: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 34 | 35 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin 36 | // CHECK-DAG: {{^}}[[THREAD_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_parallel|ompt_cancel_detected=33, codeptr_ra=[[OTHER_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 37 | // CHECK-DAG: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[OTHER_RETURN_ADDRESS]] 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /test/ompt/parallel/dynamic_enough_threads.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | 5 | int main() 6 | { 7 | omp_set_dynamic(1); 8 | 9 | #pragma omp parallel num_threads(4) 10 | { 11 | print_ids(0); 12 | print_ids(1); 13 | } 14 | print_fuzzy_address(1); 15 | 16 | // Check if libomp supports the callbacks for this test. 17 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin' 18 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_end' 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 22 | 23 | //team-size of 1-4 is expected 24 | 25 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 26 | 27 | // make sure initial data pointers are null 28 | // CHECK-NOT: 0: parallel_data initially not null 29 | // CHECK-NOT: 0: task_data initially not null 30 | // CHECK-NOT: 0: thread_data initially not null 31 | 32 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, invoker=[[PARALLEL_INVOKER:[0-9]+]] 33 | 34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]], team_size={{[1-4]}} 35 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 36 | // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]] 37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 38 | 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], invoker=[[PARALLEL_INVOKER]] 40 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /test/ompt/synchronization/lock.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | 6 | int main() 7 | { 8 | //need to use an OpenMP construct so that OMPT will be initalized 9 | #pragma omp parallel num_threads(1) 10 | print_ids(0); 11 | 12 | omp_lock_t lock; 13 | printf("%" PRIu64 ": &lock: %" PRIu64 "\n", ompt_get_thread_data()->value, (uint64_t) &lock); 14 | omp_init_lock(&lock); 15 | print_current_address(1); 16 | omp_set_lock(&lock); 17 | print_current_address(2); 18 | omp_unset_lock(&lock); 19 | print_current_address(3); 20 | omp_destroy_lock(&lock); 21 | print_current_address(4); 22 | 23 | 24 | // Check if libomp supports the callbacks for this test. 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 27 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 28 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 29 | 30 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 31 | 32 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: &lock: [[WAIT_ID:[0-9]+]] 33 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_init_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 34 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 36 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 37 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 39 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 40 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 41 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /test/ompt/parallel/dynamic_not_enough_threads.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile && env OMP_THREAD_LIMIT=2 %libomp-run | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | 5 | int main() 6 | { 7 | omp_set_dynamic(1); 8 | 9 | #pragma omp parallel num_threads(4) 10 | { 11 | print_ids(0); 12 | print_ids(1); 13 | } 14 | print_fuzzy_address(1); 15 | 16 | // Check if libomp supports the callbacks for this test. 17 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin' 18 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_end' 19 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' 20 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' 21 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 22 | 23 | //team-size of 1-4 is expected 24 | 25 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 26 | 27 | // make sure initial data pointers are null 28 | // CHECK-NOT: 0: parallel_data initially not null 29 | // CHECK-NOT: 0: task_data initially not null 30 | // CHECK-NOT: 0: thread_data initially not null 31 | 32 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, invoker=[[PARALLEL_INVOKER:[0-9]+]] 33 | 34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]], team_size={{[1-4]}} 35 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 36 | // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]] 37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 38 | 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], invoker=[[PARALLEL_INVOKER]] 40 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /test/ompt/synchronization/test_nest_lock.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | omp_nest_lock_t nest_lock; 10 | omp_init_nest_lock(&nest_lock); 11 | 12 | omp_test_nest_lock(&nest_lock); 13 | omp_unset_nest_lock(&nest_lock); 14 | 15 | omp_set_nest_lock(&nest_lock); 16 | omp_test_nest_lock(&nest_lock); 17 | omp_unset_nest_lock(&nest_lock); 18 | omp_unset_nest_lock(&nest_lock); 19 | 20 | omp_destroy_nest_lock(&nest_lock); 21 | 22 | // Check if libomp supports the callbacks for this test. 23 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 24 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 27 | 28 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 29 | 30 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_nest_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 31 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 32 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 33 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 36 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_prev: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra={{0x[0-f]+}} 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | configure_file(clang-archer.in clang-archer) 51 | configure_file(clang-archer++.in clang-archer++) 52 | install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/clang-archer ${CMAKE_CURRENT_BINARY_DIR}/clang-archer++ DESTINATION bin) 53 | -------------------------------------------------------------------------------- /test/ompt/cancel/cancel_worksharing.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile && env OMP_CANCELLATION=true %libomp-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // Current GOMP interface implementation does not support cancellation; icc 16 does not distinguish between sections and loops 4 | // XFAIL: gcc, icc-16 5 | 6 | #include "callback.h" 7 | #include 8 | 9 | int main() 10 | { 11 | int condition=0; 12 | #pragma omp parallel num_threads(2) 13 | { 14 | int x = 0; 15 | int i; 16 | #pragma omp for 17 | for(i = 0; i < 2; i++) 18 | { 19 | if(i == 0) 20 | { 21 | x++; 22 | OMPT_SIGNAL(condition); 23 | #pragma omp cancel for 24 | } 25 | else 26 | { 27 | x++; 28 | OMPT_WAIT(condition,1); 29 | delay(10000); 30 | #pragma omp cancellation point for 31 | } 32 | } 33 | } 34 | #pragma omp parallel num_threads(2) 35 | { 36 | #pragma omp sections 37 | { 38 | #pragma omp section 39 | { 40 | OMPT_SIGNAL(condition); 41 | #pragma omp cancel sections 42 | } 43 | #pragma omp section 44 | { 45 | OMPT_WAIT(condition,2); 46 | delay(10000); 47 | #pragma omp cancellation point sections 48 | } 49 | } 50 | } 51 | 52 | 53 | // Check if libomp supports the callbacks for this test. 54 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 55 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel' 56 | 57 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 58 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_create: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no 59 | 60 | // cancel for and sections 61 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_do|ompt_cancel_activated=20, codeptr_ra={{0x[0-f]*}} 62 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_sections|ompt_cancel_activated=18, codeptr_ra={{0x[0-f]*}} 63 | // CHECK: {{^}}[[OTHER_THREAD_ID:[0-9]+]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_do|ompt_cancel_detected=36, codeptr_ra={{0x[0-f]*}} 64 | // CHECK: {{^}}[[OTHER_THREAD_ID:[0-9]+]]: ompt_event_cancel: task_data=[[TASK_ID:[0-9]+]], flags=ompt_cancel_sections|ompt_cancel_detected=34, codeptr_ra={{0x[0-f]*}} 65 | 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /lib/Support/Util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #include "archer/Util.h" 51 | 52 | void split(std::vector *tokens, char *str, std::string split_value) 53 | { 54 | char *pch = strtok(str, split_value.c_str()); 55 | while (pch != NULL) 56 | { 57 | tokens->push_back(std::string(pch)); 58 | pch = strtok(NULL, split_value.c_str()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /include/archer/RegisterPasses.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #ifndef ARCHER_REGISTER_PASSES_H 51 | #define ARCHER_REGISTER_PASSES_H 52 | 53 | #include "llvm/IR/LegacyPassManager.h" 54 | 55 | namespace llvm { 56 | namespace legacy { 57 | class PassManagerBase; 58 | } 59 | 60 | void initializeArcherPasses(llvm::PassRegistry &Registry); 61 | void registerArcherPasses(llvm::legacy::PassManagerBase &PM); 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /test/parallel/parallel-firstprivate.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) firstprivate(var) 59 | { 60 | var = 1; 61 | } 62 | 63 | fprintf(stderr, "DONE\n"); 64 | // var should still be 0! 65 | return var; 66 | } 67 | 68 | // CHECK: DONE 69 | -------------------------------------------------------------------------------- /test/critical/critical.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) shared(var) 59 | { 60 | #pragma omp critical 61 | { 62 | var++; 63 | } 64 | } 65 | 66 | fprintf(stderr, "DONE\n"); 67 | int error = (var != 2); 68 | return error; 69 | } 70 | 71 | // CHECK: DONE 72 | -------------------------------------------------------------------------------- /cmake/FindArcher.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | include(FindPackageHandleStandardArgs) 51 | 52 | set(LIBARCHER_LIB LLVMArcher.so) 53 | find_path(LIBARCHER_LIB_PATH 54 | NAMES LLVMArcher.so 55 | HINTS ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib ${LLVM_ROOT}/lib ${CMAKE_INSTALL_PREFIX}/lib 56 | ) 57 | find_path(LIBARCHER_LIB_PATH LLVMArcher.so) 58 | 59 | find_package_handle_standard_args(LIBARCHER DEFAULT_MSG LIBARCHER_LIB_PATH) 60 | -------------------------------------------------------------------------------- /rtl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | add_library(archer SHARED ompt-tsan.cpp counter.cpp) 51 | add_library(archer_static STATIC ompt-tsan.cpp counter.cpp) 52 | add_library(farcher SHARED ftsan.c) 53 | add_library(farcher_static STATIC ftsan.c) 54 | 55 | install(TARGETS archer archer_static farcher farcher_static 56 | LIBRARY DESTINATION lib 57 | ARCHIVE DESTINATION lib) 58 | 59 | install(FILES suppressions.txt DESTINATION share/archer) 60 | -------------------------------------------------------------------------------- /test/parallel/parallel-simple.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) shared(var) 59 | { 60 | if (omp_get_thread_num() == 1) { 61 | var++; 62 | } 63 | } // implicit barrier 64 | 65 | var++; 66 | 67 | fprintf(stderr, "DONE\n"); 68 | int error = (var != 2); 69 | return error; 70 | } 71 | 72 | // CHECK: DONE 73 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: cpp 3 | dist: xenial 4 | addons: 5 | apt: 6 | sources: 7 | - ubuntu-toolchain-r-test 8 | packages: 9 | - gcc-5 10 | - g++-5 11 | 12 | env: 13 | global: 14 | - UBUNTU_VERSION=16.04 15 | - CMAKE_VERSION_MAJOR=v3.11 16 | - CMAKE_VERSION=3.11.0 17 | - NINJA_VERSION=v1.7.2 18 | - LLVM_VERSION=6.0.1 19 | - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz 20 | - LLVM_BRANCH=6.0.1 21 | - export PATH=$HOME/usr/bin:$PATH 22 | - export LD_LIBRARY_PATH=$HOME/usr/lib:$LD_LIBRARY_PATH 23 | 24 | before_install: 25 | - sudo pip install --upgrade pip 26 | - sudo pip install lit 27 | 28 | install: 29 | - cd $HOME/build 30 | # Install LLVM/Clang 6.0 31 | - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-$UBUNTU_VERSION.tar.xz -O $LLVM_ARCHIVE_PATH 32 | - mkdir $HOME/usr 33 | - tar xf $LLVM_ARCHIVE_PATH -C $HOME/usr --strip-components 1 34 | # Obtain and install cmake 35 | - wget https://cmake.org/files/$CMAKE_VERSION_MAJOR/cmake-$CMAKE_VERSION-Linux-x86_64.sh 36 | - chmod +x cmake-$CMAKE_VERSION-Linux-x86_64.sh 37 | - ./cmake-$CMAKE_VERSION-Linux-x86_64.sh --prefix=$HOME/usr --exclude-subdir 38 | # Obtain and install ninja 39 | - curl -L https://github.com/ninja-build/ninja/releases/download/$NINJA_VERSION/ninja-linux.zip -o ninja-linux.zip 40 | - unzip ninja-linux.zip -d $HOME/usr/bin 41 | # Install testing tools 42 | - git clone --recursive https://github.com/PRUNERS/TestingTools.git 43 | - cd TestingTools 44 | - mkdir build && cd build 45 | - cmake -G Ninja -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_INSTALL_PREFIX:PATH=$HOME/usr -DCMAKE_CXX_FLAGS="-fno-rtti" .. 46 | - ninja && ninja install 47 | 48 | script: 49 | - cd $HOME/build/PRUNERS 50 | - rm -rf openmp 51 | - git clone -b release_60 https://github.com/llvm-mirror/openmp.git 52 | - export OPENMP_INSTALL=$HOME/usr 53 | - cd openmp 54 | - mkdir build && cd build 55 | - cmake -G Ninja -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX:PATH=$OPENMP_INSTALL .. 56 | - ninja -j4 -l4 57 | - ninja install 58 | - export ARCHER_INSTALL=$HOME/usr 59 | - cd $HOME/build/PRUNERS/archer 60 | - rm -rf build 61 | - mkdir -p build && cd build 62 | - cmake -G Ninja -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -D CMAKE_INSTALL_PREFIX:PATH=${ARCHER_INSTALL} -D OMP_PREFIX:PATH=$OPENMP_INSTALL -D ARCHER_LLVM_LIT_EXECUTABLE=$HOME/usr/bin/llvm-lit -D ARCHER_LLVM_TOOLS_DIR=$HOME/usr/bin .. 63 | - ninja -j4 -l4 64 | - ninja install 65 | - ninja check-libarcher 66 | 67 | notifications: 68 | email: false 69 | slack: 70 | rooms: 71 | - pruners:aXHVdiVFtqtMfzNW4IutZNDW 72 | on_success: always 73 | on_failure: always 74 | -------------------------------------------------------------------------------- /test/critical/lock.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | omp_lock_t lock; 59 | omp_init_lock(&lock); 60 | 61 | #pragma omp parallel num_threads(2) shared(var) 62 | { 63 | omp_set_lock(&lock); 64 | var++; 65 | omp_unset_lock(&lock); 66 | } 67 | 68 | omp_destroy_lock(&lock); 69 | 70 | fprintf(stderr, "DONE\n"); 71 | int error = (var != 2); 72 | return error; 73 | } 74 | 75 | // CHECK: DONE 76 | -------------------------------------------------------------------------------- /test/worksharing/ordered.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | #define NUM_THREADS 2 55 | 56 | int main(int argc, char* argv[]) 57 | { 58 | int var = 0; 59 | int i; 60 | 61 | #pragma omp parallel for ordered num_threads(NUM_THREADS) shared(var) 62 | for (i = 0; i < NUM_THREADS; i++) { 63 | #pragma omp ordered 64 | { 65 | var++; 66 | } 67 | } 68 | 69 | fprintf(stderr, "DONE\n"); 70 | int error = (var != 2); 71 | return error; 72 | } 73 | 74 | // CHECK: DONE 75 | -------------------------------------------------------------------------------- /lib/Support/RegisterPasses.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #include "archer/LinkAllPasses.h" 51 | #include "llvm/Analysis/CFGPrinter.h" 52 | #include "llvm/IR/LegacyPassManager.h" 53 | #include "llvm/Transforms/IPO/PassManagerBuilder.h" 54 | #include "llvm/Transforms/Scalar.h" 55 | #include "llvm/Transforms/Vectorize.h" 56 | 57 | namespace llvm { 58 | void initializeArcherPasses(llvm::PassRegistry &Registry) { 59 | initializeInstrumentParallelPass(Registry); 60 | } 61 | 62 | void registerArcherPasses(llvm::legacy::PassManagerBase &PM) { 63 | PM.add(createInstrumentParallelPass()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /test/barrier/barrier.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) shared(var) 59 | { 60 | if (omp_get_thread_num() == 0) { 61 | var++; 62 | } 63 | 64 | #pragma omp barrier 65 | 66 | if (omp_get_thread_num() == 1) { 67 | var++; 68 | } 69 | } 70 | 71 | fprintf(stderr, "DONE\n"); 72 | int error = (var != 2); 73 | return error; 74 | } 75 | 76 | // CHECK: DONE 77 | -------------------------------------------------------------------------------- /test/reduction/parallel-reduction.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run| FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | // Number of threads is empirical: We need enough threads so that 59 | // the reduction is really performed hierarchically in the barrier! 60 | #pragma omp parallel num_threads(5) reduction(+: var) 61 | { 62 | var = 1; 63 | } 64 | 65 | fprintf(stderr, "DONE\n"); 66 | int error = (var != 5); 67 | return error; 68 | } 69 | 70 | // CHECK: DONE 71 | -------------------------------------------------------------------------------- /test/races/parallel-simple.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) shared(var) 59 | { 60 | var++; 61 | } 62 | 63 | int error = (var != 2); 64 | fprintf(stderr, "DONE\n"); 65 | return error; 66 | } 67 | 68 | // CHECK: WARNING: ThreadSanitizer: data race 69 | // CHECK: Write of size 4 70 | // CHECK: #0 .omp_outlined. 71 | // CHECK: Previous write of size 4 72 | // CHECK: #0 .omp_outlined. 73 | // CHECK: DONE 74 | -------------------------------------------------------------------------------- /cmake/FindOmpt.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | include(FindPackageHandleStandardArgs) 51 | 52 | # use an explicitly given omp path first 53 | FIND_PATH(OMPT_INCLUDE_PATH ompt.h 54 | PATHS ${OMP_PREFIX}/include ${LLVM_ROOT}/include ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src ${CMAKE_BINARY_DIR}/include /usr /usr/local} 55 | PATH_SUFFIXES include NO_DEFAULT_PATH) 56 | # if not-found, try again at cmake locations 57 | FIND_PATH(OMPT_INCLUDE_PATH ompt.h) 58 | 59 | find_package_handle_standard_args(OMPT DEFAULT_MSG OMPT_INCLUDE_PATH ) 60 | -------------------------------------------------------------------------------- /test/task/task-create.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | var++; 63 | #pragma omp task shared(var) 64 | { 65 | var++; 66 | } 67 | 68 | // Give other thread time to steal the task. 69 | sleep(1); 70 | } 71 | 72 | fprintf(stderr, "DONE\n"); 73 | int error = (var != 2); 74 | return error; 75 | } 76 | 77 | // CHECK: DONE 78 | -------------------------------------------------------------------------------- /test/ompt/tasks/taskyield.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // Current GOMP interface implements taskyield as stub 4 | // XFAIL: gcc 5 | 6 | #include "callback.h" 7 | #include 8 | #include 9 | 10 | int main() 11 | { 12 | int condition=0, x=0; 13 | #pragma omp parallel num_threads(2) 14 | { 15 | #pragma omp master 16 | { 17 | #pragma omp task shared(condition) 18 | { 19 | OMPT_SIGNAL(condition); 20 | OMPT_WAIT(condition,2); 21 | } 22 | OMPT_WAIT(condition,1); 23 | #pragma omp task shared(x) 24 | { 25 | x++; 26 | } 27 | printf("%" PRIu64 ": before yield\n", ompt_get_thread_data()->value); 28 | #pragma omp taskyield 29 | printf("%" PRIu64 ": after yield\n", ompt_get_thread_data()->value); 30 | OMPT_SIGNAL(condition); 31 | } 32 | } 33 | 34 | 35 | // Check if libomp supports the callbacks for this test. 36 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 37 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule' 38 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 39 | 40 | 41 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 42 | 43 | // make sure initial data pointers are null 44 | // CHECK-NOT: 0: new_task_data initially not null 45 | 46 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID:[0-9]+]], team_size={{[0-9]+}}, thread_num={{[0-9]+}} 47 | 48 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[WORKER_TASK:[0-9]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=no 49 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[MAIN_TASK:[0-9]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=no 50 | 51 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[IMPLICIT_TASK_ID]], second_task_id=[[MAIN_TASK]], prior_task_status=ompt_task_yield=2 52 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_schedule: first_task_id=[[MAIN_TASK]], second_task_id=[[IMPLICIT_TASK_ID]], prior_task_status=ompt_task_complete=1 53 | 54 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_task_schedule: first_task_id={{[0-9]+}}, second_task_id=[[WORKER_TASK]], prior_task_status=ompt_task_others=4 55 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_task_schedule: first_task_id=[[WORKER_TASK]], second_task_id={{[0-9]+}}, prior_task_status=ompt_task_complete=1 56 | 57 | 58 | 59 | 60 | 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /test/ompt/synchronization/test_lock.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | omp_lock_t lock; 10 | omp_init_lock(&lock); 11 | print_current_address(1); 12 | 13 | omp_test_lock(&lock); 14 | print_current_address(2); 15 | omp_unset_lock(&lock); 16 | print_current_address(3); 17 | 18 | omp_set_lock(&lock); 19 | print_current_address(4); 20 | omp_test_lock(&lock); 21 | print_current_address(5); 22 | omp_unset_lock(&lock); 23 | print_current_address(6); 24 | 25 | omp_destroy_lock(&lock); 26 | print_current_address(7); 27 | 28 | // Check if libomp supports the callbacks for this test. 29 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 30 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 31 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 32 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 33 | 34 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 35 | 36 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 37 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 40 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 41 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 42 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 43 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 44 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 45 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 46 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 47 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 48 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 49 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 50 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 51 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /test/races/critical-unrelated.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | #pragma omp parallel num_threads(2) shared(var) 59 | { 60 | #pragma omp critical 61 | { 62 | // Dummy region. 63 | } 64 | 65 | var++; 66 | } 67 | 68 | fprintf(stderr, "DONE\n"); 69 | } 70 | 71 | // CHECK: WARNING: ThreadSanitizer: data race 72 | // CHECK: Write of size 4 73 | // CHECK: #0 .omp_outlined. 74 | // CHECK: Previous write of size 4 75 | // CHECK: #0 .omp_outlined. 76 | // CHECK: DONE 77 | -------------------------------------------------------------------------------- /include/archer/Util.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #ifndef UTIL_H 51 | #define UTIL_H 52 | 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | template 61 | std::string NumberToString ( T Number ) 62 | { 63 | std::ostringstream ss; 64 | ss << Number; 65 | return ss.str(); 66 | } 67 | 68 | template T StringToNumber ( std::string str ) 69 | { 70 | std::istringstream ss(str); 71 | T val; 72 | ss >> val; 73 | return val; 74 | } 75 | 76 | void split(std::vector *tokens, char *str, std::string split_value); 77 | 78 | #endif // UTIL_H 79 | -------------------------------------------------------------------------------- /test/ompt/tasks/dependences.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | 5 | #include "callback.h" 6 | #include 7 | #include 8 | #include 9 | 10 | int main() 11 | { 12 | int x = 0; 13 | #pragma omp parallel num_threads(2) 14 | { 15 | #pragma omp master 16 | { 17 | print_ids(0); 18 | #pragma omp task depend(out:x) 19 | { 20 | x++; 21 | delay(100); 22 | } 23 | print_fuzzy_address(1); 24 | print_ids(0); 25 | 26 | #pragma omp task depend(in:x) 27 | { 28 | x = -1; 29 | } 30 | print_ids(0); 31 | } 32 | } 33 | 34 | x++; 35 | 36 | 37 | // Check if libomp supports the callbacks for this test. 38 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 39 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_dependences' 40 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_dependence' 41 | 42 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 43 | 44 | // make sure initial data pointers are null 45 | // CHECK-NOT: 0: new_task_data initially not null 46 | 47 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 48 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:0x[0-f]+]], reenter_frame=[[NULL]] 49 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[FIRST_TASK:[0-f]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, task_type=ompt_task_explicit=4, has_dependences=yes 50 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependences: task_id=[[FIRST_TASK]], deps={{0x[0-f]+}}, ndeps=1 51 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 52 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]] 53 | 54 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter={{0x[0-f]+}}, new_task_id=[[SECOND_TASK:[0-f]+]], codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=yes 55 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependences: task_id=[[SECOND_TASK]], deps={{0x[0-f]+}}, ndeps=1 56 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependence_pair: first_task_id=[[FIRST_TASK]], second_task_id=[[SECOND_TASK]] 57 | // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]] 58 | 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /test/task/task-taskwait.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task shared(var) 63 | { 64 | var++; 65 | } 66 | 67 | // Give other thread time to steal the task. 68 | sleep(1); 69 | 70 | #pragma omp taskwait 71 | var++; 72 | } 73 | 74 | fprintf(stderr, "DONE\n"); 75 | int error = (var != 2); 76 | return error; 77 | } 78 | 79 | // CHECK: DONE 80 | -------------------------------------------------------------------------------- /test/critical/lock-nested.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | omp_nest_lock_t lock; 59 | omp_init_nest_lock(&lock); 60 | 61 | #pragma omp parallel num_threads(2) shared(var) 62 | { 63 | omp_set_nest_lock(&lock); 64 | omp_set_nest_lock(&lock); 65 | var++; 66 | omp_unset_nest_lock(&lock); 67 | omp_unset_nest_lock(&lock); 68 | } 69 | 70 | omp_destroy_nest_lock(&lock); 71 | 72 | fprintf(stderr, "DONE\n"); 73 | int error = (var != 2); 74 | return error; 75 | } 76 | 77 | // CHECK: DONE 78 | -------------------------------------------------------------------------------- /test/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @AUTO_GEN_COMMENT@ 2 | 3 | config.test_c_compiler = "@LIBARCHER_TEST_C_COMPILER@" 4 | config.test_cxx_compiler = "@LIBARCHER_TEST_CXX_COMPILER@" 5 | config.test_compiler_features = @LIBARCHER_TEST_COMPILER_FEATURES@ 6 | config.test_filecheck = "@LIBARCHER_FILECHECK_EXECUTABLE@" 7 | config.test_archer_flags = "@LIBARCHER_TEST_ARCHER_FLAGS@" 8 | config.test_extra_flags = "@LIBARCHER_TEST_FLAGS@" 9 | config.libarcher_obj_root = "@CMAKE_CURRENT_BINARY_DIR@" 10 | config.omp_library_dir = "@OMP_LIB_PATH@" 11 | config.omp_header_dir = "@OMP_INCLUDE_PATH@" 12 | config.operating_system = "@CMAKE_SYSTEM_NAME@" 13 | config.has_ompt = @LIBARCHER_OMPT_SUPPORT@ 14 | config.has_libm = @LIBARCHER_HAVE_LIBM@ 15 | config.has_libatomic = @LIBARCHER_HAVE_LIBATOMIC@ 16 | config.archer_tools_dir = "@LIBARCHER_TOOLS_DIR@" 17 | config.archer_library_dir = "@LIBARCHER_LIB_PATH@" 18 | config.archer_runtime_dir = "@LIBARCHER_RUNTIME_PATH@" 19 | config.archer_library = "@LIBARCHER_LIB@" 20 | config.archer_runtime = "@LIBARCHER_RTL@" 21 | config.has_archer_library = @LIBARCHER_HAVE_ARCHER_LIBRARY@ 22 | config.has_archer_runtime = @LIBARCHER_HAVE_ARCHER_RUNTIME@ 23 | config.suppressions_archer_runtime_file = "@LIBARCHER_ARCHER_RUNTIME_SUPPRESSIONS_FILE@" 24 | 25 | # print("\nStart") 26 | # print("config.test_c_compiler: " + str(config.test_c_compiler)) 27 | # print("config.test_cxx_compiler: " + str(config.test_cxx_compiler)) 28 | # print("config.test_compiler_features: " + str(config.test_compiler_features)) 29 | # print("config.test_filecheck: " + str(config.test_filecheck)) 30 | # print("config.test_archer_flags: " + str(config.test_archer_flags)) 31 | # print("config.test_extra_flags: " + str(config.test_extra_flags)) 32 | # print("config.libarcher_obj_root: " + str(config.libarcher_obj_root)) 33 | # print("config.omp_library_dir: " + str(config.omp_library_dir)) 34 | # print("config.omp_header_dir: " + str(config.omp_header_dir)) 35 | # print("config.operating_system: " + str(config.operating_system)) 36 | # print("config.has_ompt:" + str(config.has_ompt)) 37 | # print("config.has_libm:" + str(config.has_libm)) 38 | # print("config.has_libatomic: " + str(config.has_libatomic)) 39 | # print("config.archer_tools_dir" + str(config.archer_tools_dir)) 40 | # print("config.archer_library_dir: " + str(config.archer_library_dir)) 41 | # print("config.archer_runtime_dir: " + str(config.archer_runtime_dir)) 42 | # print("config.archer_library: " + str(config.archer_library)) 43 | # print("config.archer_runtime: " + str(config.archer_runtime)) 44 | # print("config.has_archer_library: " + str(config.has_archer_library)) 45 | # print("config.has_archer_runtime: " + str(config.has_archer_runtime)) 46 | # print("config.suppressions_archer_runtime_file: " + str(config.suppressions_archer_runtime_file)) 47 | # print("End\n") 48 | 49 | # Let the main config do the real work. 50 | lit_config.load_config(config, "@LIBARCHER_BASE_DIR@/test/lit.cfg") 51 | -------------------------------------------------------------------------------- /test/parallel/parallel-simple2.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | // Create team of threads so that there is no implicit happens before 59 | // when creating the thread. 60 | #pragma omp parallel num_threads(2) 61 | { } 62 | 63 | var++; 64 | 65 | #pragma omp parallel num_threads(2) shared(var) 66 | { 67 | if (omp_get_thread_num() == 1) { 68 | var++; 69 | } 70 | } // implicit barrier 71 | 72 | fprintf(stderr, "DONE\n"); 73 | int error = (var != 2); 74 | return error; 75 | } 76 | 77 | // CHECK: DONE 78 | -------------------------------------------------------------------------------- /test/task/task-taskgroup.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp taskgroup 63 | { 64 | #pragma omp task shared(var) 65 | { 66 | var++; 67 | } 68 | 69 | // Give other thread time to steal the task. 70 | sleep(1); 71 | } 72 | 73 | var++; 74 | } 75 | 76 | fprintf(stderr, "DONE\n"); 77 | int error = (var != 2); 78 | return error; 79 | } 80 | 81 | // CHECK: DONE 82 | -------------------------------------------------------------------------------- /test/ompt/synchronization/nest_lock.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | 6 | int main() 7 | { 8 | //need to use an OpenMP construct so that OMPT will be initalized 9 | #pragma omp parallel num_threads(1) 10 | print_ids(0); 11 | 12 | omp_nest_lock_t nest_lock; 13 | printf("%" PRIu64 ": &nest_lock: %lli\n", ompt_get_thread_data()->value, (long long) &nest_lock); 14 | omp_init_nest_lock(&nest_lock); 15 | print_current_address(1); 16 | omp_set_nest_lock(&nest_lock); 17 | print_current_address(2); 18 | omp_set_nest_lock(&nest_lock); 19 | print_current_address(3); 20 | omp_unset_nest_lock(&nest_lock); 21 | print_current_address(4); 22 | omp_unset_nest_lock(&nest_lock); 23 | print_current_address(5); 24 | omp_destroy_nest_lock(&nest_lock); 25 | print_current_address(6); 26 | 27 | 28 | // Check if libomp supports the callbacks for this test. 29 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 30 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 31 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 32 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 33 | 34 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 35 | 36 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_nest_lock: wait_id=[[WAIT_ID:[0-9]+]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 37 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 40 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 41 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 42 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 43 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 44 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_prev: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 45 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 46 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 47 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 48 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_nest_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 49 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /test/ompt/synchronization/test_nest_lock_parallel.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | omp_nest_lock_t nest_lock; 10 | omp_init_nest_lock(&nest_lock); 11 | 12 | #pragma omp parallel num_threads(2) 13 | { 14 | #pragma omp master 15 | { 16 | omp_set_nest_lock(&nest_lock); 17 | print_current_address(1); 18 | } 19 | #pragma omp barrier 20 | omp_test_nest_lock(&nest_lock); //should fail for non-master 21 | print_current_address(2); 22 | #pragma omp barrier 23 | #pragma omp master 24 | { 25 | omp_unset_nest_lock(&nest_lock); 26 | print_current_address(3); 27 | omp_unset_nest_lock(&nest_lock); 28 | print_current_address(4); 29 | } 30 | } 31 | 32 | omp_destroy_nest_lock(&nest_lock); 33 | 34 | // Check if libomp supports the callbacks for this test. 35 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire' 36 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired' 37 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released' 38 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock' 39 | 40 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 41 | 42 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 43 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_first: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 44 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 45 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 46 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]] 47 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 48 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_prev: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 49 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 50 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_nest_lock_last: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 51 | // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 52 | 53 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_nest_lock: wait_id=[[WAIT_ID]] 54 | 55 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_wait_nest_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 56 | // CHECK-NOT: {{^}}[[THREAD_ID]]: ompt_event_acquired_nest_lock_next: wait_id=[[WAIT_ID]] 57 | // CHECK-NEXT: {{^}}[[THREAD_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /test/task/task-barrier.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | { 61 | #pragma omp master 62 | { 63 | #pragma omp task shared(var) 64 | { 65 | var++; 66 | } 67 | 68 | // Give other thread time to steal the task. 69 | sleep(1); 70 | } 71 | 72 | #pragma omp barrier 73 | 74 | #pragma omp master 75 | { 76 | var++; 77 | } 78 | } 79 | 80 | fprintf(stderr, "DONE\n"); 81 | int error = (var != 2); 82 | return error; 83 | } 84 | 85 | // CHECK: DONE 86 | -------------------------------------------------------------------------------- /test/task/task-taskwait-nested.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task 63 | { 64 | #pragma omp task shared(var) 65 | { 66 | var++; 67 | } 68 | #pragma omp taskwait 69 | } 70 | 71 | // Give other thread time to steal the task and execute its child. 72 | sleep(1); 73 | 74 | #pragma omp taskwait 75 | var++; 76 | } 77 | 78 | fprintf(stderr, "DONE\n"); 79 | int error = (var != 2); 80 | return error; 81 | } 82 | 83 | // CHECK: DONE 84 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/base.h: -------------------------------------------------------------------------------- 1 | #include "callback.h" 2 | #include 3 | 4 | int main() 5 | { 6 | unsigned int i; 7 | 8 | #pragma omp parallel for num_threads(4) schedule(SCHEDULE) 9 | for (i = 0; i < 4; i++) { 10 | } 11 | 12 | // Check if libomp supports the callbacks for this test. 13 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' 14 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' 15 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 16 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' 17 | 18 | 19 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 20 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=0x{{[0-f]+}}, invoker={{[0-9]+}} 21 | 22 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 23 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra= 24 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 25 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 26 | 27 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 28 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra= 29 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 30 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 31 | 32 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 33 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra= 34 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 35 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 36 | 37 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] 38 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[IMPLICIT_TASK_ID]], codeptr_ra= 39 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] 40 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]] 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /test/task/task-taskgroup-nested.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp taskgroup 63 | { 64 | #pragma omp task 65 | { 66 | #pragma omp task shared(var) 67 | { 68 | var++; 69 | } 70 | } 71 | 72 | // Give other thread time to steal the task and execute its child. 73 | sleep(1); 74 | } 75 | 76 | var++; 77 | } 78 | 79 | fprintf(stderr, "DONE\n"); 80 | int error = (var != 2); 81 | return error; 82 | } 83 | 84 | // CHECK: DONE 85 | -------------------------------------------------------------------------------- /lib/Archer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #include "archer/RegisterPasses.h" 51 | #include "llvm/Transforms/IPO/PassManagerBuilder.h" 52 | #include "llvm/Support/raw_ostream.h" 53 | 54 | namespace { 55 | 56 | /// @brief Initialize Archer passes when library is loaded. 57 | /// 58 | /// We use the constructor of a statically declared object to initialize the 59 | /// different Archer passes right after the Archer library is loaded. This ensures 60 | /// that the Archer passes are available e.g. in the 'opt' tool. 61 | class StaticInitializer { 62 | public: 63 | StaticInitializer() { 64 | llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry(); 65 | llvm::initializeArcherPasses(Registry); 66 | } 67 | }; 68 | static StaticInitializer InitializeEverything; 69 | } // end of anonymous namespace. 70 | -------------------------------------------------------------------------------- /test/races/lock-unrelated.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | omp_lock_t lock; 59 | omp_init_lock(&lock); 60 | 61 | #pragma omp parallel num_threads(2) shared(var) 62 | { 63 | omp_set_lock(&lock); 64 | // Dummy locking. 65 | omp_unset_lock(&lock); 66 | 67 | var++; 68 | } 69 | 70 | omp_destroy_lock(&lock); 71 | 72 | int error = (var != 2); 73 | fprintf(stderr, "DONE\n"); 74 | return error; 75 | } 76 | 77 | // CHECK: WARNING: ThreadSanitizer: data race 78 | // CHECK: Write of size 4 79 | // CHECK: #0 .omp_outlined. 80 | // CHECK: Previous write of size 4 81 | // CHECK: #0 .omp_outlined. 82 | // CHECK: DONE 83 | -------------------------------------------------------------------------------- /test/races/lock-nested-unrelated.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0; 57 | 58 | omp_nest_lock_t lock; 59 | omp_init_nest_lock(&lock); 60 | 61 | #pragma omp parallel num_threads(2) shared(var) 62 | { 63 | omp_set_nest_lock(&lock); 64 | omp_set_nest_lock(&lock); 65 | // Dummy locking. 66 | omp_unset_nest_lock(&lock); 67 | omp_unset_nest_lock(&lock); 68 | 69 | var++; 70 | } 71 | 72 | omp_destroy_nest_lock(&lock); 73 | 74 | fprintf(stderr, "DONE\n"); 75 | } 76 | 77 | // CHECK: WARNING: ThreadSanitizer: data race 78 | // CHECK: Write of size 4 79 | // CHECK: #0 .omp_outlined. 80 | // CHECK: Previous write of size 4 81 | // CHECK: #0 .omp_outlined. 82 | // CHECK: DONE 83 | -------------------------------------------------------------------------------- /test/reduction/parallel-reduction-nowait.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | 54 | int main(int argc, char* argv[]) 55 | { 56 | int var = 0, i; 57 | int sum1 = 0; 58 | int sum2 = 0; 59 | 60 | // Number of threads is empirical: We need enough threads so that 61 | // the reduction is really performed hierarchically in the barrier! 62 | #pragma omp parallel num_threads(5) reduction(+: var) 63 | { 64 | #pragma omp for schedule(static) nowait reduction(+: sum1) 65 | for (i=0; i<5; i++) 66 | sum1+=i; 67 | #pragma omp for schedule(static) reduction(+: sum2) 68 | for (i=0; i<5; i++) 69 | sum2+=i; 70 | 71 | var = sum1 + sum2; 72 | } 73 | 74 | fprintf(stderr, "DONE\n"); 75 | int error = (var != 100); 76 | return error; 77 | } 78 | 79 | // CHECK: DONE 80 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/for_loop.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | int y[] = {0,1,2,3}; 10 | 11 | #pragma omp parallel num_threads(2) 12 | { 13 | //implicit barrier at end of for loop 14 | int i; 15 | #pragma omp for 16 | for (i = 0; i < 4; i++) 17 | { 18 | y[i]++; 19 | } 20 | print_current_address(); 21 | } 22 | 23 | 24 | // Check if libomp supports the callbacks for this test. 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 27 | 28 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 29 | 30 | // master thread implicit barrier at loop end 31 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 32 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 33 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 35 | 36 | // master thread implicit barrier at parallel end 37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 40 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 41 | 42 | 43 | // worker thread explicit barrier 44 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 45 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 46 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 47 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 48 | 49 | // worker thread implicit barrier after parallel 50 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 51 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 52 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 53 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /test/task/task-dependency.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task shared(var) depend(out: var) 63 | { 64 | var++; 65 | } 66 | 67 | #pragma omp task depend(in: var) 68 | { 69 | // FIXME: This is ugly to make the worker task sleep and let the master 70 | // thread execute the second task incrementing var... 71 | sleep(2); 72 | } 73 | 74 | #pragma omp task shared(var) depend(in: var) 75 | { 76 | var++; 77 | } 78 | 79 | // Give other thread time to steal the task. 80 | sleep(1); 81 | } 82 | 83 | fprintf(stderr, "DONE\n"); 84 | int error = (var != 2); 85 | return error; 86 | } 87 | 88 | // CHECK: DONE 89 | -------------------------------------------------------------------------------- /rtl/ftsan.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | void __attribute__((weak)) AnnotateHappensAfter(const char *file, int line, const volatile void *cv){} 51 | void __attribute__((weak)) AnnotateHappensBefore(const char *file, int line, const volatile void *cv){} 52 | void __attribute__((weak)) AnnotateIgnoreWritesBegin(const char *file, int line){} 53 | void __attribute__((weak)) AnnotateIgnoreWritesEnd(const char *file, int line){} 54 | 55 | // This is a Fortran wrapper for TSan Annotation functions. 56 | 57 | void annotatehappensafter_(const char *file, int* line, const volatile void *cv) 58 | { 59 | AnnotateHappensAfter(file, *line, cv);} 60 | void annotatehappensbefore_(const char *file, int *line, const volatile void *cv) 61 | { 62 | AnnotateHappensBefore(file, *line, cv); 63 | } 64 | void annotateignorewritesbegin_(const char *file, int line) 65 | {AnnotateIgnoreWritesBegin(file, line);} 66 | void annotateignorewritesend_(const char *file, int line) 67 | {AnnotateIgnoreWritesEnd(file, line);} 68 | -------------------------------------------------------------------------------- /test/races/task-two.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | #define NUM_THREADS 2 56 | 57 | int main(int argc, char* argv[]) 58 | { 59 | int var = 0; 60 | int i; 61 | 62 | #pragma omp parallel for num_threads(NUM_THREADS) shared(var) schedule(static,1) 63 | { 64 | for (i = 0; i < NUM_THREADS; i++) { 65 | #pragma omp task shared(var) if(0) 66 | { 67 | var++; 68 | // Sleep so that each thread executes one single task. 69 | // sleep(1); 70 | } 71 | } 72 | } 73 | 74 | int error = (var != 2); 75 | fprintf(stderr, "DONE\n"); 76 | return error; 77 | } 78 | 79 | // CHECK: WARNING: ThreadSanitizer: data race 80 | // CHECK: Write of size 4 81 | // CHECK: #0 .omp_outlined. 82 | // CHECK: #1 .omp_task_entry. 83 | // CHECK: Previous write of size 4 84 | // CHECK: #0 .omp_outlined. 85 | // CHECK: #1 .omp_task_entry. 86 | // CHECK: DONE 87 | -------------------------------------------------------------------------------- /test/races/task-taskwait-nested.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task shared(var) 63 | { 64 | #pragma omp task shared(var) 65 | { 66 | var++; 67 | } 68 | } 69 | 70 | // Give other thread time to steal the task and execute its child. 71 | sleep(1); 72 | 73 | // Only directly generated children are guaranteed to be executed. 74 | #pragma omp taskwait 75 | var++; 76 | } 77 | 78 | int error = (var != 2); 79 | fprintf(stderr, "DONE\n"); 80 | return error; 81 | } 82 | 83 | // CHECK: WARNING: ThreadSanitizer: data race 84 | // CHECK: Write of size 4 85 | // CHECK: #0 .omp_outlined. 86 | // CHECK: Previous write of size 4 87 | // CHECK: #0 .omp_outlined. 88 | // CHECK: DONE 89 | -------------------------------------------------------------------------------- /test/races/task-taskgroup-unrelated.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task shared(var) 63 | { 64 | var++; 65 | // Give master thread time to execute the task in the taskgroup. 66 | sleep(1); 67 | } 68 | 69 | #pragma omp taskgroup 70 | { 71 | #pragma omp task if(0) 72 | { 73 | // Dummy task. 74 | } 75 | 76 | // Give other threads time to steal the tasks. 77 | sleep(1); 78 | } 79 | 80 | var++; 81 | } 82 | 83 | int error = (var != 2); 84 | fprintf(stderr, "DONE\n"); 85 | return error; 86 | } 87 | 88 | // CHECK: WARNING: ThreadSanitizer: data race 89 | // CHECK: Write of size 4 90 | // CHECK: #0 .omp_outlined. 91 | // CHECK: Previous write of size 4 92 | // CHECK: #0 .omp_outlined. 93 | // CHECK: DONE 94 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/explicit.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | int x = 0; 10 | 11 | #pragma omp parallel num_threads(2) 12 | { 13 | #pragma omp atomic 14 | x++; 15 | 16 | #pragma omp barrier 17 | print_current_address(); 18 | 19 | #pragma omp atomic 20 | x++; 21 | } 22 | 23 | 24 | // Check if libomp supports the callbacks for this test. 25 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 27 | 28 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 29 | 30 | // master thread explicit barrier 31 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 32 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 33 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 34 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 35 | // CHECK: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 36 | 37 | // master thread implicit barrier at parallel end 38 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 40 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 41 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 42 | 43 | 44 | // worker thread explicit barrier 45 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]] 46 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 47 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 48 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]] 49 | // CHECK: {{^}}[[THREAD_ID]]: current_address={{.*}}[[RETURN_ADDRESS]] 50 | 51 | // worker thread implicit barrier at parallel end 52 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 53 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 54 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 55 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/sections.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | 6 | int main() 7 | { 8 | int x = 0; 9 | 10 | #pragma omp parallel num_threads(2) 11 | { 12 | //implicit barrier after sections with nowait but with lastprivates 13 | //implicit barrier at end of sections 14 | #pragma omp sections 15 | { 16 | #pragma omp section 17 | { 18 | #pragma omp atomic 19 | x++; 20 | } 21 | 22 | #pragma omp section 23 | { 24 | #pragma omp atomic 25 | x++; 26 | } 27 | } 28 | } 29 | 30 | 31 | // Check if libomp supports the callbacks for this test. 32 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 33 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 34 | 35 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 36 | 37 | // master thread implicit barrier at sections end 38 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 40 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 41 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 42 | 43 | // master thread implicit barrier at parallel end 44 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 45 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 46 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 47 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 48 | 49 | 50 | // worker thread implicit barrier at sections end 51 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 52 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 53 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 54 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 55 | 56 | // worker thread implicit barrier at parallel end 57 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 58 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 59 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 60 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /cmake/FindOmp.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | include(FindPackageHandleStandardArgs) 51 | 52 | if(APPLE) 53 | set(OMP_LIB_NAME libomp.dylib) 54 | elseif(UNIX) 55 | set(OMP_LIB_NAME libomp.so) 56 | endif() 57 | 58 | # use an explicitly given omp path first 59 | FIND_PATH(OMP_INCLUDE_PATH omp.h 60 | PATHS ${OMP_PREFIX}/include ${LLVM_ROOT}/include ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src ${CMAKE_BINARY_DIR}/include /usr /usr/local} 61 | PATH_SUFFIXES include NO_DEFAULT_PATH) 62 | # if not-found, try again at cmake locations 63 | FIND_PATH(OMP_INCLUDE_PATH omp.h) 64 | 65 | find_package_handle_standard_args(OpenMP DEFAULT_MSG OMP_INCLUDE_PATH ) 66 | 67 | # use an explicitly given omp path first 68 | FIND_PATH(OMP_LIB_PATH ${OMP_LIB_NAME} 69 | PATHS ${OMP_PREFIX}/lib ${LLVM_ROOT}/lib ${CMAKE_INSTALL_PREFIX}/lib /usr /usr/local} 70 | PATH_SUFFIXES lib NO_DEFAULT_PATH) 71 | # if not-found, try again at cmake locations 72 | FIND_PATH(OMP_LIB_PATH ${OMP_LIB_NAME}) 73 | 74 | find_package_handle_standard_args(OpenMP DEFAULT_MSG OMP_LIB_PATH ) 75 | -------------------------------------------------------------------------------- /include/archer/LinkAllPasses.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | #ifndef ARCHER_LINKALLPASSES_H 51 | #define ARCHER_LINKALLPASSES_H 52 | 53 | #include 54 | 55 | namespace llvm { 56 | class Pass; 57 | class PassInfo; 58 | class PassRegistry; 59 | class RegionPass; 60 | class FunctionPass; 61 | class ModulePass; 62 | } 63 | 64 | namespace llvm { 65 | llvm::Pass *createInstrumentParallelPass(); 66 | } 67 | 68 | namespace { 69 | struct ArcherForcePassLinking { 70 | ArcherForcePassLinking() { 71 | // We must reference the passes in such a way that compilers will not 72 | // delete it all as dead code, even with whole program optimization, 73 | // yet is effectively a NO-OP. As the compiler isn't smart enough 74 | // to know that getenv() never returns -1, this will do the job. 75 | if (std::getenv("bar") != (char *)-1) 76 | return; 77 | 78 | llvm::createInstrumentParallelPass(); 79 | } 80 | } ArcherForcePassLinking; // Force link by creating a global definition. 81 | } 82 | 83 | namespace llvm { 84 | void createInstrumentParallelPass(llvm::PassRegistry &); 85 | void initializeInstrumentParallelPass(llvm::PassRegistry&); 86 | } 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /test/races/task-dependency.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | 4 | Produced at the Lawrence Livermore National Laboratory 5 | 6 | Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | Schulz. 11 | 12 | LLNL-CODE-773957 13 | 14 | All rights reserved. 15 | 16 | This file is part of Archer. For details, see 17 | https://pruners.github.io/archer. Please also read 18 | https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions are 22 | met: 23 | 24 | Redistributions of source code must retain the above copyright 25 | notice, this list of conditions and the disclaimer below. 26 | 27 | Redistributions in binary form must reproduce the above copyright 28 | notice, this list of conditions and the disclaimer (as noted below) 29 | in the documentation and/or other materials provided with the 30 | distribution. 31 | 32 | Neither the name of the LLNS/LLNL nor the names of its contributors 33 | may be used to endorse or promote products derived from this 34 | software without specific prior written permission. 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | */ 49 | 50 | // RUN: %libarcher-compile-and-run-race | FileCheck %s 51 | #include 52 | #include 53 | #include 54 | 55 | int main(int argc, char* argv[]) 56 | { 57 | int var = 0; 58 | 59 | #pragma omp parallel num_threads(2) shared(var) 60 | #pragma omp master 61 | { 62 | #pragma omp task shared(var) depend(out: var) 63 | { 64 | var++; 65 | } 66 | 67 | #pragma omp task depend(in: var) 68 | { 69 | // FIXME: This is ugly to make the worker task sleep and let the master 70 | // thread execute the second task incrementing var... 71 | sleep(2); 72 | } 73 | 74 | #pragma omp task shared(var) // depend(in: var) is missing here! 75 | { 76 | var++; 77 | } 78 | 79 | // Give other thread time to steal the task. 80 | sleep(1); 81 | } 82 | 83 | int error = (var != 2); 84 | fprintf(stderr, "DONE\n"); 85 | return error; 86 | } 87 | 88 | // CHECK: WARNING: ThreadSanitizer: data race 89 | // CHECK: Write of size 4 90 | // CHECK: #0 .omp_outlined. 91 | // CHECK: #1 .omp_task_entry. 92 | // CHECK: Previous write of size 4 93 | // CHECK: #0 .omp_outlined. 94 | // CHECK: #1 .omp_task_entry. 95 | // CHECK: DONE 96 | -------------------------------------------------------------------------------- /test/ompt/synchronization/barrier/single.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7 4 | #include "callback.h" 5 | #include 6 | 7 | int main() 8 | { 9 | int x = 0; 10 | 11 | #pragma omp parallel num_threads(2) 12 | { 13 | //implicit barrier at end of single 14 | #pragma omp single 15 | { 16 | x++; 17 | } 18 | print_fuzzy_address(); 19 | //critical section to avoid merge of two barriers into one 20 | #pragma omp critical 21 | { 22 | x++; 23 | } 24 | } 25 | 26 | 27 | // Check if libomp supports the callbacks for this test. 28 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region' 29 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait' 30 | 31 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 32 | 33 | // master thread implicit barrier at single end 34 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 36 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 37 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 38 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 39 | 40 | // master thread implicit barrier at parallel end 41 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 42 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 43 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 44 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}} 45 | 46 | 47 | // worker thread implicit barrier at single end 48 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 49 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 50 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 51 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}} 52 | // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]] 53 | 54 | // worker thread implicit barrier at parallel end 55 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 56 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 57 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_wait_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 58 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_barrier_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[NULL]] 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | if(${LIBARCHER_STANDALONE_BUILD}) 51 | set(LIBARCHER_HEADER_FILES ${PROJECT_SOURCE_DIR}/include) 52 | else() 53 | set(LIBARCHER_HEADER_FILES ${PROJECT_SOURCE_DIR}/tools/archer/include) 54 | endif() 55 | 56 | if(${LIBOMP_TSAN_SUPPORT}) 57 | add_definitions(-D TSAN_SUPPORT=1) 58 | endif() 59 | 60 | include_directories(${LIBARCHER_HEADER_FILES}) 61 | 62 | set(LIBARCHER_SOURCE_FILES 63 | Archer.cpp 64 | Support/RegisterPasses.cpp 65 | Support/Util.cpp 66 | Transforms/Instrumentation/InstrumentParallel.cpp 67 | ) 68 | 69 | if (CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) 70 | add_llvm_loadable_module(LLVMArcher 71 | ${LIBARCHER_SOURCE_FILES} 72 | ${LIBARCHER_HEADER_FILES} 73 | ) 74 | else() 75 | if (CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) 76 | llvm_add_library(LLVMArcher MODULE 77 | ${LIBARCHER_SOURCE_FILES} 78 | ${LIBARCHER_HEADER_FILES} 79 | ) 80 | else() 81 | add_llvm_library(LLVMArcher MODULE 82 | ${LIBARCHER_SOURCE_FILES} 83 | ${LIBARCHER_HEADER_FILES} 84 | ) 85 | endif() 86 | endif() 87 | 88 | # This declares the dependency to the generated Attributes.gen file, 89 | # which is included by serveral indirections (target is provided by 90 | # LLVM-SRC/include/llvm/IR/CMakeLists.txt): 91 | 92 | if( TARGET intrinsics_gen ) 93 | add_dependencies(LLVMArcher intrinsics_gen) 94 | endif() 95 | -------------------------------------------------------------------------------- /tools/clang-archer.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 4 | # 5 | # Produced at the Lawrence Livermore National Laboratory 6 | # 7 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 8 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 9 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 10 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 11 | # Schulz. 12 | # 13 | # LLNL-CODE-773957 14 | # 15 | # All rights reserved. 16 | # 17 | # This file is part of Archer. For details, see 18 | # https://pruners.github.io/archer. Please also read 19 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 20 | # 21 | # Redistribution and use in source and binary forms, with or without 22 | # modification, are permitted provided that the following conditions are 23 | # met: 24 | # 25 | # Redistributions of source code must retain the above copyright 26 | # notice, this list of conditions and the disclaimer below. 27 | # 28 | # Redistributions in binary form must reproduce the above copyright 29 | # notice, this list of conditions and the disclaimer (as noted below) 30 | # in the documentation and/or other materials provided with the 31 | # distribution. 32 | # 33 | # Neither the name of the LLNS/LLNL nor the names of its contributors 34 | # may be used to endorse or promote products derived from this 35 | # software without specific prior written permission. 36 | # 37 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 38 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 39 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 40 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 41 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 42 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 43 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 44 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 45 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 46 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 47 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 48 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | # 50 | 51 | static_analysis=false 52 | linking=yes 53 | truncated_args=() 54 | for arg in "$@" ; do 55 | case "$arg" in 56 | --sa) 57 | static_analysis=true 58 | shift 59 | ;; 60 | --help) 61 | echo "Archer Options" 62 | echo 63 | echo " --sa Enable static analysis." 64 | echo 65 | shift 66 | @LLVM_ROOT@/bin/clang --help 67 | exit 68 | ;; 69 | -c|-S|-E|-M|-MM|MMD) 70 | linking=no 71 | ;; 72 | esac 73 | [ "$arg" != '--sa' ] && truncated_args+=("$arg") 74 | done 75 | 76 | if [ $linking == yes ] ; then 77 | if [ @LIBOMP_TSAN_SUPPORT@ == FALSE ] ; then 78 | link_flags="-L@OMP_PREFIX@/lib -Wl,-rpath=@OMP_PREFIX@/lib -L@CMAKE_INSTALL_PREFIX@/lib -Wl,-rpath=@CMAKE_INSTALL_PREFIX@/lib -larcher" 79 | else 80 | link_flags="-L@OMP_PREFIX@/lib -Wl,-rpath=@OMP_PREFIX@/lib" 81 | fi 82 | else 83 | link_flags="" 84 | fi 85 | 86 | if [ "$static_analysis" == "true" -a "$linking" == "yes" ]; then 87 | @LLVM_ROOT@/bin/clang -I@OMP_PREFIX@/include -Xclang -load -Xclang @CMAKE_INSTALL_PREFIX@/lib/LLVMArcher.so -fopenmp -fsanitize=thread $link_flags -g @TRUNCATEDARGS@ 88 | else 89 | @LLVM_ROOT@/bin/clang -I@OMP_PREFIX@/include -fopenmp -fsanitize=thread $link_flags -g @TRUNCATEDARGS@ 90 | fi 91 | -------------------------------------------------------------------------------- /tools/clang-archer++.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 4 | # 5 | # Produced at the Lawrence Livermore National Laboratory 6 | # 7 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 8 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 9 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 10 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 11 | # Schulz. 12 | # 13 | # LLNL-CODE-773957 14 | # 15 | # All rights reserved. 16 | # 17 | # This file is part of Archer. For details, see 18 | # https://pruners.github.io/archer. Please also read 19 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 20 | # 21 | # Redistribution and use in source and binary forms, with or without 22 | # modification, are permitted provided that the following conditions are 23 | # met: 24 | # 25 | # Redistributions of source code must retain the above copyright 26 | # notice, this list of conditions and the disclaimer below. 27 | # 28 | # Redistributions in binary form must reproduce the above copyright 29 | # notice, this list of conditions and the disclaimer (as noted below) 30 | # in the documentation and/or other materials provided with the 31 | # distribution. 32 | # 33 | # Neither the name of the LLNS/LLNL nor the names of its contributors 34 | # may be used to endorse or promote products derived from this 35 | # software without specific prior written permission. 36 | # 37 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 38 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 39 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 40 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 41 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 42 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 43 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 44 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 45 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 46 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 47 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 48 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | # 50 | 51 | static_analysis=false 52 | linking=yes 53 | truncated_args=() 54 | for arg in "$@" ; do 55 | case "$arg" in 56 | --sa) 57 | static_analysis=true 58 | shift 59 | ;; 60 | --help) 61 | echo "Archer Options" 62 | echo 63 | echo " --sa Enable static analysis." 64 | echo 65 | shift 66 | @LLVM_ROOT@/bin/clang++ --help 67 | exit 68 | ;; 69 | -c|-S|-E|-M|-MM|MMD) 70 | linking=no 71 | ;; 72 | esac 73 | [ "$arg" != '--sa' ] && truncated_args+=("$arg") 74 | done 75 | 76 | if [ $linking == yes ] ; then 77 | if [ @LIBOMP_TSAN_SUPPORT@ == FALSE ] ; then 78 | link_flags="-L@OMP_PREFIX@/lib -Wl,-rpath=@OMP_PREFIX@/lib -L@CMAKE_INSTALL_PREFIX@/lib -Wl,-rpath=@CMAKE_INSTALL_PREFIX@/lib -larcher" 79 | else 80 | link_flags="-L@OMP_PREFIX@/lib -Wl,-rpath=@OMP_PREFIX@/lib" 81 | fi 82 | else 83 | link_flags="" 84 | fi 85 | 86 | if [ "$static_analysis" == "true" -a "$linking" == "yes" ]; then 87 | @LLVM_ROOT@/bin/clang++ -I@OMP_PREFIX@/include -Xclang -load -Xclang @CMAKE_INSTALL_PREFIX@/lib/LLVMArcher.so -fopenmp -fsanitize=thread $link_flags -g @TRUNCATEDARGS@ 88 | else 89 | @LLVM_ROOT@/bin/clang++ -I@OMP_PREFIX@/include -fopenmp -fsanitize=thread $link_flags -g @TRUNCATEDARGS@ 90 | fi 91 | -------------------------------------------------------------------------------- /cmake/FindLLVM.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC. 3 | # 4 | # Produced at the Lawrence Livermore National Laboratory 5 | # 6 | # Written by Simone Atzeni (simone@cs.utah.edu), Joachim Protze 7 | # (joachim.protze@tu-dresden.de), Jonas Hahnfeld 8 | # (hahnfeld@itc.rwth-aachen.de), Ganesh Gopalakrishnan, Zvonimir 9 | # Rakamaric, Dong H. Ahn, Gregory L. Lee, Ignacio Laguna, and Martin 10 | # Schulz. 11 | # 12 | # LLNL-CODE-773957 13 | # 14 | # All rights reserved. 15 | # 16 | # This file is part of Archer. For details, see 17 | # https://pruners.github.io/archer. Please also read 18 | # https://github.com/PRUNERS/archer/blob/master/LICENSE. 19 | # 20 | # Redistribution and use in source and binary forms, with or without 21 | # modification, are permitted provided that the following conditions are 22 | # met: 23 | # 24 | # Redistributions of source code must retain the above copyright 25 | # notice, this list of conditions and the disclaimer below. 26 | # 27 | # Redistributions in binary form must reproduce the above copyright 28 | # notice, this list of conditions and the disclaimer (as noted below) 29 | # in the documentation and/or other materials provided with the 30 | # distribution. 31 | # 32 | # Neither the name of the LLNS/LLNL nor the names of its contributors 33 | # may be used to endorse or promote products derived from this 34 | # software without specific prior written permission. 35 | # 36 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 39 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE 40 | # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR 41 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 42 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 43 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 44 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 45 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 46 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | # 49 | 50 | # Find the native LLVM includes and library 51 | # 52 | # LLVM_INCLUDE_DIR - where to find llvm include files 53 | # LLVM_LIBRARY_DIR - where to find llvm libs 54 | # LLVM_CFLAGS - llvm compiler flags 55 | # LLVM_LFLAGS - llvm linker flags 56 | # LLVM_MODULE_LIBS - list of llvm libs for working with modules. 57 | # LLVM_FOUND - True if llvm found. 58 | 59 | find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config DOC "llvm-config executable") 60 | 61 | if (LLVM_CONFIG_EXECUTABLE) 62 | message(STATUS "LLVM llvm-config found at: ${LLVM_CONFIG_EXECUTABLE}") 63 | else (LLVM_CONFIG_EXECUTABLE) 64 | message(FATAL_ERROR "Could NOT find LLVM executable") 65 | endif (LLVM_CONFIG_EXECUTABLE) 66 | 67 | execute_process( 68 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --prefix 69 | OUTPUT_VARIABLE LLVM_ROOT 70 | OUTPUT_STRIP_TRAILING_WHITESPACE 71 | ) 72 | 73 | execute_process( 74 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --cmakedir 75 | OUTPUT_VARIABLE LLVM_CMAKEDIR 76 | OUTPUT_STRIP_TRAILING_WHITESPACE 77 | ) 78 | 79 | execute_process( 80 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --includedir 81 | OUTPUT_VARIABLE LLVM_INCLUDE_DIR 82 | OUTPUT_STRIP_TRAILING_WHITESPACE 83 | ) 84 | 85 | execute_process( 86 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --libdir 87 | OUTPUT_VARIABLE LLVM_LIBRARY_DIR 88 | OUTPUT_STRIP_TRAILING_WHITESPACE 89 | ) 90 | 91 | execute_process( 92 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --cppflags 93 | OUTPUT_VARIABLE LLVM_CFLAGS 94 | OUTPUT_STRIP_TRAILING_WHITESPACE 95 | ) 96 | 97 | execute_process( 98 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags 99 | OUTPUT_VARIABLE LLVM_LFLAGS 100 | OUTPUT_STRIP_TRAILING_WHITESPACE 101 | ) 102 | 103 | execute_process( 104 | COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs core bitreader asmparser analysis 105 | OUTPUT_VARIABLE LLVM_MODULE_LIBS 106 | OUTPUT_STRIP_TRAILING_WHITESPACE 107 | ) 108 | -------------------------------------------------------------------------------- /test/ompt/worksharing/for/base_split.h: -------------------------------------------------------------------------------- 1 | #include "callback.h" 2 | #include 3 | 4 | /* With the combined parallel-for construct (base.h), the return-addresses are hard to compare. 5 | With the separate parallel and for-nowait construct, the addresses become more predictable, 6 | but the begin of the for-loop still generates additional code, so the offset of loop-begin 7 | to the label is >4 Byte. 8 | */ 9 | 10 | int main() 11 | { 12 | unsigned int i; 13 | 14 | #pragma omp parallel num_threads(4) 15 | { 16 | print_current_address(0); 17 | #pragma omp for schedule(SCHEDULE) nowait 18 | for (i = 0; i < 4; i++) { 19 | print_fuzzy_address(1); 20 | } 21 | print_fuzzy_address(2); 22 | } 23 | print_fuzzy_address(3); 24 | 25 | // Check if libomp supports the callbacks for this test. 26 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin' 27 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end' 28 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task' 29 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work' 30 | 31 | 32 | // CHECK: 0: NULL_POINTER=[[NULL:.*$]] 33 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=[[PARALLEL_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, invoker={{[0-9]+}} 34 | 35 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 36 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 37 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]] 38 | 39 | // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, invoker={{[0-9]+}}, codeptr_ra=[[PARALLEL_RETURN_ADDRESS]] 40 | // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[PARALLEL_RETURN_ADDRESS]] 41 | 42 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 43 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 44 | // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]] 45 | 46 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 47 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 48 | // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]] 49 | 50 | // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=0x{{[0-f]+}} 51 | // CHECK: {{^}}[[THREAD_ID]]: ompt_event_loop_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[LOOP_END_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 52 | // CHECK: {{^}}[[THREAD_ID]]: fuzzy_address={{.*}}[[LOOP_END_RETURN_ADDRESS]] 53 | 54 | 55 | // CHECK-LOOP: 0: NULL_POINTER=[[NULL:.*$]] 56 | // CHECK-LOOP: 0: ompt_event_runtime_shutdown 57 | // CHECK-LOOP: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra={{0x[0-f]+}}, invoker={{[0-9]+}} 58 | // CHECK-LOOP: {{^}}[[MASTER_ID]]: ompt_event_loop_begin: parallel_id=[[PARALLEL_ID]], parent_task_id={{[0-9]+}}, codeptr_ra=[[LOOP_BEGIN_RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}} 59 | // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]] 60 | // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]] 61 | // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]] 62 | // CHECK-LOOP: {{^}}{{[0-9]+}}: fuzzy_address={{.*}}[[LOOP_BEGIN_RETURN_ADDRESS]] 63 | 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /test/ompt/tasks/task_types.c: -------------------------------------------------------------------------------- 1 | // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s 2 | // REQUIRES: ompt 3 | #include "callback.h" 4 | #include 5 | #include 6 | 7 | 8 | void print_task_type(int id) 9 | { 10 | #pragma omp critical 11 | { 12 | int task_type; 13 | char buffer[2048]; 14 | ompt_get_task_info(0, &task_type, NULL, NULL, NULL, NULL); 15 | format_task_type(task_type, buffer); 16 | printf("%" PRIu64 ": id=%d task_type=%s=%d\n", ompt_get_thread_data()->value, id, buffer, task_type); 17 | } 18 | }; 19 | 20 | int main() 21 | { 22 | //initial task 23 | print_task_type(0); 24 | 25 | int x; 26 | //implicit task 27 | #pragma omp parallel num_threads(1) 28 | { 29 | print_task_type(1); 30 | x++; 31 | } 32 | 33 | #pragma omp parallel num_threads(2) 34 | #pragma omp master 35 | { 36 | //explicit task 37 | #pragma omp task 38 | { 39 | print_task_type(2); 40 | x++; 41 | } 42 | 43 | //explicit task with undeferred 44 | #pragma omp task if(0) 45 | { 46 | print_task_type(3); 47 | x++; 48 | } 49 | 50 | //explicit task with untied 51 | #pragma omp task untied 52 | { 53 | print_task_type(4); 54 | x++; 55 | } 56 | 57 | //explicit task with final 58 | #pragma omp task final(1) 59 | { 60 | print_task_type(5); 61 | x++; 62 | //nested explicit task with final and undeferred 63 | #pragma omp task 64 | { 65 | print_task_type(6); 66 | x++; 67 | } 68 | } 69 | 70 | //Mergeable task test deactivated for now 71 | //explicit task with mergeable 72 | /* 73 | #pragma omp task mergeable if((int)sin(0)) 74 | { 75 | print_task_type(7); 76 | x++; 77 | } 78 | */ 79 | 80 | //TODO: merged task 81 | } 82 | 83 | 84 | 85 | // Check if libomp supports the callbacks for this test. 86 | // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create' 87 | 88 | 89 | // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]] 90 | 91 | // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_task_create: parent_task_id=0, parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[NULL]], new_task_id={{[0-9]+}}, codeptr_ra=[[NULL]], task_type=ompt_task_initial=1, has_dependences=no 92 | // CHECK-NOT: 0: parallel_data initially not null 93 | // CHECK: {{^}}[[MASTER_ID]]: id=0 task_type=ompt_task_initial=1 94 | // CHECK: {{^}}[[MASTER_ID]]: id=1 task_type=ompt_task_implicit|ompt_task_undeferred=134217730 95 | 96 | // CHECK-DAG: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit=4, has_dependences=no 97 | // CHECK-DAG: {{^[0-9]+}}: id=2 task_type=ompt_task_explicit=4 98 | 99 | // CHECK-DAG: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred=134217732, has_dependences=no 100 | // CHECK-DAG: {{^[0-9]+}}: id=3 task_type=ompt_task_explicit|ompt_task_undeferred=134217732 101 | 102 | // CHECK-DAG: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_untied=268435460, has_dependences=no 103 | // CHECK-DAG: {{^[0-9]+}}: id=4 task_type=ompt_task_explicit|ompt_task_untied=268435460 104 | 105 | // CHECK-DAG: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_final=536870916, has_dependences=no 106 | // CHECK-DAG: {{^[0-9]+}}: id=5 task_type=ompt_task_explicit|ompt_task_final=536870916 107 | 108 | // CHECK-DAG: {{^[0-9]+}}: ompt_event_task_create: parent_task_id={{[0-9]+}}, parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, new_task_id={{[0-9]+}}, codeptr_ra={{0x[0-f]+}}, task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644, has_dependences=no 109 | // CHECK-DAG: {{^[0-9]+}}: id=6 task_type=ompt_task_explicit|ompt_task_undeferred|ompt_task_final=671088644 110 | 111 | return 0; 112 | } 113 | --------------------------------------------------------------------------------