<s>
OpenMP	B-Application
(	O
Open	O
Multi-Processing	B-Operating_System
)	O
is	O
an	O
application	B-Application
programming	I-Application
interface	I-Application
(	O
API	B-Application
)	O
that	O
supports	O
multi-platform	B-Operating_System
shared-memory	O
multiprocessing	B-Operating_System
programming	O
in	O
C	B-Language
,	O
C++	B-Language
,	O
and	O
Fortran	B-Application
,	O
on	O
many	O
platforms	O
,	O
instruction-set	O
architectures	O
and	O
operating	B-General_Concept
systems	I-General_Concept
,	O
including	O
Solaris	B-Application
,	O
AIX	B-Application
,	O
FreeBSD	B-Operating_System
,	O
HP-UX	B-Application
,	O
Linux	B-Application
,	O
macOS	B-Application
,	O
and	O
Windows	B-Application
.	O
</s>
<s>
It	O
consists	O
of	O
a	O
set	O
of	O
compiler	O
directives	O
,	O
library	B-Library
routines	I-Library
,	O
and	O
environment	O
variables	O
that	O
influence	O
run-time	O
behavior	O
.	O
</s>
<s>
OpenMP	B-Application
is	O
managed	O
by	O
the	O
nonprofit	O
technology	O
consortium	B-Application
OpenMP	B-Application
Architecture	O
Review	O
Board	O
(	O
or	O
OpenMP	B-Application
ARB	O
)	O
,	O
jointly	O
defined	O
by	O
a	O
broad	O
swath	O
of	O
leading	O
computer	O
hardware	O
and	O
software	O
vendors	O
,	O
including	O
Arm	O
,	O
AMD	O
,	O
IBM	O
,	O
Intel	O
,	O
Cray	O
,	O
HP	O
,	O
Fujitsu	O
,	O
Nvidia	O
,	O
NEC	O
,	O
Red	O
Hat	O
,	O
Texas	O
Instruments	O
,	O
and	O
Oracle	B-Application
Corporation	I-Application
.	O
</s>
<s>
OpenMP	B-Application
uses	O
a	O
portable	B-Architecture
,	O
scalable	O
model	O
that	O
gives	O
programmers	B-Application
a	O
simple	O
and	O
flexible	O
interface	O
for	O
developing	O
parallel	O
applications	O
for	O
platforms	O
ranging	O
from	O
the	O
standard	O
desktop	B-Device
computer	I-Device
to	O
the	O
supercomputer	B-Architecture
.	O
</s>
<s>
An	O
application	O
built	O
with	O
the	O
hybrid	O
model	O
of	O
parallel	B-Operating_System
programming	I-Operating_System
can	O
run	O
on	O
a	O
computer	B-Architecture
cluster	I-Architecture
using	O
both	O
OpenMP	B-Application
and	O
Message	B-Application
Passing	I-Application
Interface	I-Application
(	O
MPI	B-Application
)	O
,	O
such	O
that	O
OpenMP	B-Application
is	O
used	O
for	O
parallelism	B-Operating_System
within	O
a	O
(	O
multi-core	O
)	O
node	O
while	O
MPI	B-Application
is	O
used	O
for	O
parallelism	B-Operating_System
between	O
nodes	O
.	O
</s>
<s>
and	O
to	O
extend	O
OpenMP	B-Application
for	O
non-shared	O
memory	O
systems	O
.	O
</s>
<s>
OpenMP	B-Application
is	O
an	O
implementation	O
of	O
multithreading	B-Operating_System
,	O
a	O
method	O
of	O
parallelizing	O
whereby	O
a	O
primary	O
thread	B-Operating_System
(	O
a	O
series	O
of	O
instructions	O
executed	O
consecutively	O
)	O
forks	B-Language
a	O
specified	O
number	O
of	O
sub-threads	O
and	O
the	O
system	O
divides	O
a	O
task	O
among	O
them	O
.	O
</s>
<s>
The	O
threads	B-Operating_System
then	O
run	O
concurrently	B-Architecture
,	O
with	O
the	O
runtime	B-Device
environment	I-Device
allocating	O
threads	B-Operating_System
to	O
different	O
processors	O
.	O
</s>
<s>
The	O
section	O
of	O
code	O
that	O
is	O
meant	O
to	O
run	O
in	O
parallel	O
is	O
marked	O
accordingly	O
,	O
with	O
a	O
compiler	O
directive	O
that	O
will	O
cause	O
the	O
threads	B-Operating_System
to	O
form	O
before	O
the	O
section	O
is	O
executed	O
.	O
</s>
<s>
Each	O
thread	B-Operating_System
has	O
an	O
ID	O
attached	O
to	O
it	O
which	O
can	O
be	O
obtained	O
using	O
a	O
function	O
(	O
called	O
omp_get_thread_num( )	O
)	O
.	O
</s>
<s>
The	O
thread	B-Operating_System
ID	O
is	O
an	O
integer	O
,	O
and	O
the	O
primary	O
thread	B-Operating_System
has	O
an	O
ID	O
of	O
0	O
.	O
</s>
<s>
After	O
the	O
execution	O
of	O
the	O
parallelized	B-Operating_System
code	O
,	O
the	O
threads	B-Operating_System
join	O
back	O
into	O
the	O
primary	O
thread	B-Operating_System
,	O
which	O
continues	O
onward	O
to	O
the	O
end	O
of	O
the	O
program	O
.	O
</s>
<s>
By	O
default	O
,	O
each	O
thread	B-Operating_System
executes	O
the	O
parallelized	B-Operating_System
section	O
of	O
code	O
independently	O
.	O
</s>
<s>
Work-sharing	O
constructs	O
can	O
be	O
used	O
to	O
divide	O
a	O
task	O
among	O
the	O
threads	B-Operating_System
so	O
that	O
each	O
thread	B-Operating_System
executes	O
its	O
allocated	O
part	O
of	O
the	O
code	O
.	O
</s>
<s>
Both	O
task	B-Operating_System
parallelism	I-Operating_System
and	O
data	B-Operating_System
parallelism	I-Operating_System
can	O
be	O
achieved	O
using	O
OpenMP	B-Application
in	O
this	O
way	O
.	O
</s>
<s>
The	O
runtime	B-Device
environment	I-Device
allocates	O
threads	B-Operating_System
to	O
processors	O
depending	O
on	O
usage	O
,	O
machine	O
load	O
and	O
other	O
factors	O
.	O
</s>
<s>
The	O
runtime	B-Device
environment	I-Device
can	O
assign	O
the	O
number	O
of	O
threads	B-Operating_System
based	O
on	O
environment	O
variables	O
,	O
or	O
the	O
code	O
can	O
do	O
so	O
using	O
functions	O
.	O
</s>
<s>
The	O
OpenMP	B-Application
functions	O
are	O
included	O
in	O
a	O
header	B-Language
file	I-Language
labelled	O
in	O
C/C	O
++	O
.	O
</s>
<s>
The	O
OpenMP	B-Application
Architecture	O
Review	O
Board	O
(	O
ARB	O
)	O
published	O
its	O
first	O
API	B-Application
specifications	O
,	O
OpenMP	B-Application
for	O
Fortran	B-Application
1.0	O
,	O
in	O
October	O
1997	O
.	O
</s>
<s>
In	O
October	O
the	O
following	O
year	O
they	O
released	O
the	O
C/C	O
++	O
standard	O
.	O
</s>
<s>
2000	O
saw	O
version	O
2.0	O
of	O
the	O
Fortran	B-Application
specifications	O
with	O
version	O
2.0	O
of	O
the	O
C/C	O
++	O
specifications	O
being	O
released	O
in	O
2002	O
.	O
</s>
<s>
Version	O
2.5	O
is	O
a	O
combined	O
C/C	O
++	O
/Fortran	O
specification	O
that	O
was	O
released	O
in	O
2005	O
.	O
</s>
<s>
Up	O
to	O
version	O
2.0	O
,	O
OpenMP	B-Application
primarily	O
specified	O
ways	O
to	O
parallelize	O
highly	O
regular	O
loops	O
,	O
as	O
they	O
occur	O
in	O
matrix-oriented	O
numerical	B-General_Concept
programming	I-General_Concept
,	O
where	O
the	O
number	O
of	O
iterations	O
of	O
the	O
loop	O
is	O
known	O
at	O
entry	O
time	O
.	O
</s>
<s>
In	O
2005	O
,	O
an	O
effort	O
to	O
standardize	O
task	B-Operating_System
parallelism	I-Operating_System
was	O
formed	O
,	O
which	O
published	O
a	O
proposal	O
in	O
2007	O
,	O
taking	O
inspiration	O
from	O
task	B-Operating_System
parallelism	I-Operating_System
features	O
in	O
Cilk	B-Language
,	O
X10	B-Language
and	O
Chapel	B-Language
.	O
</s>
<s>
Included	O
in	O
the	O
new	O
features	O
in	O
3.0	O
is	O
the	O
concept	O
of	O
tasks	O
and	O
the	O
task	O
construct	O
,	O
significantly	O
broadening	O
the	O
scope	O
of	O
OpenMP	B-Application
beyond	O
the	O
parallel	O
loop	O
constructs	O
that	O
made	O
up	O
most	O
of	O
OpenMP	B-Application
2.0	O
.	O
</s>
<s>
It	O
adds	O
or	O
improves	O
the	O
following	O
features	O
:	O
support	O
for	O
accelerators	B-General_Concept
;	O
atomics	B-General_Concept
;	O
error	O
handling	O
;	O
thread	B-Operating_System
affinity	I-Operating_System
;	O
tasking	O
extensions	O
;	O
user	O
defined	O
reduction	B-Application
;	O
SIMD	B-Device
support	O
;	O
Fortran	B-Application
2003	O
support	O
.	O
</s>
<s>
The	O
core	O
elements	O
of	O
OpenMP	B-Application
are	O
the	O
constructs	O
for	O
thread	B-Operating_System
creation	O
,	O
workload	O
distribution	O
(	O
work	O
sharing	O
)	O
,	O
data-environment	O
management	O
,	O
thread	B-Operating_System
synchronization	O
,	O
user-level	O
runtime	O
routines	O
and	O
environment	O
variables	O
.	O
</s>
<s>
In	O
C/C	O
++	O
,	O
OpenMP	B-Application
uses	O
#pragmas	O
.	O
</s>
<s>
The	O
OpenMP	B-Application
specific	O
pragmas	O
are	O
listed	O
below	O
.	O
</s>
<s>
The	O
pragma	O
omp	O
parallel	O
is	O
used	O
to	O
fork	B-Language
additional	O
threads	B-Operating_System
to	O
carry	O
out	O
the	O
work	O
enclosed	O
in	O
the	O
construct	O
in	O
parallel	O
.	O
</s>
<s>
The	O
original	O
thread	B-Operating_System
will	O
be	O
denoted	O
as	O
master	O
thread	B-Operating_System
with	O
thread	B-Operating_System
ID	O
0	O
.	O
</s>
<s>
Example	O
(	O
C	B-Language
program	I-Language
)	O
:	O
Display	O
"	O
Hello	O
,	O
world.	O
"	O
</s>
<s>
using	O
multiple	O
threads	B-Operating_System
.	O
</s>
<s>
Use	O
flag	O
-fopenmp	O
to	O
compile	O
using	O
GCC	B-Application
:	O
</s>
<s>
Output	O
on	O
a	O
computer	O
with	O
two	O
cores	O
,	O
and	O
thus	O
two	O
threads	B-Operating_System
:	O
</s>
<s>
However	O
,	O
the	O
output	O
may	O
also	O
be	O
garbled	O
because	O
of	O
the	O
race	B-Operating_System
condition	I-Operating_System
caused	O
from	O
the	O
two	O
threads	B-Operating_System
sharing	O
the	O
standard	O
output	O
.	O
</s>
<s>
Whether	O
printf	O
is	O
atomic	O
depends	O
on	O
the	O
underlying	O
implementation	O
unlike	O
C++'s	O
std::cout	O
.	O
</s>
<s>
Used	O
to	O
specify	O
how	O
to	O
assign	O
independent	O
work	O
to	O
one	O
or	O
all	O
of	O
the	O
threads	B-Operating_System
.	O
</s>
<s>
omp	O
for	O
or	O
omp	O
do	O
:	O
used	O
to	O
split	B-Operating_System
up	I-Operating_System
loop	I-Operating_System
iterations	I-Operating_System
among	O
the	O
threads	B-Operating_System
,	O
also	O
called	O
loop	O
constructs	O
.	O
</s>
<s>
master	O
:	O
similar	O
to	O
single	O
,	O
but	O
the	O
code	O
block	O
will	O
be	O
executed	O
by	O
the	O
master	O
thread	B-Operating_System
only	O
and	O
no	O
barrier	O
implied	O
in	O
the	O
end	O
.	O
</s>
<s>
This	O
example	O
is	O
embarrassingly	B-Operating_System
parallel	I-Operating_System
,	O
and	O
depends	O
only	O
on	O
the	O
value	O
of	O
.	O
</s>
<s>
The	O
OpenMP	B-Application
flag	O
tells	O
the	O
OpenMP	B-Application
system	O
to	O
split	O
this	O
task	O
among	O
its	O
working	O
threads	B-Operating_System
.	O
</s>
<s>
The	O
threads	B-Operating_System
will	O
each	O
receive	O
a	O
unique	O
and	O
private	O
version	O
of	O
the	O
variable	O
.	O
</s>
<s>
For	O
instance	O
,	O
with	O
two	O
worker	O
threads	B-Operating_System
,	O
one	O
thread	B-Operating_System
might	O
be	O
handed	O
a	O
version	O
of	O
that	O
runs	O
from	O
0	O
to	O
49999	O
while	O
the	O
second	O
gets	O
a	O
version	O
running	O
from	O
50000	O
to	O
99999	O
.	O
</s>
<s>
Variant	O
directives	O
is	O
one	O
of	O
the	O
major	O
features	O
introduced	O
in	O
OpenMP	B-Application
5.0	O
specification	O
to	O
facilitate	O
programmers	B-Application
to	O
improve	O
performance	O
portability	B-Architecture
.	O
</s>
<s>
They	O
enable	O
adaptation	O
of	O
OpenMP	B-Application
pragmas	O
and	O
user	O
code	O
at	O
compile	O
time	O
.	O
</s>
<s>
The	O
specification	O
defines	O
traits	O
to	O
describe	O
active	O
OpenMP	B-Application
constructs	O
,	O
execution	O
devices	O
,	O
and	O
functionality	O
provided	O
by	O
an	O
implementation	O
,	O
context	O
selectors	O
based	O
on	O
the	O
traits	O
and	O
user-defined	O
conditions	O
,	O
and	O
metadirective	O
and	O
declare	O
directive	O
directives	O
for	O
users	O
to	O
program	O
the	O
same	O
code	O
region	O
with	O
variant	O
directives	O
.	O
</s>
<s>
The	O
metadirective	O
is	O
an	O
executable	O
directive	O
that	O
conditionally	O
resolves	O
to	O
another	O
directive	O
at	O
compile	O
time	O
by	O
selecting	O
from	O
multiple	O
directive	O
variants	O
based	O
on	O
traits	O
that	O
define	O
an	O
OpenMP	B-Application
condition	O
or	O
context	O
.	O
</s>
<s>
The	O
mechanism	O
provided	O
by	O
the	O
two	O
variant	O
directives	O
for	O
selecting	O
variants	O
is	O
more	O
convenient	O
to	O
use	O
than	O
the	O
C/C	O
++	O
preprocessing	O
since	O
it	O
directly	O
supports	O
variant	O
selection	O
in	O
OpenMP	B-Application
and	O
allows	O
an	O
OpenMP	B-Application
compiler	O
to	O
analyze	O
and	O
determine	O
the	O
final	O
directive	O
from	O
variants	O
and	O
context	O
.	O
</s>
<s>
Since	O
OpenMP	B-Application
is	O
a	O
shared	O
memory	O
programming	O
model	O
,	O
most	O
variables	O
in	O
OpenMP	B-Application
code	O
are	O
visible	O
to	O
all	O
threads	B-Operating_System
by	O
default	O
.	O
</s>
<s>
But	O
sometimes	O
private	O
variables	O
are	O
necessary	O
to	O
avoid	O
race	B-Operating_System
conditions	I-Operating_System
and	O
there	O
is	O
a	O
need	O
to	O
pass	O
values	O
between	O
the	O
sequential	O
part	O
and	O
the	O
parallel	O
region	O
(	O
the	O
code	O
block	O
executed	O
in	O
parallel	O
)	O
,	O
so	O
data	O
environment	O
management	O
is	O
introduced	O
as	O
data	O
sharing	O
attribute	O
clauses	O
by	O
appending	O
them	O
to	O
the	O
OpenMP	B-Application
directive	O
.	O
</s>
<s>
shared	O
:	O
the	O
data	O
declared	O
outside	O
a	O
parallel	O
region	O
is	O
shared	O
,	O
which	O
means	O
visible	O
and	O
accessible	O
by	O
all	O
threads	B-Operating_System
simultaneously	O
.	O
</s>
<s>
private	O
:	O
the	O
data	O
declared	O
within	O
a	O
parallel	O
region	O
is	O
private	O
to	O
each	O
thread	B-Operating_System
,	O
which	O
means	O
each	O
thread	B-Operating_System
will	O
have	O
a	O
local	O
copy	O
and	O
use	O
it	O
as	O
a	O
temporary	O
variable	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
loop	O
iteration	O
counters	O
in	O
the	O
OpenMP	B-Application
loop	O
constructs	O
are	O
private	O
.	O
</s>
<s>
default	O
:	O
allows	O
the	O
programmer	B-Application
to	O
state	O
that	O
the	O
default	O
data	O
scoping	O
within	O
a	O
parallel	O
region	O
will	O
be	O
either	O
shared	O
,	O
or	O
none	O
for	O
C/C	O
++	O
,	O
or	O
shared	O
,	O
firstprivate	O
,	O
private	O
,	O
or	O
none	O
for	O
Fortran	B-Application
.	O
</s>
<s>
The	O
none	O
option	O
forces	O
the	O
programmer	B-Application
to	O
declare	O
each	O
variable	O
in	O
the	O
parallel	O
region	O
using	O
the	O
data	O
sharing	O
attribute	O
clauses	O
.	O
</s>
<s>
reduction	B-Application
:	O
a	O
safe	O
way	O
of	O
joining	O
work	O
from	O
all	O
threads	B-Operating_System
after	O
construct	O
.	O
</s>
<s>
critical	O
:	O
the	O
enclosed	O
code	O
block	O
will	O
be	O
executed	O
by	O
only	O
one	O
thread	B-Operating_System
at	O
a	O
time	O
,	O
and	O
not	O
simultaneously	O
executed	O
by	O
multiple	O
threads	B-Operating_System
.	O
</s>
<s>
It	O
is	O
often	O
used	O
to	O
protect	O
shared	O
data	O
from	O
race	B-Operating_System
conditions	I-Operating_System
.	O
</s>
<s>
barrier	O
:	O
each	O
thread	B-Operating_System
waits	O
until	O
all	O
of	O
the	O
other	O
threads	B-Operating_System
of	O
a	O
team	O
have	O
reached	O
this	O
point	O
.	O
</s>
<s>
nowait	O
:	O
specifies	O
that	O
threads	B-Operating_System
completing	O
assigned	O
work	O
can	O
proceed	O
without	O
waiting	O
for	O
all	O
threads	B-Operating_System
in	O
the	O
team	O
to	O
finish	O
.	O
</s>
<s>
In	O
the	O
absence	O
of	O
this	O
clause	O
,	O
threads	B-Operating_System
encounter	O
a	O
barrier	O
synchronization	O
at	O
the	O
end	O
of	O
the	O
work	O
sharing	O
construct	O
.	O
</s>
<s>
The	O
iterations	O
in	O
the	O
work	O
sharing	O
construct	O
are	O
assigned	O
to	O
threads	B-Operating_System
according	O
to	O
the	O
scheduling	O
method	O
defined	O
by	O
this	O
clause	O
.	O
</s>
<s>
static	O
:	O
Here	O
,	O
all	O
the	O
threads	B-Operating_System
are	O
allocated	O
iterations	O
before	O
they	O
execute	O
the	O
loop	O
iterations	O
.	O
</s>
<s>
The	O
iterations	O
are	O
divided	O
among	O
threads	B-Operating_System
equally	O
by	O
default	O
.	O
</s>
<s>
However	O
,	O
specifying	O
an	O
integer	O
for	O
the	O
parameter	O
chunk	O
will	O
allocate	O
chunk	O
number	O
of	O
contiguous	O
iterations	O
to	O
a	O
particular	O
thread	B-Operating_System
.	O
</s>
<s>
dynamic	O
:	O
Here	O
,	O
some	O
of	O
the	O
iterations	O
are	O
allocated	O
to	O
a	O
smaller	O
number	O
of	O
threads	B-Operating_System
.	O
</s>
<s>
Once	O
a	O
particular	O
thread	B-Operating_System
finishes	O
its	O
allocated	O
iteration	O
,	O
it	O
returns	O
to	O
get	O
another	O
one	O
from	O
the	O
iterations	O
that	O
are	O
left	O
.	O
</s>
<s>
The	O
parameter	O
chunk	O
defines	O
the	O
number	O
of	O
contiguous	O
iterations	O
that	O
are	O
allocated	O
to	O
a	O
thread	B-Operating_System
at	O
a	O
time	O
.	O
</s>
<s>
guided	O
:	O
A	O
large	O
chunk	O
of	O
contiguous	O
iterations	O
are	O
allocated	O
to	O
each	O
thread	B-Operating_System
dynamically	O
(	O
as	O
above	O
)	O
.	O
</s>
<s>
if	O
:	O
This	O
will	O
cause	O
the	O
threads	B-Operating_System
to	O
parallelize	O
the	O
task	O
only	O
if	O
a	O
condition	O
is	O
met	O
.	O
</s>
<s>
firstprivate	O
:	O
the	O
data	O
is	O
private	O
to	O
each	O
thread	B-Operating_System
,	O
but	O
initialized	O
using	O
the	O
value	O
of	O
the	O
variable	O
using	O
the	O
same	O
name	O
from	O
the	O
master	O
thread	B-Operating_System
.	O
</s>
<s>
lastprivate	O
:	O
the	O
data	O
is	O
private	O
to	O
each	O
thread	B-Operating_System
.	O
</s>
<s>
The	O
value	O
of	O
this	O
private	O
data	O
will	O
be	O
copied	O
to	O
a	O
global	O
variable	O
using	O
the	O
same	O
name	O
outside	O
the	O
parallel	O
region	O
if	O
current	O
iteration	O
is	O
the	O
last	O
iteration	O
in	O
the	O
parallelized	B-Operating_System
loop	O
.	O
</s>
<s>
copyprivate	O
:	O
used	O
with	O
single	O
to	O
support	O
the	O
copying	O
of	O
data	O
values	O
from	O
private	O
objects	O
on	O
one	O
thread	B-Operating_System
(	O
the	O
single	B-Operating_System
thread	I-Operating_System
)	O
to	O
the	O
corresponding	O
objects	O
on	O
other	O
threads	B-Operating_System
in	O
the	O
team	O
.	O
</s>
<s>
reduction	B-Application
(	O
operator	O
|	O
intrinsic	O
:	O
list	O
)	O
:	O
the	O
variable	O
has	O
a	O
local	O
copy	O
in	O
each	O
thread	B-Operating_System
,	O
but	O
the	O
values	O
of	O
the	O
local	O
copies	O
will	O
be	O
summarized	O
(	O
reduced	O
)	O
into	O
a	O
global	O
shared	O
variable	O
.	O
</s>
<s>
The	O
steps	O
that	O
lead	O
up	O
to	O
the	O
operational	O
increment	O
are	O
parallelized	B-Operating_System
,	O
but	O
the	O
threads	B-Operating_System
updates	O
the	O
global	O
variable	O
in	O
a	O
thread	B-Operating_System
safe	O
manner	O
.	O
</s>
<s>
This	O
would	O
be	O
required	O
in	O
parallelizing	O
numerical	B-Algorithm
integration	I-Algorithm
of	O
functions	O
and	O
differential	O
equations	O
,	O
as	O
a	O
common	O
example	O
.	O
</s>
<s>
master	O
:	O
Executed	O
only	O
by	O
the	O
master	O
thread	B-Operating_System
(	O
the	O
thread	B-Operating_System
which	O
forked	O
off	O
all	O
the	O
others	O
during	O
the	O
execution	O
of	O
the	O
OpenMP	B-Application
directive	O
)	O
.	O
</s>
<s>
No	O
implicit	O
barrier	O
;	O
other	O
team	O
members	O
(	O
threads	B-Operating_System
)	O
not	O
required	O
to	O
reach	O
.	O
</s>
<s>
A	O
method	O
to	O
alter	O
the	O
execution	O
features	O
of	O
OpenMP	B-Application
applications	O
.	O
</s>
<s>
Used	O
to	O
control	O
loop	O
iterations	O
scheduling	O
,	O
default	O
number	O
of	O
threads	B-Operating_System
,	O
etc	O
.	O
</s>
<s>
For	O
example	O
,	O
OMP_NUM_THREADS	O
is	O
used	O
to	O
specify	O
number	O
of	O
threads	B-Operating_System
for	O
an	O
application	O
.	O
</s>
<s>
OpenMP	B-Application
has	O
been	O
implemented	O
in	O
many	O
commercial	O
compilers	O
.	O
</s>
<s>
For	O
instance	O
,	O
Visual	O
C++	B-Language
2005	O
,	O
2008	O
,	O
2010	O
,	O
2012	O
and	O
2013	O
support	O
it	O
(	O
OpenMP	B-Application
2.0	O
,	O
in	O
Professional	O
,	O
Team	O
System	O
,	O
Premium	O
and	O
Ultimate	O
editions	O
)	O
,	O
as	O
well	O
as	O
Intel	B-Application
Parallel	I-Application
Studio	I-Application
for	O
various	O
processors	O
.	O
</s>
<s>
Oracle	B-Application
Solaris	I-Application
Studio	I-Application
compilers	O
and	O
tools	O
support	O
the	O
latest	O
OpenMP	B-Application
specifications	O
with	O
productivity	O
enhancements	O
for	O
Solaris	B-Application
OS	I-Application
(	O
UltraSPARC	O
and	O
x86/x64	O
)	O
and	O
Linux	B-Application
platforms	O
.	O
</s>
<s>
The	O
Fortran	B-Application
,	O
C	B-Language
and	O
C++	B-Language
compilers	O
from	O
The	B-Application
Portland	I-Application
Group	I-Application
also	O
support	O
OpenMP	B-Application
2.5	O
.	O
</s>
<s>
GCC	B-Application
has	O
also	O
supported	O
OpenMP	B-Application
since	O
version	O
4.2	O
.	O
</s>
<s>
Compilers	O
with	O
an	O
implementation	O
of	O
OpenMP	B-Application
3.0	O
:	O
</s>
<s>
Intel	O
Fortran	B-Application
and	O
C/C	O
++	O
versions	O
11.0	O
and	O
11.1	O
compilers	O
,	O
Intel	O
C/C	O
++	O
and	O
Fortran	B-Application
Composer	O
XE	O
2011	O
and	O
Intel	B-Application
Parallel	I-Application
Studio	I-Application
.	O
</s>
<s>
Several	O
compilers	O
support	O
OpenMP	B-Application
3.1	O
:	O
</s>
<s>
Compilers	O
supporting	O
OpenMP	B-Application
4.0	O
:	O
</s>
<s>
Several	O
Compilers	O
supporting	O
OpenMP	B-Application
4.5	O
:	O
</s>
<s>
Partial	O
support	O
for	O
OpenMP	B-Application
5.0	O
:	O
</s>
<s>
Auto-parallelizing	O
compilers	O
that	O
generates	O
source	O
code	O
annotated	O
with	O
OpenMP	B-Application
directives	O
:	O
</s>
<s>
Several	O
profilers	O
and	O
debuggers	O
expressly	O
support	O
OpenMP	B-Application
:	O
</s>
<s>
Portable	B-Architecture
multithreading	B-Operating_System
code	O
(	O
in	O
C/C	O
++	O
and	O
other	O
languages	O
,	O
one	O
typically	O
has	O
to	O
call	O
platform-specific	O
primitives	O
in	O
order	O
to	O
get	O
multithreading	B-Operating_System
)	O
.	O
</s>
<s>
Simple	O
:	O
need	O
not	O
deal	O
with	O
message	O
passing	O
as	O
MPI	B-Application
does	O
.	O
</s>
<s>
Scalability	O
comparable	O
to	O
MPI	B-Application
on	O
shared-memory	O
systems	O
.	O
</s>
<s>
Incremental	O
parallelism	B-Operating_System
:	O
can	O
work	O
on	O
one	O
part	O
of	O
the	O
program	O
at	O
one	O
time	O
,	O
no	O
dramatic	O
change	O
to	O
code	O
is	O
needed	O
.	O
</s>
<s>
Unified	O
code	O
for	O
both	O
serial	O
and	O
parallel	O
applications	O
:	O
OpenMP	B-Application
constructs	O
are	O
treated	O
as	O
comments	O
when	O
sequential	O
compilers	O
are	O
used	O
.	O
</s>
<s>
Original	O
(	O
serial	O
)	O
code	O
statements	O
need	O
not	O
,	O
in	O
general	O
,	O
be	O
modified	O
when	O
parallelized	B-Operating_System
with	O
OpenMP	B-Application
.	O
</s>
<s>
Both	O
coarse-grained	B-Operating_System
and	O
fine-grained	B-Operating_System
parallelism	B-Operating_System
are	O
possible	O
.	O
</s>
<s>
In	O
irregular	O
multi-physics	O
applications	O
which	O
do	O
not	O
adhere	O
solely	O
to	O
the	O
SPMD	B-Operating_System
mode	O
of	O
computation	O
,	O
as	O
encountered	O
in	O
tightly	O
coupled	O
fluid-particulate	O
systems	O
,	O
the	O
flexibility	O
of	O
OpenMP	B-Application
can	O
have	O
a	O
big	O
performance	O
advantage	O
over	O
MPI	B-Application
.	O
</s>
<s>
Can	O
be	O
used	O
on	O
various	O
accelerators	B-General_Concept
such	O
as	O
GPGPU	B-Architecture
and	O
FPGAs	B-Architecture
.	O
</s>
<s>
Risk	O
of	O
introducing	O
difficult	O
to	O
debug	O
synchronization	O
bugs	O
and	O
race	B-Operating_System
conditions	I-Operating_System
.	O
</s>
<s>
only	O
runs	O
efficiently	O
in	O
shared-memory	O
multiprocessor	B-Operating_System
platforms	O
(	O
see	O
however	O
Intel	O
's	O
and	O
other	O
distributed	B-Operating_System
shared	I-Operating_System
memory	I-Operating_System
platforms	O
)	O
.	O
</s>
<s>
Requires	O
a	O
compiler	O
that	O
supports	O
OpenMP	B-Application
.	O
</s>
<s>
No	O
support	O
for	O
compare-and-swap	B-Operating_System
.	O
</s>
<s>
Lacks	O
fine-grained	B-Operating_System
mechanisms	O
to	O
control	O
thread-processor	O
mapping	O
.	O
</s>
<s>
High	O
chance	O
of	O
accidentally	O
writing	O
false	B-General_Concept
sharing	I-General_Concept
code	O
.	O
</s>
<s>
One	O
might	O
expect	O
to	O
get	O
an	O
N	O
times	O
speedup	B-Operating_System
when	O
running	O
a	O
program	O
parallelized	B-Operating_System
using	O
OpenMP	B-Application
on	O
a	O
N	O
processor	O
platform	O
.	O
</s>
<s>
Therefore	O
,	O
each	O
thread	B-Operating_System
must	O
wait	O
until	O
the	O
other	O
thread	B-Operating_System
releases	O
the	O
resource	O
.	O
</s>
<s>
A	O
large	O
part	O
of	O
the	O
program	O
may	O
not	O
be	O
parallelized	B-Operating_System
by	O
OpenMP	B-Application
,	O
which	O
means	O
that	O
the	O
theoretical	O
upper	O
limit	O
of	O
speedup	B-Operating_System
is	O
limited	O
according	O
to	O
Amdahl	B-Operating_System
's	I-Operating_System
law	I-Operating_System
.	O
</s>
<s>
N	O
processors	O
in	O
a	O
symmetric	B-Operating_System
multiprocessing	I-Operating_System
(	O
SMP	O
)	O
may	O
have	O
N	O
times	O
the	O
computation	O
power	O
,	O
but	O
the	O
memory	B-General_Concept
bandwidth	I-General_Concept
usually	O
does	O
not	O
scale	O
up	O
N	O
times	O
.	O
</s>
<s>
Quite	O
often	O
,	O
the	O
original	O
memory	O
path	O
is	O
shared	O
by	O
multiple	O
processors	O
and	O
performance	O
degradation	O
may	O
be	O
observed	O
when	O
they	O
compete	O
for	O
the	O
shared	O
memory	B-General_Concept
bandwidth	I-General_Concept
.	O
</s>
<s>
Many	O
other	O
common	O
problems	O
affecting	O
the	O
final	O
speedup	B-Operating_System
in	O
parallel	B-Operating_System
computing	I-Operating_System
also	O
apply	O
to	O
OpenMP	B-Application
,	O
like	O
load	B-Application
balancing	I-Application
and	O
synchronization	O
overhead	O
.	O
</s>
<s>
Compiler	O
optimisation	O
may	O
not	O
be	O
as	O
effective	O
when	O
invoking	O
OpenMP	B-Application
.	O
</s>
<s>
This	O
can	O
commonly	O
lead	O
to	O
a	O
single-threaded	B-Operating_System
OpenMP	B-Application
program	O
running	O
slower	O
than	O
the	O
same	O
code	O
compiled	O
without	O
an	O
OpenMP	B-Application
flag	O
(	O
which	O
will	O
be	O
fully	O
serial	O
)	O
.	O
</s>
<s>
Some	O
vendors	O
recommend	O
setting	O
the	O
processor	B-Operating_System
affinity	I-Operating_System
on	O
OpenMP	B-Application
threads	B-Operating_System
to	O
associate	O
them	O
with	O
particular	O
processor	O
cores	O
.	O
</s>
<s>
This	O
minimizes	O
thread	B-Operating_System
migration	O
and	O
context-switching	O
cost	O
among	O
cores	O
.	O
</s>
<s>
A	O
variety	O
of	O
benchmarks	O
has	O
been	O
developed	O
to	O
demonstrate	O
the	O
use	O
of	O
OpenMP	B-Application
,	O
test	O
its	O
performance	O
and	O
evaluate	O
correctness	O
.	O
</s>
<s>
Barcelona	O
OpenMP	B-Application
Task	O
Suite	O
a	O
collection	O
of	O
applications	O
that	O
allow	O
to	O
test	O
OpenMP	B-Application
tasking	O
implementations	O
.	O
</s>
<s>
Rodinia	O
focusing	O
on	O
accelerators	B-General_Concept
.	O
</s>
<s>
DataRaceBench	O
is	O
a	O
benchmark	O
suite	O
designed	O
to	O
systematically	O
and	O
quantitatively	O
evaluate	O
the	O
effectiveness	O
of	O
OpenMP	B-Application
data	O
race	O
detection	O
tools	O
.	O
</s>
<s>
AutoParBench	O
is	O
a	O
benchmark	O
suite	O
to	O
evaluate	O
compilers	O
and	O
tools	O
which	O
can	O
automatically	O
insert	O
OpenMP	B-Application
directives	O
.	O
</s>
