... | ... | @@ -39,12 +39,21 @@ These directives can be used for invoking GPU memory operations for a single ker |
|
|
### Allocative memory operations
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
#### Data Map
|
|
|
One can allocate memory on the device with:
|
|
|
`!$omp target data map (<specifier>:<var>)`
|
|
|
Where the specifier is one of the operations listed in the [Single kernel memory operations](#Single-kernel-memory-operations) section above. The specifier determines what happens to the data when the `end data map` pragma is encountered, which looks like:
|
|
|
`!$omp end target data map`
|
|
|
|
|
|
#### Enter Data Map
|
|
|
One can allocate memory on the device with:
|
|
|
`!$omp target enter data map (<specifier>:<var>)`
|
|
|
Where the specifier is one of the operations listed in the section above.
|
|
|
Where the specifier is one of the operations listed in the [Single kernel memory operations](#Single-kernel-memory-operations) section above.
|
|
|
|
|
|
One can deallocate memory on the device (after the kernel finishes) with:
|
|
|
One can deallocate memory on the device with:
|
|
|
`!$omp target exit data map (delete:<var>)`
|
|
|
where the data is deleted. If you want to copy over the data, you can use:
|
|
|
`!$omp target exit data map (from:<var>)`
|
... | ... | |