interfaces for runtime correctness checking of parallel
play

Interfaces for Runtime Correctness Checking of Parallel Programs - PowerPoint PPT Presentation

Interfaces for Runtime Correctness Checking of Parallel Programs Joachim Protze (protze@itc.rwth-aachen.de) Motivation OpenMP 3 introduced tasks (2008) Several data race detection tools for OpenMP tasks popped up just last year How can


  1. Interfaces for Runtime Correctness Checking of Parallel Programs Joachim Protze (protze@itc.rwth-aachen.de)

  2. Motivation • OpenMP 3 introduced tasks (2008) • Several data race detection tools for OpenMP tasks popped up just last year • How can we effectively reduce the porting effort for new programming paradigms? Memory accesses Concurrency Synchronization 2 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  3. Synchronization in OpenMP Parallel region parallel-begin • Encountering a parallel directive happens before execution of the implicit-task-begin parallel region • Encountering a barrier directive barrier-begin happens before execution of code barrier-end following the barrier region • Encountering the implicit barrier happens before the master barrier-begin continues code following the implicit-task-end ! parallel region parallel-end 3 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  4. Synchronization in OpenMP Task region task task depend(out:a) task-create task task depend(in:a) • Encountering a task directive +task-dependencies happens before execution of the task-begin task region • Finishing execution of a child task task-end happens before execution of code task-begin following a taskwait, barrier, or taskgroup region • Finishing a predecessor task task-end happens before a dependent task starts execution taskwait-end taskwait • Deferring a task happens before scheduling the task again 4 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  5. Archer based on ThreadSanitizer • ThreadSanitizer comes with clang and gcc (-fsanitize=thread) • Compiler instrumentation of memory accesses − Less overhead than binary instrumentation (e.g., PIN, valgrind) • ThreadSanitizer is not aware of OpenMP synchronization • Happens before analysis with simplified fast track algorithm. − 4 records of memory access to a word, storing (epoch,tid,r/w) • Archer annotates OpenMP synchronization − Initially instrumentation of the LLVM/OpenMP runtime − Now based on OMPT events 5 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  6. Data race analysis overhead for SPEC OMP 2012 (train) • Expected overhead according to base tool: 2-20x • 359.botsspar and 370.mgrid331 > 20x − Both run <1 second with high synchronization rate ▪ 359.botsspar: 353400 task switches ▪ 370.mgrid331: 6383 parallel regions 50 99.8 40 Tool Slowdown 30 2 Threads 4 Threads 20 12 Threads 10 0 350 351 352 357 358 359 360 362 363 367 370 371 372 376 6 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  7. Concurrency for OpenMP Tasks • Observed actual • Lamport • Separating • Execution of execution with happens- the logical the thread as HB before slices observed by a tool thread Wallclock time Logical clock Wallclock time Wallclock time Happens-before Observed execution order 7 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  8. TLC: Marking execution within a thread as concurrent • Observed actual • Lamport • Separating • Execution of execution with happens- the logical the thread as HB before slices observed by the tool thread Wallclock time Logical clock Wallclock time Wallclock time Happens-before Observed execution order Fork / spawn 8 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  9. Generic events • Fork(curr, *new) − Fork(curr, *new, *msg) • Join(curr, next) • Switch(curr, next) − Switch(curr, next, msg) • Send(curr, *msg) • Recv(curr, msg) 9 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  10. Concurrency / Synchronization in Shared Memory Parallel, Tasks, Loops Fork(curr, *new) • Fork → P2P synchronization, concurrency Join(curr, next) • Join → P2P synchronization Switch(curr, next) • Barrier → global synchronization Send(curr, *msg) − Can translate into N2N synchronization Recv(curr, msg) • Dependencies → P2P synchronization • Locks → ? − Should be flexible to enable lock-set and HB analysis • Parallel loop → concurrency for each iteration • Doacross loops → P2P synchronization 10 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  11. Applying this semantics to MPI MPI Non-Blocking • MPI_Isend / MPI_Irecv → concurrency, P2P synchronization − Bind the new execution unit handle to the request • MPI_Wait → synchronize task MPI_Irecv • Buffer access → read/write task thread MPI_Wait 11 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  12. Applying this semantics to MPI MPI One-sided • MPI One-sided epochs → concurrency, P2P synchronization • MPI One-sided target completion → synchronize • Remote memory access → read/write 12 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  13. Device Offloading

  14. Basic memory operations in device offloading • Memory access • Alloc/release memory • (Dis-)Associate memory • Update memory (memcopy) OpenMP mapping semantics: • Alloc alloc + associate • Map-to ((alloc +) associate +) update to device • Map-from update from device (+ disassociate (+ release)) • Update-to/from update to/from device • Release disassociate + release Challenge: semantics of global/static memory 14 Generic Tool Interface for Runtime Correctness Checking Joachim Protze

  15. Distributed Memory ?

  16. Thank you for your attention.

Recommend


More recommend