Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Allocator examples please

jimdempseyatthecove
Honored Contributor III
242 Views

I am in the process of integrating GPU offloads into a simulation program, and the examples on how to use this in Fortran are hard to find.

I am aware that there are allocators, in particular for GPU

omp_target_device_mem_space

omp_target_shared_mem_space

omp_target_host_mem_space

 

potential example

 

allocate(omp_target_shared_mem_space:Array(n)) ! outside of !$omp region

 

However it is unclear as to if the ALLOCATE statement must be preceded by !$OMP ALLOCATE...

 

IOW are both the following appropriate?

 

...code...

allocate(omp_target_shared_mem_space:Array(n))

...code

and

...code...

!$omp allocate omp_target_shared_mem_space

allocate(Array(n))

...code

 

Additionally,

If one has multiple GPUs, how do you direct the allocation to a specific GPU?

(note, allocate statement performed on host).

 

and

if the chosen allocate is

allocate(omp_target_shared_mem_space:Array(n))

and there is no GPU present, does the allocation fail?

Jim

0 Kudos
0 Replies
Reply