Nvfortran OpenMP offload fails to compile Fortran module with "double free ..."


I am introducing OpenMP target pragmas to a Fortran-based project called ASAD, which I have open-sourced here:

I configure the project using cmake as follows in a ‘build’ subdirectory:

cmake -DCMAKE_Fortran_COMPILER=nvfortran -DCMAKE_Fortran_FLAGS="-mp=gpu -gpu=cuda11.4" ..

I use nvhpc 21.7. I am compiling on a node with A100 GPU.

Compilation aborts as follows:

[  2%] Building Fortran object CMakeFiles/prog.dir/UKCA/asad_mod.o
double free or corruption (!prev)

I should add that the module asad_mod.F90 contains over 250 allocatable arrays, all of which I try to “declare target”. Not sure if this is too much for the compiler to swallow.
I have tested the OpenMP compilation and offloading on Intel DevCloud with the Intel compilers, and all builds and runs okay with OpenMP target offloading enabled.

Any idea what the issue might be?


Hi Kiril,
Can you include/post the actual compilation line that causes this issue?

  • Brent

Hi Brent, this is the line:

/usr/local/software/nvhpc-rhel8/Linux_x86_64/21.7/compilers/bin/nvfortran -mp=gpu -gpu=cuda11.4 -c /home/kd486/rds/hpc-work/asad-with-openmp-target-offload/UKCA/asad_mod.F90 -o CMakeFiles/prog.dir/UKCA/asad_mod.o

You can find the source file in the repository.


Got it. I will take a look.

This was easy to reproduce, and I’ve entered a bug, FS#30589.