]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/doc/openacc-library-and-environment-variables.rst
d9e06e3188b37629ca532d8f1aa36bf45b55ccdd
[thirdparty/gcc.git] / libgomp / doc / openacc-library-and-environment-variables.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 OpenACC library and environment variables
7 *****************************************
8
9 There are two environment variables associated with the OpenACC library
10 that may be used to control the device type and device number:
11 :envvar:`ACC_DEVICE_TYPE` and :envvar:`ACC_DEVICE_NUM`, respectively. These two
12 environment variables can be used as an alternative to calling
13 ``acc_set_device_num()``. As seen in the second use case, the device
14 type and device number were specified using ``acc_set_device_num()``.
15 If however, the aforementioned environment variables were set, then the
16 call to ``acc_set_device_num()`` would not be required.
17
18 The use of the environment variables is only relevant when an OpenACC function
19 is called prior to a call to ``cudaCreate()``. If ``cudaCreate()``
20 is called prior to a call to an OpenACC function, then you must call
21 ``acc_set_device_num()`` [#f1]_.
22
23 .. -
24 OpenACC Profiling Interface
25 -
26
27 .. [#f1] More complete information
28 about :envvar:`ACC_DEVICE_TYPE` and :envvar:`ACC_DEVICE_NUM` can be found in
29 sections 4.1 and 4.2 of the `OpenACC <https://www.openacc.org>`_
30 Application Programming Interfaceā€¯, Version 2.6.