From 917edfa307a7ca6f266e03b5911fbfc080cfc0c2 Mon Sep 17 00:00:00 2001 From: Casper A Boon Date: Wed, 12 Dec 2018 08:59:14 +0800 Subject: [PATCH] added support for building with pgi fortran --- Makefile | 12 ++++++++++++ build_glm.sh | 6 ------ src/glm_aed2.F90 | 9 +++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b68c2f2..f6f2ded 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,18 @@ ifeq ($(F90),ifort) ifneq ("$(AED2PLBS)", "") AED2PLBS+=-lifport endif +else ifeq ($(F90),pgfortran) + LINK=$(CC) + DEBUG_FFLAGS=-g -DDEBUG=1 + OPT_FFLAGS=-O3 + FFLAGS=-module ${moddir} $(DEFINES) $(FINCLUDES) + ifeq ($(WITH_CHECKS),true) + FFLAGS+=-Mbounds + endif + FFLAGS+=-r8 + FLIBS+=-L/opt/pgi/linux86-64/18.10/lib + FLIBS+=-lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 + FLIBS+=-lpgftnrtl -lpgmp -lnuma -lpgmath -lpgc else LINK=$(FC) DEBUG_FFLAGS=-g -fbacktrace -DDEBUG=1 diff --git a/build_glm.sh b/build_glm.sh index 6c15263..12b7735 100755 --- a/build_glm.sh +++ b/build_glm.sh @@ -59,9 +59,6 @@ if [ "$FC" = "" ] ; then fi if [ "$FC" = "ifort" ] ; then - # for fabm - FORTRAN_COMPILER="IFORT" - if [ `uname -m` = "i686" ] ; then CPU="ia32" else @@ -80,10 +77,7 @@ if [ "$FC" = "ifort" ] ; then export PATH="/opt/intel/bin:$PATH" export NETCDFHOME=/opt/intel else - # for fabm # if FC is not ifort assume that it is a variant of gfortran - FORTRAN_COMPILER="GFORTRAN" - if [ "$OSTYPE" == "Darwin" ] ; then if [ "${HOMEBREW}" = "true" ] ; then export NETCDFHOME=/usr/local diff --git a/src/glm_aed2.F90 b/src/glm_aed2.F90 index 2e31504..e08ea98 100644 --- a/src/glm_aed2.F90 +++ b/src/glm_aed2.F90 @@ -146,6 +146,7 @@ MODULE glm_aed2 INTEGER :: n_aed2_vars, n_vars, n_vars_ben, n_vars_diag, n_vars_diag_sheet INTEGER :: zone_var = 0 + CHARACTER(len=64) :: NULCSTR = "" !=============================================================================== CONTAINS @@ -263,7 +264,11 @@ SUBROUTINE aed2_init_glm(i_fname,len,MaxLayers,NumWQ_Vars,NumWQ_Ben,pKw) BIND(C, #ifdef __INTEL_COMPILER print *,'glm_aed2 built using intel fortran version ', __INTEL_COMPILER #else +# ifdef __PGI + print *,'glm_aed2 built using pgfortran version ', __PGIC__, '.', __PGIC_MINOR__, '.', __PGIC_PATCHLEVEL__ +# else print *,'glm_aed2 built using gfortran version ', __GNUC__, '.', __GNUC_MINOR__, '.', __GNUC_PATCHLEVEL__ +# endif #endif print *,'init_glm_aed2 using: ', TRIM(fname) namlst = f_get_lun() @@ -1385,7 +1390,7 @@ SUBROUTINE aed2_write_glm(ncid,wlev,nlev,lvl,point_nlevs) BIND(C, name=_WQ_WRITE DO j=1,point_nlevs IF (lvl(j) .GE. 0) THEN ; val_out = cc_diag(lvl(j)+1, d) ELSE ; val_out = missing ; ENDIF - CALL write_csv_point(j, tv%name, len_trim(tv%name), val_out, "", 0, last=last) + CALL write_csv_point(j, tv%name, len_trim(tv%name), val_out, NULCSTR, 0, last=last) ENDDO ENDIF ELSE IF ( .NOT. tv%extern ) THEN @@ -1416,7 +1421,7 @@ SUBROUTINE aed2_write_glm(ncid,wlev,nlev,lvl,point_nlevs) BIND(C, name=_WQ_WRITE DO j=1,point_nlevs IF (lvl(j) .GE. 0) THEN ; val_out = cc(lvl(j)+1, v) ELSE ; val_out = missing ; ENDIF - CALL write_csv_point(j, tv%name, len_trim(tv%name), val_out, "", 0, last=last) + CALL write_csv_point(j, tv%name, len_trim(tv%name), val_out, NULCSTR, 0, last=last) ENDDO ENDIF ENDIF