📄 32.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>OpenMP Runtime Environment Routines</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <p>OpenMP also provides a number of routines that may be called from within your code. These may be used to get and set the number of threads, enable or disable
dynamic thread allocation, check whether the code is executing in parallel, etc. Changes in the runtime environment made by these routines have precedence over the corresponding environment variables. </p>
<p>Examples: </p>
<pre><code>(void) omp_set_num_threads(int <em>num_threads</em>)</code></pre>
<p>This routine sets the number of threads to use for subsequent parallel regions. This overrides the value of OMP_NUM_THREADS. </p>
<pre><code>int omp_get_num_threads()</code></pre>
<p>This routine returns the number of threads currently in the team. </p>
<pre><code>int omp_get_thread_num()</code></pre>
<p>This routine returns the thread number, an integer from zero to the number of threads minus one. Note that this value should be stored in a private variable. </p>
<pre><code>int omp_get_num_procs()</code></pre>
<p>This routine returns the number of physical processors available to the program. </p>
<p>In Fortran, routines that return a value (integer or logical) are implemented as <em>functions</em>, while those that set a value (i.e., take an argument) are <em>subroutines</em>. </p>
<p>In C, there is a header file 'omp.h' which must be #included in any source file that makes use of OpenMP routines. </p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -