AgendaBackgroundMultiprocessing ProgrammingPreferenceProgramming ModelParallel SectionClausesSynchronization
BackgroundParallel has no semantic impactConcurrency has a substantial semantic impact
BackgroundSymmetric Multi Processor(SMP)Shared  Memory  Multiprocessing ProgrammingOpenMPMassively Parallel Processor(MPP)Message Passing Interface ProgrammingMPI
Background
Multiprocessing Programming
Multiprocessing ProgrammingGeneral Threading ModelMain thread executes the program’s main functionMain thread creates subthreads, witch execute other functions in the program.Subthreads can also create additional threads.
Multiprocessing ProgrammingBenefitsIncreased performance and better resource utilizationEven on single processor systems – for hiding latency and increasing throughputIPC thread shared memory is more efficientRiskIncreases complexity of the applicationDifficult to debug (data races, deadlocks, etc.)
OpenMP Preference (later  VS2005)
OpenMP Preference (later  GCC 4.2)
Programming ModelGenerate multi-thread code by referencing directive code Compiler is required to support openMPTo eliminate synchronization and dependency
Programming Model
Parallel Section (for)#pragmaomp for [clause [clause …] ] {    for loop}
Parallel Section (sections)#pragmaomp sections [clause [clause …] ] {    [#progmaomp section]        structured code block}
Clausesprivate(var1, …) to block sharing selected values with threadsshared(var1, …)to share selected values with threads schedule(type [, chunk_size])to divide work with threads for equalitystaticdynamic
Synchronization (critical section)Declaring critical section in parallel sectionRunning only single thread at moment#pragmaomp critical [(name)]{    structured code block}
https://computing.llnl.gov/tutorials/openMP/

Open MP