⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 24.html

📁 国外MPI教材
💻 HTML
字号:
<!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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -