forked from OpenMP/Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExamples_device.tex
More file actions
35 lines (22 loc) · 1.03 KB
/
Examples_device.tex
File metadata and controls
35 lines (22 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
\pagebreak
\chapter{Device Routines}
\label{chap:device}
\section{\code{omp\_is\_initial\_device} Routine}
The following example shows how the \code{omp\_is\_initial\_device} runtime library routine
can be used to query if a code is executing on the initial host device or on a
target device. The example then sets the number of threads in the \code{parallel}
region based on where the code is executing.
\cexample{device}{1c}
\fexample{device}{1f}
\section{\code{omp\_get\_num\_devices} Routine}
The following example shows how the \code{omp\_get\_num\_devices} runtime library routine
can be used to determine the number of devices.
\cexample{device}{2c}
\fexample{device}{2f}
\section{\code{omp\_set\_default\_device} and \\
\code{omp\_get\_default\_device} Routines}
The following example shows how the \code{omp\_set\_default\_device} and \code{omp\_get\_default\_device}
runtime library routines can be used to set the default device and determine the
default device respectively.
\cexample{device}{3c}
\fexample{device}{3f}