| |
Shared Memory Architectures
Symmetric multiprocessor system (SMP) with uniform memory access (UMA)
All the processors in the UMA model share the physical memory uniformly.
In a UMA architecture, access time to a memory location is independent of which processor makes the request or which memory chip contains the transferred data.
In the UMA architecture, each processor may use a private cache.
Peripherals are also shared in some fashion.
Parallel regions are specified by the compiler directives in the code:
C / C++ - General Code Structure
#include <omp.h>
main() {
int var1, var2, var3;
/* Serial code */
.
.
/* Beginning of parallel section. Fork a team of threads. Specify variable scoping */
#pragma omp parallel private(var1, var2) shared(var3)
{
Parallel section executed by all threads
.
All threads join master thread and disband
}
/* Resume serial code */
}
|
GNU 4.2 and newer gcc and gfortran compilers include OpenMP support.
Usually, OMP_NUM_THREADS shouldn't exceed the total number of
available cores in a system.
If OMP_NUM_THREADS is undefined, the run will utilize all available cores on the system.
include("right-side-menu.inc");
?>
|