36.html

来自「国外MPI教材」· HTML 代码 · 共 36 行

HTML
36
字号
<!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 Barrier</title>	<meta name="Generator" content="ATutor">	<meta name="Keywords" content=""></head><body> <p>The barrier directive is a construct that forces threads to stop until all have reached the barrier. Then they all proceed. </p>

<p class="codelang">Fortran syntax:</p>

        <pre><code>!$omp barrier</code></pre>

<p class="codelang">C/C++ syntax</p>
  
<code><pre>#pragma omp barrier</pre></code>
    
<p>The following example illustrates the use of barriers: </p>

<code><pre>c$omp parallel
c$omp do
  do i = 1, n
    &lt assignment &gt
c$omp barrier
    &lt dependent work &gt
  enddo
c$omp end parallel</pre></code>

<p>The barrier ensures that all assignments have been performed before proceeding to the actual calculations. </p></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?