際際滷

際際滷Share a Scribd company logo
C++ w/ OpenMP
Task Graph
Generator
Sean Krail
Goal
 C++ w/ OpenMP -> Clangs AST + (Data Structure)
 (Data Structure) -> TGFF
 (Data Structure) -> DOT
 (Data Structure) -> DARTS
Goal
 C++ w/ OpenMP -> Clangs AST + (Data Structure)
 (Data Structure) -> TGFF
 (Data Structure) -> DOT
 (Data Structure) -> DARTS
(Data Structure)
 LinkedList of Tasks
 Task -> Task ->  -> Task -> null
 3 Types of Tasks
 CallTask, StmtGroupTask, ParallelTask
CallTask
 Function call
 Start of a parallel OpenMP directive
 Implicit barriers
 Function return
StmtGroupTask & ParallelTask
 StmtGroupTask
 Group of non-parallel, non-OpenMP Stmts
 ParallelTask
 Group of regular or OMP-directive parallel Stmts
C++ w/ OpenMP -> Clangs AST
void f(int n) {
int a = 1; int b = 2;
# pragma omp parallel
{
int c = 3; int d = 4;
# pragma omp for
for(int i = 0; i < n; i++)
{ int e = 5; int f = 6; int g = 7; }
// implicit barrier
int h = 8;
# pragma omp single
{ int i = 9; }
// implicit barrier
int j = 10;
# pragma omp single
{ int k = 11; }
}
// combined implicit barrier
int l = 12;
}
 Interface for traversing clangs AST
RecursiveASTVisitor
Class Hierarchy
bool TheVisitor::TraverseDecl(clang::Decl *d) {
if(!d)
return true;
else if(!isa<clang::FunctionDecl>(d))
return true;
// create the function start CallTask
clang::FunctionDecl *f = llvm::cast
<clang::FunctionDecl>(d);
this->task = new CallTask(f, true);
// traverse children nodes
RecursiveASTVisitor::TraverseDecl(d);
// move to next sibling
// or back go back to parent
// create the function end CallTask
Task *tmp = new CallTask(f, false);
this->task->setChild(tmp);
this->task = nullptr; // good practice
return true;
}
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Clangs AST + (Data Structure)
Goal
 C++ w/ OpenMP -> Clangs AST + (Data Structure)
 (Data Structure) -> TGFF
 (Data Structure) -> DOT
 (Data Structure) -> DARTS
Goal
 C++ w/ OpenMP -> Clangs AST + (Data Structure)
 (Data Structure) -> TGFF
 (Data Structure) -> DOT
 (Data Structure) -> DARTS
(Data Structure) -> TGFF
 List of Tasks
 ParallelTask is broken down into N StmtGroupTasks
(for N number of threads)
 List of Arcs
 Synonymous with dependencies
(Data Structure) -> DOT
 List of Tasks and Arcs like TGFF
 Allows for styling of the graph
(Data Structure) -> DARTS
 Modular
1. Derived Codelet classes for each unique Task
2. A Single ThreadedProcedure for the entire Task
Graph
3. Definition of each derived codelet classs fire
method
4. main entry function
Script to Execute Tool
#!/bin/sh
CLANGBUILD=~/Documents/clang-llvm/build
OMP=~/Documents/omp-darts-compiler/ompdarts-sean/taskgraph/functions/hello.cpp
DARTSDIR=~/CAPSL/DARTS
APP=TaskGraphTP
rm $DARTSDIR/apps/$APP/$APP.cpp
# run tool
# Options:
# numthreads (default is 2)
# tgff
# dot
# darts
# Examples:
# $BUILD/bin/ompdarts-taskgraph-generator $PROGRAM -numthreads=5 -tgff -dot -darts -- -Xclang -fopenmp
# $BUILD/bin/ompdarts-taskgraph-generator $PROGRAM -- -Xclang -fopenmp
$CLANGBUILD/bin/ompdarts-taskgraph-generator $OMP -numthreads=2 -darts -- -Xclang -fopenmp >> $DARTSDIR/apps/$APP/$APP.cpp
TMP=$PWD
cd $DARTSDIR/build
make
$DARTSDIR/build/apps/$APP/$APP
cd $TMP
DARTS Example
TaskGraphTP()
Fired codelet start
Fired codelet sg0
Fired codelet call0
Fired codelet sg1_t0
Fired codelet sg1_t1
Fired codelet for0_t0
Fired codelet for0_t1
Fired codelet barrier0
Fired codelet sg2_t0
Fired codelet sg2_t1
Fired codelet single0_t0
Skipped codelet single0_t1
Fired codelet barrier1
Fired codelet single1_t0
Skipped codelet single1_t1
Fired codelet barrier2
Fired codelet sg3
Fired codelet end
Total Time Taken: 0.00969014 sec
void f(int n) {
int a = 1; int b = 2;
# pragma omp parallel
{
int c = 3; int d = 4;
# pragma omp for
for(int i = 0; i < n; i++)
{ int e = 5; int f = 6; int g = 7; }
// implicit barrier
int h = 8; int i = 9;
# pragma omp single
{ int j = 10; int k = 11; }
// implicit barrier
# pragma omp single
{ int l = 12; }
}
// combined implicit barrier of OMPSingle and OMPParallel
int m = 13;
}
Questions?

More Related Content

What's hot (20)

PPTX
Faster Workflows, Faster
Ken Krugler
PDF
Modern c++ Memory Management
Alan Uthoff
PPTX
Anti patterns
Alex Tumanoff
PDF
Java patterns in Scala
Radim Pavlicek
PDF
Scalability comparison: Traditional fork-join-based parallelism vs. Goroutine...
Artjom Simon
PPTX
Luis Atencio on RxJS
Luis Atencio
PDF
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
Rob Skillington
PPTX
Improving go-git performance
source{d}
PDF
Flux and InfluxDB 2.0 by Paul Dix
InfluxData
PDF
Transducers in JavaScript
Pavel Forkert
PPTX
際際滷s
shahriar-ro
ODP
IIUG 2016 Gathering Informix data into R
Kevin Smith
PPTX
RR & Docker @ MuensteR Meetup (Sep 2017)
Daniel N端st
PDF
Minion pool - a worker pool for nodejs
Marcelo Gornstein
PDF
CodeFest 2014. Axel Rauschmayer JavaScripts variables: scopes, environment...
CodeFest
PDF
Understanding SLAB in Linux Kernel
Haifeng Li
PDF
"Metrics: Where and How", Vsevolod Polyakov
Yulia Shcherbachova
PDF
Introduction To Lisp
kyleburton
PPTX
JavaScript Event Loop
Designveloper
ZIP
Lisp Primer Key
Yuumi Yoshida
Faster Workflows, Faster
Ken Krugler
Modern c++ Memory Management
Alan Uthoff
Anti patterns
Alex Tumanoff
Java patterns in Scala
Radim Pavlicek
Scalability comparison: Traditional fork-join-based parallelism vs. Goroutine...
Artjom Simon
Luis Atencio on RxJS
Luis Atencio
FOSDEM 2020: Querying over millions and billions of metrics with M3DB's index
Rob Skillington
Improving go-git performance
source{d}
Flux and InfluxDB 2.0 by Paul Dix
InfluxData
Transducers in JavaScript
Pavel Forkert
際際滷s
shahriar-ro
IIUG 2016 Gathering Informix data into R
Kevin Smith
RR & Docker @ MuensteR Meetup (Sep 2017)
Daniel N端st
Minion pool - a worker pool for nodejs
Marcelo Gornstein
CodeFest 2014. Axel Rauschmayer JavaScripts variables: scopes, environment...
CodeFest
Understanding SLAB in Linux Kernel
Haifeng Li
"Metrics: Where and How", Vsevolod Polyakov
Yulia Shcherbachova
Introduction To Lisp
kyleburton
JavaScript Event Loop
Designveloper
Lisp Primer Key
Yuumi Yoshida

Viewers also liked (17)

PDF
Polish Saturday School employment
Karolina Forbes
DOC
Dieta wasna 1
Karolina Forbes
DOC
Latest CV Rakib
Md. Rakibul Islam
PPTX
Inversion estranjera
maria rojas
PDF
Mark T Davis Resume new2
Mark Davis
PDF
Broucher falcon
Vikas Gupta
PDF
Scott-Lunceford-Tech-Samples
Scott Lunceford
PDF
Safety Guide 2015
Greg Muller
PDF
TOWN-Business-Plan-Redacted
Scott Lunceford
PPTX
informacion de la nube
maria rojas
PPTX
Securing information system
Tanjim Rasul
PDF
NRDC-PPT-Samples
Scott Lunceford
DOCX
P y p . final
Laura Gaviria
DOC
Lesson analysis
Karolina Forbes
PPTX
Everyday life in 1971
Tanjim Rasul
DOC
Karolina Forbes assignment 2 - improved
Karolina Forbes
PPTX
Contours And Its Uses
Subodh Adhikari
Polish Saturday School employment
Karolina Forbes
Dieta wasna 1
Karolina Forbes
Latest CV Rakib
Md. Rakibul Islam
Inversion estranjera
maria rojas
Mark T Davis Resume new2
Mark Davis
Broucher falcon
Vikas Gupta
Scott-Lunceford-Tech-Samples
Scott Lunceford
Safety Guide 2015
Greg Muller
TOWN-Business-Plan-Redacted
Scott Lunceford
informacion de la nube
maria rojas
Securing information system
Tanjim Rasul
NRDC-PPT-Samples
Scott Lunceford
P y p . final
Laura Gaviria
Lesson analysis
Karolina Forbes
Everyday life in 1971
Tanjim Rasul
Karolina Forbes assignment 2 - improved
Karolina Forbes
Contours And Its Uses
Subodh Adhikari
Ad

Similar to Internship - Final Presentation (26-08-2015) (20)

PDF
Xdp and ebpf_maps
lcplcp1
ODP
Getting started with Perl XS and Inline::C
daoswald
PDF
Apache Airflow速 Best Practices: DAG Writing
Aggregage
PDF
All I know about rsc.io/c2go
Moriyoshi Koizumi
PDF
Beyond Parallelize and Collect by Holden Karau
Spark Summit
ODP
Dynamic Tracing of your AMP web site
Sriram Natarajan
PPT
r,rstats,r language,r packages
Ajay Ohri
PDF
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Databricks
PPTX
Debug generic process
Vipin Varghese
PDF
Semmle Codeql
M. S.
PPTX
Beyond parallelize and collect - Spark Summit East 2016
Holden Karau
PPT
Easy R
Ajay Ohri
PDF
Using eBPF Off-CPU Sampling to See What Your DBs are Really Waiting For by Ta...
ScyllaDB
ODP
仍舒亟亳仄亳 亠亠仗亠仍亳舒 "仂亟仍亳"
Media Gorod
PDF
Command Line Arguments with Getopt::Long
Ian Kluft
PDF
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Zalando Technology
PDF
Testing and validating spark programs - Strata SJ 2016
Holden Karau
PDF
No more struggles with Apache Spark workloads in production
Chetan Khatri
PDF
Bridge TensorFlow to run on Intel nGraph backends (v0.5)
Mr. Vengineer
PDF
Apache Flink internals
Kostas Tzoumas
Xdp and ebpf_maps
lcplcp1
Getting started with Perl XS and Inline::C
daoswald
Apache Airflow速 Best Practices: DAG Writing
Aggregage
All I know about rsc.io/c2go
Moriyoshi Koizumi
Beyond Parallelize and Collect by Holden Karau
Spark Summit
Dynamic Tracing of your AMP web site
Sriram Natarajan
r,rstats,r language,r packages
Ajay Ohri
Everyday I'm Shuffling - Tips for Writing Better Spark Programs, Strata San J...
Databricks
Debug generic process
Vipin Varghese
Semmle Codeql
M. S.
Beyond parallelize and collect - Spark Summit East 2016
Holden Karau
Easy R
Ajay Ohri
Using eBPF Off-CPU Sampling to See What Your DBs are Really Waiting For by Ta...
ScyllaDB
仍舒亟亳仄亳 亠亠仗亠仍亳舒 "仂亟仍亳"
Media Gorod
Command Line Arguments with Getopt::Long
Ian Kluft
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Zalando Technology
Testing and validating spark programs - Strata SJ 2016
Holden Karau
No more struggles with Apache Spark workloads in production
Chetan Khatri
Bridge TensorFlow to run on Intel nGraph backends (v0.5)
Mr. Vengineer
Apache Flink internals
Kostas Tzoumas
Ad

Internship - Final Presentation (26-08-2015)

  • 1. C++ w/ OpenMP Task Graph Generator Sean Krail
  • 2. Goal C++ w/ OpenMP -> Clangs AST + (Data Structure) (Data Structure) -> TGFF (Data Structure) -> DOT (Data Structure) -> DARTS
  • 3. Goal C++ w/ OpenMP -> Clangs AST + (Data Structure) (Data Structure) -> TGFF (Data Structure) -> DOT (Data Structure) -> DARTS
  • 4. (Data Structure) LinkedList of Tasks Task -> Task -> -> Task -> null 3 Types of Tasks CallTask, StmtGroupTask, ParallelTask
  • 5. CallTask Function call Start of a parallel OpenMP directive Implicit barriers Function return
  • 6. StmtGroupTask & ParallelTask StmtGroupTask Group of non-parallel, non-OpenMP Stmts ParallelTask Group of regular or OMP-directive parallel Stmts
  • 7. C++ w/ OpenMP -> Clangs AST void f(int n) { int a = 1; int b = 2; # pragma omp parallel { int c = 3; int d = 4; # pragma omp for for(int i = 0; i < n; i++) { int e = 5; int f = 6; int g = 7; } // implicit barrier int h = 8; # pragma omp single { int i = 9; } // implicit barrier int j = 10; # pragma omp single { int k = 11; } } // combined implicit barrier int l = 12; }
  • 8. Interface for traversing clangs AST RecursiveASTVisitor Class Hierarchy bool TheVisitor::TraverseDecl(clang::Decl *d) { if(!d) return true; else if(!isa<clang::FunctionDecl>(d)) return true; // create the function start CallTask clang::FunctionDecl *f = llvm::cast <clang::FunctionDecl>(d); this->task = new CallTask(f, true); // traverse children nodes RecursiveASTVisitor::TraverseDecl(d); // move to next sibling // or back go back to parent // create the function end CallTask Task *tmp = new CallTask(f, false); this->task->setChild(tmp); this->task = nullptr; // good practice return true; }
  • 9. Clangs AST + (Data Structure)
  • 10. Clangs AST + (Data Structure)
  • 11. Clangs AST + (Data Structure)
  • 12. Clangs AST + (Data Structure)
  • 13. Clangs AST + (Data Structure)
  • 14. Clangs AST + (Data Structure)
  • 15. Clangs AST + (Data Structure)
  • 16. Clangs AST + (Data Structure)
  • 17. Clangs AST + (Data Structure)
  • 18. Clangs AST + (Data Structure)
  • 19. Clangs AST + (Data Structure)
  • 20. Clangs AST + (Data Structure)
  • 21. Clangs AST + (Data Structure)
  • 22. Clangs AST + (Data Structure)
  • 23. Clangs AST + (Data Structure)
  • 24. Clangs AST + (Data Structure)
  • 25. Clangs AST + (Data Structure)
  • 26. Clangs AST + (Data Structure)
  • 27. Clangs AST + (Data Structure)
  • 28. Clangs AST + (Data Structure)
  • 29. Clangs AST + (Data Structure)
  • 30. Clangs AST + (Data Structure)
  • 31. Clangs AST + (Data Structure)
  • 32. Goal C++ w/ OpenMP -> Clangs AST + (Data Structure) (Data Structure) -> TGFF (Data Structure) -> DOT (Data Structure) -> DARTS
  • 33. Goal C++ w/ OpenMP -> Clangs AST + (Data Structure) (Data Structure) -> TGFF (Data Structure) -> DOT (Data Structure) -> DARTS
  • 34. (Data Structure) -> TGFF List of Tasks ParallelTask is broken down into N StmtGroupTasks (for N number of threads) List of Arcs Synonymous with dependencies
  • 35. (Data Structure) -> DOT List of Tasks and Arcs like TGFF Allows for styling of the graph
  • 36. (Data Structure) -> DARTS Modular 1. Derived Codelet classes for each unique Task 2. A Single ThreadedProcedure for the entire Task Graph 3. Definition of each derived codelet classs fire method 4. main entry function
  • 37. Script to Execute Tool #!/bin/sh CLANGBUILD=~/Documents/clang-llvm/build OMP=~/Documents/omp-darts-compiler/ompdarts-sean/taskgraph/functions/hello.cpp DARTSDIR=~/CAPSL/DARTS APP=TaskGraphTP rm $DARTSDIR/apps/$APP/$APP.cpp # run tool # Options: # numthreads (default is 2) # tgff # dot # darts # Examples: # $BUILD/bin/ompdarts-taskgraph-generator $PROGRAM -numthreads=5 -tgff -dot -darts -- -Xclang -fopenmp # $BUILD/bin/ompdarts-taskgraph-generator $PROGRAM -- -Xclang -fopenmp $CLANGBUILD/bin/ompdarts-taskgraph-generator $OMP -numthreads=2 -darts -- -Xclang -fopenmp >> $DARTSDIR/apps/$APP/$APP.cpp TMP=$PWD cd $DARTSDIR/build make $DARTSDIR/build/apps/$APP/$APP cd $TMP
  • 38. DARTS Example TaskGraphTP() Fired codelet start Fired codelet sg0 Fired codelet call0 Fired codelet sg1_t0 Fired codelet sg1_t1 Fired codelet for0_t0 Fired codelet for0_t1 Fired codelet barrier0 Fired codelet sg2_t0 Fired codelet sg2_t1 Fired codelet single0_t0 Skipped codelet single0_t1 Fired codelet barrier1 Fired codelet single1_t0 Skipped codelet single1_t1 Fired codelet barrier2 Fired codelet sg3 Fired codelet end Total Time Taken: 0.00969014 sec void f(int n) { int a = 1; int b = 2; # pragma omp parallel { int c = 3; int d = 4; # pragma omp for for(int i = 0; i < n; i++) { int e = 5; int f = 6; int g = 7; } // implicit barrier int h = 8; int i = 9; # pragma omp single { int j = 10; int k = 11; } // implicit barrier # pragma omp single { int l = 12; } } // combined implicit barrier of OMPSingle and OMPParallel int m = 13; }