pull request for obsgrid intel compilers

William.Hatheway

Well-known member

This PR adds Linux x86_64 compiler support for both AOCC flang/clang and Intel oneAPI ifx/icx in OBSGRID.

It adds new architecture stanzas, updates generated NetCDF and NCAR Graphics link settings, and adds an Intel oneAPI-specific .F90 preprocessing path so users no longer need to manually patch configure.oa after running ./configure.

Addresses #13.

Changes​

AOCC support​

  • Add a new PC Linux x86_64, AOCC flang compiler with AOCC clang stanza to arch/configure.defaults.
  • Use AOCC flang for Fortran and AOCC clang for C.
  • Add AOCC optimization and math-library flags:
    • -Ofast
    • -ffast-math
    • -fveclib=AMDLIBM
    • -lamdlibm
  • Use llvm-ranlib.
  • Avoid -C in AOCC CPPFLAGS, because preserving C-style comments in preprocessed Fortran can cause flang parse failures.
  • Add an AOCC-specific NCARG_EXTRA_LIBS = -lgfortran hook for NCAR Graphics / NCL installations built with GNU Fortran runtime dependencies.

Intel oneAPI support​

  • Add a new PC Linux i486 i586 i686 x86_64, Intel oneAPI compiler stanza to arch/configure.defaults.
  • Use Intel oneAPI ifx for Fortran and icx for C.
  • Preserve the existing Intel big-endian conversion behavior using:
    • -convert big_endian
  • Add F90_DIRECT_PREPROCESS = 1 for the Intel oneAPI stanza.
  • Update the .F90.o rule in arch/postamble so Intel oneAPI builds can compile .F90 sources directly with:
    • ifx -fpp
  • Keep -fpp out of global CPPFLAGS, because CPPFLAGS is also used by the C compile rule with icx.

Shared link-line updates​

  • Update generated NetCDF link order so the NetCDF Fortran library is linked before the NetCDF C library:
NETCDF_LIBS = -L${NETCDF}/lib CONFIGURE_NETCDFF_LIB -lnetcdf

  • Add common NCAR Graphics transitive libraries used by current NCL / NCAR Graphics installations:
-lfontconfig -lpixman-1 -lfreetype -lhdf5 -lhdf5_hl

  • Add $(NCARG_EXTRA_LIBS) to the NCAR Graphics link line so compiler-specific runtime dependencies can be supplied cleanly by individual architecture stanzas.

Files changed​

arch/configure.defaults<br>arch/preamble<br>arch/postamble<br>

Testing​

Generated configure.oa files for both new compiler options using the updated architecture files.

AOCC generated configuration​

The AOCC-generated configure.oa includes:

FC = flang
FFLAGS = -Mfreeform -Mbyteswapio -Ofast -ffast-math -fveclib=AMDLIBM
F77FLAGS = -Mfixed -Mbyteswapio -Ofast -ffast-math -fveclib=AMDLIBM
FNGFLAGS = $(FFLAGS)
LDFLAGS = -Ofast -ffast-math -fveclib=AMDLIBM -lamdlibm
CC = clang
CFLAGS = -O3 -w
CPP = /lib/cpp
CPPFLAGS = -I. -P -DDEC -traditional
NCARG_EXTRA_LIBS = -lgfortran
RANLIB = llvm-ranlib

The generated AOCC link settings include:

NETCDF_LIBS = -L${NETCDF}/lib -lnetcdff -lnetcdf
NCARG_LIBS = -L${NCARG_ROOT}/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lm -lcairo -lfontconfig -lpixman-1 -lfreetype -lhdf5 -lhdf5_hl $(NCARG_EXTRA_LIBS)

Intel oneAPI generated configuration​

The Intel oneAPI-generated configure.oa includes:

FC = ifx
FFLAGS = -FR -convert big_endian
F77FLAGS = -convert big_endian
FNGFLAGS = $(FFLAGS)
LDFLAGS =
CC = icx
CFLAGS = -w
CPP = ifx
CPPFLAGS = -DDEC -I.
F90_DIRECT_PREPROCESS = 1

The generated Intel oneAPI link settings include:

NETCDF_LIBS = -L${NETCDF}/lib -lnetcdff -lnetcdf
NCARG_LIBS = -L${NCARG_ROOT}/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lm -lcairo

The Intel oneAPI .F90.o rule uses the direct preprocessing path:

$(FC) $(FFLAGS) -fpp $(CPPFLAGS) ${NETCDF_INC} -c $<

The C compile rule remains unaffected and does not receive -fpp:

$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

Notes​

This PR removes the need for downstream users to apply manual sed edits to configure.oa for AOCC and Intel oneAPI builds.

The AOCC change specifically addresses the compiler and link-line problems described in #13. The Intel oneAPI changes are included as a related modernization of the supported Linux x86_64 compiler options.
 
Back
Top