From 7f2006dc49407f96ea4f71009932c7b2d09d0368 Mon Sep 17 00:00:00 2001 From: edoapra Date: Wed, 11 Oct 2023 17:51:47 -0700 Subject: [PATCH] flang-new-17 aka flang-17 --- .github/workflows/github_actions.yml | 6 +++++ src/config/makefile.h | 34 ++++++++++++++++++++-------- src/config/strip_compiler.sh | 2 ++ travis/build_env.sh | 6 +++++ 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 47bb032cf2..a2eaaeeb61 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -365,6 +365,12 @@ jobs: armci_network: MPI-TS nwchem_modules: "nwdft driver solvation mp2_grad mcscf ccsd rimp2 fcidump nwc_columbus" fc: ifx + - os: ubuntu-22.04 + experimental: true + mpi_impl: mpich + armci_network: MPI-TS + nwchem_modules: "nwdft driver solvation" + fc: flang-new-17 fail-fast: false env: MPI_IMPL: ${{ matrix.mpi_impl }} diff --git a/src/config/makefile.h b/src/config/makefile.h index 175e9eb959..1e7c805b72 100644 --- a/src/config/makefile.h +++ b/src/config/makefile.h @@ -2184,7 +2184,9 @@ ifneq ($(TARGET),LINUX) FOPTIONS += -w COPTIONS += -w else - FOPTIMIZE += -Wuninitialized + ifneq ($(USE_FLANG),1) + FOPTIMIZE += -Wuninitialized + endif ifeq ($(_CC),$(findstring $(_CC),gcc clang)) COPTIONS += -Wall endif @@ -2193,20 +2195,28 @@ ifneq ($(TARGET),LINUX) FOPTIMIZE += -Wno-maybe-uninitialized endif else - FOPTIONS += -Wuninitialized + ifneq ($(USE_FLANG),1) + FOPTIONS += -Wuninitialized + endif endif endif DEFINES += -DGFORTRAN DEFINES += -DCHKUNDFLW -DGCC4 - ifeq ($(USE_FLANG),1) + GNU_GE_4_6=true - FOPTIONS+=-mcmodel=medium - FOPTIONS+=-mcmodel=medium -fno-backslash - COPTIONS+=-mcmodel=medium - CFLAGS_FORGA = -mcmodel=medium - FFLAGS_FORGA = -mcmodel=medium + FOPTIONS+=-fno-backslash + FLANG_VERSION=$(shell $(FC) --version |head -1 |cut -d ' ' -f 4 |cut -d . -f 1) + FLANG_LT_17 = $(shell [ $(FLANG_VERSION) -lt 17 ] && echo true) + ifeq ($(FLANG_LT_17),true) + FOPTIONS+=-mcmodel=medium + COPTIONS+=-mcmodel=medium + CFLAGS_FORGA = -mcmodel=medium + FFLAGS_FORGA = -mcmodel=medium + else + DEFINES += -D__FLANG + endif else GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c18-) ifdef GNUMAJOR @@ -2707,7 +2717,9 @@ ifneq ($(TARGET),LINUX) LINK.f = $(FC) $(LDFLAGS) FOPTIMIZE += -O3 - FOPTIMIZE += -mfpmath=sse # + ifneq ($(USE_FLANG),1) + FOPTIMIZE += -mfpmath=sse # + endif ifeq ($(GNU_GE_6),true) FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks @@ -2753,7 +2765,9 @@ ifneq ($(TARGET),LINUX) ifeq ($(GNU_GE_4_6),true) ifeq ($(shell $(CNFDIR)/check_env.sh $(USE_HWOPT)),1) - FOPTIMIZE += -mtune=native + ifneq ($(USE_FLANG),1) + FOPTIMIZE += -mtune=native + endif endif ifdef GFORTRAN_MARCH FOPTIMIZE += -march=$(GFORTRAN_MARCH) diff --git a/src/config/strip_compiler.sh b/src/config/strip_compiler.sh index c9d97dda1b..69aa38e5ca 100755 --- a/src/config/strip_compiler.sh +++ b/src/config/strip_compiler.sh @@ -7,6 +7,8 @@ elif [[ "$1" == *cc* ]] && [[ ! -z $_CC ]]; then echo $_CC elif [[ "$1" == *gfortran* ]] ; then echo gfortran +elif [[ "$1" == *flang* ]] ; then + echo flang else echo $(basename -- $1 | cut -d \- -f 1 | sed 's/[0-9]*//g') fi diff --git a/travis/build_env.sh b/travis/build_env.sh index ea16604d52..392ae85ec4 100755 --- a/travis/build_env.sh +++ b/travis/build_env.sh @@ -214,6 +214,12 @@ if [[ "$os" == "Linux" ]]; then icc -V fi + if [[ "$FC" == "flang-new-17" ]]; then + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 17 + syudo apt-get -y install flang-17 + fi if [[ "$FC" == "flang" ]]; then if [[ "USE_AOMP" == "Y" ]]; then aomp_major=16