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

📄 102.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>Problems specific to OpenMP</title>	<meta name="Generator" content="ATutor">	<meta name="Keywords" content=""></head><body> <h3>OMP_NUM_THREADS environment variable not initialized</h3>

<p>Most systems have a default value for OMP_NUM_THREADS, which controls the number of OpenMP threads for the program.&nbsp; This value will vary from system to system, so it is important to explicitly define this environment variable in all batch jobs. The following ksh example causes a.out to use 5 processors if they are available: </p>

<pre><code>export OMP_NUM_THREADS=5
   a.out</code></pre>
  
<p>The omp_get_num_threads function can be called within a program to determine the number of threads assigned to that program.</p>

<pre><code>   integer function omp_get_num_threads
   int omp_get_num_threads();</code></pre>

<p>Alternatively, the number of threads can be controlled from within the code with a call to the OMP_SET_NUM_threads routine. </p>

<pre><code>   int nthrds
   nthreads=5
   call omp_set_num_threads(nthrds)</code></pre>

<h3>Common syntax errors</h3>

<p>These errors will usually result in compiletime errors.&nbsp; The most common error for programmers new to OpenMP is implementing an OpenMP function as a subroutine call or vice versa.</p>

<h3>Loop variables not declared correctly (shared or private)</h3>

<p>These errors will result in runtime errors or cause the code to crash. Generally, not declaring variables private/shared correctly will cause data to become corrupted.</p></body></html>

⌨️ 快捷键说明

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