Skip to content

Fix nvfortran HDF5 complex type compatibility #208

@krystophny

Description

@krystophny

Problem

Building libneo with nvfortran fails when compiling src/hdf5_tools/hdf5_tools.F90 due to complex type handling:

NVFORTRAN-S-0155-Could not resolve generic procedure h5dread_f (hdf5_tools.F90: 1279)
NVFORTRAN-S-0155-Could not resolve generic procedure h5dread_f (hdf5_tools.F90: 1280)

Root Cause

Lines 1279-1280 use val%re and val%im syntax to access real/imaginary components of complex arrays, which is a GCC extension. The code has a preprocessor workaround for Intel and old GCC, but nvfortran (NVHPC) is not included:

#if defined(__INTEL_COMPILER) || (defined(__GNUC__) && (__GNUC__ < 9))
    ! Uses temp arrays (works)
#else
    call h5dread_f(dset_id, dt_re_id, val%re, dims, h5error)  ! Fails with nvfortran
    call h5dread_f(dset_id, dt_im_id, val%im, dims, h5error)
#endif

Solution

Add __NVCOMPILER to the preprocessor check at lines 1278, 1298, and similar locations:

#if defined(__INTEL_COMPILER) || defined(__NVCOMPILER) || (defined(__GNUC__) && (__GNUC__ < 9))

This affects h5_get_complex_1, h5_get_complex_2, and h5_get_complex_3 subroutines.

Impact

  • Blocks full library build with nvfortran
  • GPU benchmarks work (standalone build), but full test suite cannot run

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions