Skip to content

NVIDIA cannot verify contiguity of tmpptr in xgrid OpenMP blocks #1851

@marshallward

Description

@marshallward

Describe the bug
When building the newest xgrid with NVIDIA and OpenMP enabled, I get the following error:

NVFORTRAN-S-0155-Illegal POINTER assignment - pointer target must be simply contiguous (/scratch4/GFDL/gfdloceans/Marshall.Ward/m6e/src/FMS2_gpu/exchange/xgrid.F90: 4084)

The code block is

FMS/exchange/xgrid.F90

Lines 4080 to 4097 in 043ab2f

!$OMP parallel do default(none) shared(lsize,shape_d,d_addrs,xmap,recv_buffer,pl,ml) &
!$OMP private(d,tmpptr,grid,i,j,p,pos)
do l = 1, lsize
call c_f_pointer(d_addrs(l), tmpptr, shape=shape_d)
d(xmap%grids(1)%is_me:xmap%grids(1)%ie_me, xmap%grids(1)%js_me:xmap%grids(1)%je_me) => tmpptr
do g=2,size(xmap%grids(:))
grid => xmap%grids(g)
do l3=1,grid%size_repro ! index into side1 grid's patterns
i = grid%x_repro(l3)%i1
j = grid%x_repro(l3)%j1
p = grid%x_repro(l3)%pe-xmap%root_pe
pos = pl(p) + (l-1)*ml(p) + grid%x_repro(l3)%recv_pos
d(i,j) = d(i,j) + recv_buffer(pos)
end do
end do
! normalize with side 1 grid cell areas
d = d * xmap%grids(1)%area_inv
enddo

Since tmpptr has been declared as contiguous, this could be an NVIDIA problem.

To Reproduce
Build with nvfortran with OpenMP enabled (e.g. -mp=gpu)

Expected behavior
It should compile!

System Environment
Describe the system environment, include:

  • OS:

    $ uname -a
    Linux ufe03 5.14.0-570.60.1+4.1.el9_6_ciq.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Feb 6 20:25:28 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
    
  • Compiler(s): Type and version [e.g. Intel 19.1]

    $ nvfortran --version
    
    nvfortran 26.1-0 64-bit target on x86-64 Linux -tp znver4 
    NVIDIA Compilers and Tools
    
  • MPI type, and version (hpc-x)

    $ mpiexec --version
    mpiexec (OpenRTE) 4.1.9a1
    
  • netCDF Version: For both C and Fortran
    (can probably skip this one)

  • Configure options: This is what I used, but probably more

    FCFLAGS = -g -O0 -mp=gpu -acc -gpu=cc90,mem:separate -Mnofma
    LDFLAGS = -mp=gpu
    

Additional context
If I remove the OpenMP directive on the block then it works. That's probably what I will do until this is resolved.

The issue seems to have come from this commit: 301b4fd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions