... | @@ -9,7 +9,6 @@ It will only cover the GPU related options. |
... | @@ -9,7 +9,6 @@ It will only cover the GPU related options. |
|
NOTE: This wiki does not contain all information, please also read the [specification](https://www.openmp.org/specifications/).
|
|
NOTE: This wiki does not contain all information, please also read the [specification](https://www.openmp.org/specifications/).
|
|
|
|
|
|
## Parallel directives
|
|
## Parallel directives
|
|
|
|
|
|
These directives can be used for invoking GPU parallelization.
|
|
These directives can be used for invoking GPU parallelization.
|
|
|
|
|
|
| Directive | Description |
|
|
| Directive | Description |
|
... | @@ -28,20 +27,22 @@ Within the group of memory operations, some operate on a single kernel while oth |
... | @@ -28,20 +27,22 @@ Within the group of memory operations, some operate on a single kernel while oth |
|
### Single kernel memory operations
|
|
### Single kernel memory operations
|
|
|
|
|
|
These directives can be used for invoking GPU memory operations for a single kernel.
|
|
These directives can be used for invoking GPU memory operations for a single kernel.
|
|
|
|
It is generally placed before a loop which is offloaded to the GPU.
|
|
|
|
|
|
| Directive | Description |
|
|
| Directive | Description |
|
|
|:---------:|:------------|
|
|
|:---------:|:------------|
|
|
| map([\<var\>]) | Maps a variable from host and back after the kernel finishes. |
|
|
| map([\<var\>]) | Maps a variable from host and back after the kernel finishes. |
|
|
| map(from:[\<var\>]) | Maps a variable from host. |
|
|
| map(from:[\<var\>]) | Maps a variable from host, it's initial value is undefined. |
|
|
|
|
| map(to:[\<var\>]) | Maps a variable to device, but not back. |
|
|
| map(fromto:[\<var\>]) | Maps a variable from host and back after the kernel finishes. |
|
|
| map(fromto:[\<var\>]) | Maps a variable from host and back after the kernel finishes. |
|
|
| map(alloc:[\<var\>] | Allocate space for the variable on device, but do not copy anything. |
|
|
| map(alloc:[\<var\>] | Allocate space for the variable on device, but do not copy anything. |
|
|
|
|
|
|
### Allocative memory operations
|
|
Note that the `from`, `to`, `fromto`, and `alloc` options are called the *specifiers*.
|
|
|
|
|
|
|
|
### Allocative memory operations
|
|
There are also directives that you can use to allocate memory on the device and is accessible by the kernel.
|
|
There are also directives that you can use to allocate memory on the device and is accessible by the kernel.
|
|
You have the `target enter data map` and `target exit data map` structure, or the `target data map` and `end target data map` structure. The difference is that the latter is bounded to a lexical scope, and the first is not. Both will be described below.
|
|
You have the `target enter data map` and `target exit data map` structure, or the `target data map` and `end target data map` structure. The difference is that the latter is bounded to a lexical scope, and the first is not. Both will be described below.
|
|
|
|
|
|
|
|
|
|
#### Data Map
|
|
#### Data Map
|
|
One can allocate memory on the device with:
|
|
One can allocate memory on the device with:
|
|
`!$omp target data map (<specifier>:<var>)`
|
|
`!$omp target data map (<specifier>:<var>)`
|
... | | ... | |