fopenmp-target-teams-default-vla-alloc-mode, Qopenmp-target-teams-default-vla-alloc-mode
Sets the ability to change the default way the local copies are allocated for variable-length/assumed-sized arrays specified on privatization clauses (private, firstprivate, etc.) on OpenMP* teams and distribute constructs.
Syntax
Linux: |
-fopenmp-target-teams-default-vla-alloc-mode=arg |
Windows: |
/Qopenmp-target-teams-default-vla-alloc-mode:arg |
Arguments
malloc |
Use malloc/free to allocate/deallocate the local copies, making them shared across the threads of a team. The size of the malloc/free buffer may need to be adjusted using LIBOMPTARGET_DYNAMIC_MEMORY_SIZE=<num-mbytes>. |
wilocal |
Default. Use stack allocation by making the local copies private to each thread of each team. For example: Local to each work-item, which uses more memory but avoids synchronization overhead. |
Default
wilocal |
Use stack allocation by making the local copies private to each thread of each team. |
Description
Specify how local copies are allocated by default for variable-length/assumed-size arrays private to teams and distribute constructs for spir64 devices.
When the compiler's analyses determine that a VLA does not need to be shared across threads of a team, it will always use the wilocal mode for allocating its private copies.
IDE Equivalent
Alternate Options
None
Example
The following shows examples of using this option.
cat tgt_teams_par_priv_allocatable.f90
program main
integer, allocatable :: a(:)
allocate(a(10))
call f1(a)
deallocate(a)
contains
subroutine f1(x)
integer :: x(:)
!$omp target teams num_teams(1) private(x) thread_limit(4)
!$omp parallel
print*, loc(x(1))
!$omp end parallel
!$omp end target teams
end subroutine
end program
ifx -O0 -fiopenmp -fopenmp-targets=spir64 tgt_teams_par_priv_allocatable.f90 &>/dev/null && ./a.out
4539628424398232208 4539628424398232248 4539628424398232288 4539628424398232328
ifx -O0 -fiopenmp -fopenmp-targets=spir64 tgt_teams_par_priv_allocatable.f90 -fopenmp-target-teams-default-vla-alloc-mode=malloc &>/dev/null && ./a.out
-72057593926778880 -72057593926778880 -72057593926778880 -72057593926778880