Hi there,
While looking at some 3rd party code, I have come across a host_data
directive which fails in 2 out of 3 versions. I have looked at the OpenACC
ref guide 2.5, 2.7 and 3.2 and did not see any clear restrictions on the
codes.
Are cases 1 and 3 supposed to work?
Thanks a lot
Salvatore
[sfilippo@euler OACC-GNU]$ mpifort -v
mpifort for MPICH version 4.3.0
Using built-in specs.
COLLECT_GCC=/opt/gnu/16.0.0/bin/gfortran
COLLECT_LTO_WRAPPER=/software/opt/gnu/16.0.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-16-20251109/configure --enable-bootstrap
--enable-languages=c,c++,fortran --prefix=/opt/gnu/16.0.0
--enable-offload-targets=nvptx-none
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251109 (experimental) (GCC)
------------ case 1 --------------
tfc1.f90
subroutine init_w(isize, iv)
use mpi
use openacc
implicit none
integer,intent(in) :: isize
integer :: iv(:)
integer(kind=mpi_address_kind) :: wsz
integer :: wid, mpi_err
wsz = isize*4
!$acc host_data use_device(iv(:))
call MPI_Win_create(iv,wsz,4,MPI_INFO_NULL,MPI_COMM_WORLD,wid,mpi_err)
!$acc end host_data
end subroutine init_w
[sfilippo@euler OACC-GNU]$ mpifort -c tfc1.f90 -fopenacc
-foffload=nvptx-none=-march=sm_75
tfc1.f90:10:32:
10 | !$acc host_data use_device(iv(:))
| 1
Error: Syntax error in OpenMP variable list at (1)
tfc1.f90:12:21:
12 | !$acc end host_data
| 1
Error: Unexpected !$ACC END HOST_DATA statement at (1)
------------------------- case 2 -------------
tfc2.f90
subroutine init_w(isize, iv)
use mpi
use openacc
implicit none
integer,intent(in) :: isize
integer :: iv(:)
integer(kind=mpi_address_kind) :: wsz
integer :: wid, mpi_err
wsz = isize*4
!$acc host_data use_device(iv)
call MPI_Win_create(iv,wsz,4,MPI_INFO_NULL,MPI_COMM_WORLD,wid,mpi_err)
!$acc end host_data
end subroutine init_w
[sfilippo@euler OACC-GNU]$ mpifort -c tfc2.f90 -fopenacc
-foffload=nvptx-none=-march=sm_75
------------------------- case 3 -------------------------
tfc3.f90
subroutine init_w(isize, iv)
use mpi
use openacc
implicit none
integer,intent(in) :: isize
integer, allocatable :: iv(:)
integer(kind=mpi_address_kind) :: wsz
integer :: wid, mpi_err
wsz = isize*4
!$acc host_data use_device(iv)
call MPI_Win_create(iv,wsz,4,MPI_INFO_NULL,MPI_COMM_WORLD,wid,mpi_err)
!$acc end host_data
end subroutine init_w
[sfilippo@euler OACC-GNU]$ mpifort -c tfc3.f90 -fopenacc
-foffload=nvptx-none=-march=sm_75
tfc3.f90:10:30:
10 | !$acc host_data use_device(iv)
| 1~
Error: ALLOCATABLE object ‘iv’ in USE_DEVICE clause at (1)
-------------------------------------