archer: effectively spotting data races in large openmp...

7
LLNL-PRES-682437 This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC ARCHER: Effectively Spotting Data Races in Large OpenMP Applications Ignacio Laguna, D. H. Ahn, G. L. Lee, M. Schulz (LLNL) S. Atzeni, G. Gopalakrishnan, Z. Rakamarić (Univ. of Utah) J. Protze (RWTH Aachen) March 17-18, 2016

Upload: others

Post on 18-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

LLNL-PRES-682437 This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC

ARCHER: Effectively Spotting Data Races in Large OpenMP Applications

Ignacio(Laguna,"D."H."Ahn,"G."L."Lee,"M."Schulz"(LLNL)"

"S."Atzeni,"G."Gopalakrishnan,"Z."Rakamarić"(Univ."of"Utah)"

J."Protze"(RWTH"Aachen)"

March 17-18, 2016

Page 2: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

2"LLNL-PRES-682437

OpenMP"is"Widely"Used"in"HPC"ApplicaMons"

!  Standard"to"expresses"parallelism"in"mulMOthreaded"code"

!  Parallel"code"can"be"executed"in"CPUs"or"accelerators"(e.g.,"GPUs)"

!  As"in"all"mulMOtreaded"programming"models,"data"races"can"occur"

void%simple(int%n,%float%*a,%float%*b)%{%%int%i;%#pragma%omp%parallel%for%%for%(i=1;%i<n;%i++)%%%%%b[i]%=%(a[i]%+%a[i?1])%/%2.0;%}%

Page 3: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

3"LLNL-PRES-682437

Gap"in"Data"Race"DetecMon"Tools"for"HPC"

Tool Technology Accuracy/Precision Overhead Portability Pthread OpenMP

Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector Dynamic ⬤ ⬤ ⬤ ⬤

Helgrind Dynamic ⬤ ⬤ ⬤ ⬤ ThreadSanitizer Dynamic ⬤ ⬤ ⬤ ⬤

!  IdenMfying"data"races"in"large"OpenMP"applicaMons"is"challenging"

•  Scalability"is"key"•  Accurate"and"precise"detecMon"is"very"important"

•  Low"overhead"and"portability"allow"adopMon"in"pracMce"

Page 4: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

4"LLNL-PRES-682437

!  Combines"staMc"and"dynamic"techniques"in"a"single"tool"

!  Build"on"top"of:"•  Polly"for"staMc"dependence"analysis"•  ThreadSaniMzer"–"dynamic"happensObefore"analysis"

•  LLVM/Clang"OpenMP"runMme

Static Analysis (OpenMP C/C++ Clang/LLVM Compiler)

Call graph

Find Functions within OpenMP Regions

(recursively locates functions within

omp_outlined blocks)

Data Dependency Analysis Pass (obtains DD info through Polly;

returns dependent loads and stores)

Sequential CodeDetection Pass

(returns all loads and stores not contained

within parallel regions)

Loads / Stores

Blacklist

TSan Instrumentation Pass

(Instruments loads / stores not contained in

Blacklist)

OpenMPSourceCode

Dynamic Analysis

AnnotatedOpenMPRuntime

TSan Runtime

ExecutableData Race

Report

(1)

(2)

(3)

(4)

(5)(6)

LLVMIR

Code

Archer(Data(Race(Detector(Accurately"detects"OpenMP"data"races"with"low"overhead"

Page 5: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

5"LLNL-PRES-682437

Approach(–(Sta5c(Analysis(Phase(Target"instrumentaMon"on"a"simple"OpenMP"program"

1 main() { 2 // Serial code 3 setup(); 4 sort(); 5 6 #pragma omp parallel for 7 for(int i = 0; i < N; ++i) { 8 a[i] = a[i] + 1; 9 } 10 11 #pragma omp parallel for 12 for(int i = 0; i < N – 1; ++i) { 13 a[i] = a[i + 1]; 14 } 15 16 #pragma omp parallel 17 { 18 sort(); 19 } 20 21 // Serial code 22 printResults(); 23 }

Serial'code'blacklisted'

Used'in'serial'and'parallel'code'

No'data'dependency'code'blacklisted'

Poten5ally'racy'code'instrumented'

Serial'code'blacklisted'

Poten5ally'racy'code'instrumented'

Page 6: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector

6"LLNL-PRES-682437

Evalua5on:(((OmpSCR(Benchmarks(

Application

Slowdown Mean 29.5" 30.3" 122.4" 19.6" 18.4"

Geometric Mean 18.3" 20.2" 71.5" 10" 8.8""

Detected Races 6 6 9 12 12

False Alarms 2 3 2 0 0

The total number of races in the benchmarks is 12.

Page 7: ARCHER: Effectively Spotting Data Races in Large OpenMP ...llvm.org/devmtg/2016-03/Lightning-Talks/Archer_talk-EuroLLVM-201… · Intel SSA Static ⬤ ⬤ ⬤ ⬤ Intel Inspector