OffTarget

Observed issues › nvhpc-managed-acc-shutdown-host-access

Appears to behave incorrectlyCrashes or aborts at run time · Fortran · OpenACC · Open

nvfortran -acc -gpu=mem:managed: host access to an allocatable after !$acc shutdown ends in SIGSEGV

Legality: independently confirmed. 2 independent readings find the program legal and the result required. How this is checked

Affected variants

CompilerMI300A gfx942
unified memory (XNACK 1)
MI300A gfx942
copy (XNACK 0)
MI250X gfx90a
copy (XNACK 0)
MI300X gfx942
copy (XNACK 0)
MI350X gfx950
copy (XNACK 0)
A100 sm_80
separate memory
A100 sm_80
managed memory
AFAR 24.3.0n/an/an/an/an/an/an/a
CCE 19.0.0correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 20.0.2correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.3correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
CCE 21.0.4correctcorrectunknown
not run
unknown
not run
unknown
not run
n/an/a
NVHPC 25.11n/an/an/an/an/acorrectbehaves incorrectly
NVHPC 26.9n/an/an/an/an/acorrectbehaves incorrectly
GCC 16.2.0fails another wayfails another wayfails another wayfails another wayfails another wayfails another wayn/a

"behaves incorrectly" / "not supported": this issue, confirmed in up to four environments (another build directory, another node, a repeat). "fails another way": a different failure, not counted as this issue. "unknown": not run there, or the runs disagree.

Messages

ResultCompiler and GPUMessage
behaves incorrectlyNVHPC 25.11, A100 managed
NVHPC 26.9, A100 managed
show
 after shutdown
timeout: the monitored command dumped core
fails another wayGCC 16.2.0, MI300A unified
GCC 16.2.0, MI300A copy
GCC 16.2.0, MI250X
GCC 16.2.0, MI300X
GCC 16.2.0, MI350X
GCC 16.2.0, A100 separate
show
nvhpc-managed-acc-shutdown-host-access.f90:6:9:
    6 |   !$acc shutdown
      |         1
Error: Unclassifiable OpenACC directive at (1)

Reproduce

NVHPC 25.11, A100 managed

export LD_LIBRARY_PATH=$NVHPC_25_11/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:managed -O2 repro.f90 -o repro
./repro

NVHPC 26.9, A100 managed

export LD_LIBRARY_PATH=$NVHPC_26_9/compilers/lib
nvfortran -acc=gpu -gpu=cc80 -gpu=mem:managed -O2 repro.f90 -o repro
./repro

CCE 19.0.0, MI300A unified (runs correctly)

module load cce/19.0.0 craype-accel-amd-gfx942 rocm/6.4.3
module unload cray-mpich
ftn -h acc -O2 repro.f90 -o repro
HSA_XNACK=1 ./repro
Program (38 lines)
! NVHPC 25.11, NVIDIA A100 80GB PCIe (wingtip, sm_80), managed memory
! (-gpu=mem:managed): after the OpenACC shutdown directive a HOST access to
! an allocatable array ends the program with SIGSEGV; the same program is
! correct in separate memory (the compiler's default).
! Spec: "The shutdown directive shuts down the connection to the given
! device or devices of the given device type, and frees any associated
! runtime resources. This ends all data lifetimes in device memory"
! (OpenACC 3.4 §2.14.2 p.86). It ends device data lifetimes; the host array
! is host data of the program (no data clause names it here), so reading it
! on the host afterwards is defined. Managed memory is NVHPC's mode in which
! "Dynamically allocated host data are placed in CUDA Managed Memory" (HPC
! Compilers User's Guide 25.11 §5.4): the program's own host allocation
! becomes a runtime resource that shutdown frees.
! Expected: "after shutdown" and "sum 64", exit 0.
! Observed (2026-10-24, nvfortran 25.11-0, -O2, two runs, the same):
! - -gpu=mem:separate: "after shutdown", "sum 64", exit 0 (correct);
! - -gpu=mem:managed: no output, exit status 139 (SIGSEGV; the buffered
!   output is lost).
! Found by the catalog: acc34-directive-shutdown is correct in separate
! memory and crashes in managed memory (catalog/mode_differences.yaml
! nvhpc_entries, class managed_failure); reduced by hand to this program.
! NVHPC 26.9 (26.9-0, the latest release; rerun 2026-10-24 on wingtip with
! the same flags): still present -- the same: managed memory SIGSEGV (exit 139), separate correct.
! Fix (2026-10-24): rerun on 25.11 and 26.9 in both memory modes,
! each with its own runtime libraries (LD_LIBRARY_PATH = the release's
! compilers/lib; the first 26.9 runs had loaded 25.11's): still present
! on both releases, the same output.
! NVHPC: nvfortran -acc=gpu -gpu=cc80 -gpu=mem:managed -O2
! Run:   ./a.out
program p
  implicit none
  integer, allocatable :: a(:)
  allocate(a(64))
  a = 1
  !$acc shutdown
  print *, 'after shutdown'
  print *, 'sum', sum(a)
end program p

Source in the repository

Something to add? Dispute its legality · Report it fixed in a newer release · Report a mistake on this page

Expected and observed

Expected

sum 64

Observed where it behaves incorrectly

 after shutdown
timeout: the monitored command dumped core

What the specification requires

The specification text this program relies on and the compiler is expected to support.

OpenACC 3.4 §2.14.2 p.86

The shutdown directive shuts down the connection to the given device or devices of the given device type, and frees any associated runtime resources. This ends all data lifetimes in device memory

Evidence

Same compiler, one change

  • the shutdown directive removed: CCE 19.0.0: correct; CCE 20.0.2: correct; CCE 21.0.3: correct; CCE 21.0.4: correct; NVHPC 25.11: correct; NVHPC 26.9: correct
    Control program
    program p
      implicit none
      integer, allocatable :: a(:)
      allocate(a(64))
      a = 1
      print *, 'after shutdown'
      flush(6)
      print *, 'sum', sum(a)
    end program p
    

Other compilers run it correctly

CCE 19.0.0, CCE 20.0.2, CCE 21.0.3, CCE 21.0.4