OMP - OpenMP Programming Aiichiro Nakano Collaboratory for...

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

View Full Document Right Arrow Icon
OpenMP Programming Aiichiro Nakano Department of Computer Science University of Southern California Email: [email protected]
Background image of page 1

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

View Full DocumentRight Arrow Icon
OpenMP Portable application program interface (API) for shared-memory parallel programming based on multi-threading by compiler directives OpenMP = Open speciFcations for M ulti P rocessing OpenMP homepage www.openmp.org OpenMP tutorial www.llnl.gov/computing/tutorials/openMP Process: an instance of program running • Thread: a sequence of instructions being executed, possibly sharing resources with other threads within a process MPI (distributed memory) OpenMP (shared memory) send receive share
Background image of page 2
OpenMP Programming Model Fork-join parallelism • Fork: master thread spawns a team of threads as needed • Join: when the team of threads complete the statements in the parallel section, they terminate synchronously, leaving only the master thread OpenMP threads communicate by sharing variables
Background image of page 3

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

View Full DocumentRight Arrow Icon
OpenMP Example: omp_example.c #include <stdio.h> #include <omp.h> void main () { int nthreads,tid; nthreads = omp_get_num_threads() ; printf("Sequential section: # of threads = %d\n",nthreads);
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.

This note was uploaded on 06/17/2011 for the course CS 33 taught by Professor Rohr during the Spring '08 term at UCLA.

Page1 / 10

OMP - OpenMP Programming Aiichiro Nakano Collaboratory for...

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