cs8803SC_lecture5

cs8803SC_lecture5 - CS8803SC Software and Hardware...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS8803SC Software and Hardware Cooperative Computing OpenMP/Introduction to TBB Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology Today’s Goal • Review OpenMP – Look at some examples • Gprof • TBB • A brief introduction to CUDA
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 OpenMP Review: Directives and Clauses • Directives are the main OpenMP construct • Clauses provide modifiers and attributes to the directives • General syntax is – C/C++ #pragma omp directive [ clause [ clause ] … ] http://people.redhat.com/dnovil o/Papers/rhs2006.pdf A Sample of OpenMP and Pthreads translation int a,b; main { // serial segment # pragma omp parallel num_threads (8) private (a) shared (b) { // parallel segment } // rest of serial segment } int a,b; main { // serial segment for ( I =0; I <8; i++) pthread_create( …, internal_thread_fn_name, …); for ( I = 0; I < 8; i++) pthread_join (….); // rest of serial segment } Void ( internal_thread_fn_name (void *packaged_argument_ { int a; // parallel segment } Sample open MP program Corresponding pthreads translation Introduction to parallel computing, grama, gupta, karypis, kumar
Background image of page 2
3 X X X default X X X nowait X X ordered X X schedule X X copyin X X X X X reduction X X X X lastprivate X X X X X X firstprivate X X X X shared X X X X X X private X X X if parallel sections parallel do/for single sections do/for parallel Table: Acceptable clauses for directives. Clause Directive These don’t accept clauses: master critical barrier atomic flush ordered threadprivate Examples • Heat diffusion • Molecular dynamics • GAFORT (spec OMP) • Critical section/lock • Thread communications
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Gprof • Compile with “-p” option • Gcc –p file.c • ./a.out • Gprof a.out gmon.out > profile.txt
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

cs8803SC_lecture5 - CS8803SC Software and Hardware...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online