24.html
来自「国外MPI教材」· HTML 代码 · 共 50 行
HTML
50 行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif;} a.at-term { font-style: italic; } </style> <title>The Parallel Region</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <p>The <em><a href="../glossary.html#parallel+region" target="body" class="at-term">parallel region</a></em> is the basic construct that creates a team of threads and initiates parallel execution. The C/C++ and Fortran syntax for this construct is as follows:</p>
<p class="codelang">C/C++:</p>
<code><pre><b>#pragma omp parallel</b> \
private (var1, var2, ...) \
shared (var1, var2, ...) \
firstprivate (var1, var2, ...) \
copyin (var1, var2, ...) \
reduction (operator:var1, var2, ...) \
if (expression) \
default (shared|none) \
{
<em>...a structured block of code...</em>
}</pre></code>
<p class="codelang">Fortran Syntax:</p>
<code><pre><b>c$omp parallel</b>
c$omp& shared(var1, var2, ...)
c$omp& private(var1, var2, ...)
c$omp& firstprivate(var1, var2, ...)
c$omp& reduction(operator|intrinsic:var1, var2, ...)
c$omp& if(expression)
c$omp& default(private|shared|none)
<em>...a structured block of code...</em>
<em>c$omp end parallel</em></pre></code>
<p>Most OpenMP directives apply to <em><a href="../glossary.html#structured+block" target="body" class="at-term">structured block</a>s</em>, which are blocks of code with one entry point at the top and one exit point at the bottom. There can be branches within the block, but not
into or out of it. The only exceptions are STOP
statements in Fortran and exit() in C/C++.</p>
<p>A subset of the various clauses will be discussed in the following sections.</p></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?