diff --git a/src/ccsd/ccsd_trpdrv.F b/src/ccsd/ccsd_trpdrv.F index 4bbd9c9ec5..7128476a73 100644 --- a/src/ccsd/ccsd_trpdrv.F +++ b/src/ccsd/ccsd_trpdrv.F @@ -361,12 +361,15 @@ subroutine ccsd_getdjka(djka, integer av,klo,khi,j c integer k,l_kk,k_kk,lenk,start,end,iptr,i,startc + double precision mem_avail logical failed c start = 1 + (j-1)*nvir + (klo-1)*lnov end = (j-1)*nvir + (khi)*lnov lenk=end-start+1 - lenk=min(lenk,(ma_inquire_avail(MT_DBL)*66)/100) +c protect from integer overflowing on 32bit archs + mem_avail=0.66d0*dble(ma_inquire_avail(MT_DBL)) + lenk=min(lenk,int(mem_avail)) crestrict to 5M to avoid OOMs lenk=min(lenk,5000000) 1 continue diff --git a/src/config/makefile.h b/src/config/makefile.h index c4fcb63482..33022f8083 100644 --- a/src/config/makefile.h +++ b/src/config/makefile.h @@ -1,4 +1,5 @@ + # $Id$ # @@ -1321,8 +1322,7 @@ ifeq ($(TARGET),MACX64) USE_FLANG=1 endif ifeq ($(USE_FLANG),1) - FLANG_VERSION=$(shell $(FC) --version |head -1 | sed 's/^.*\(version\)//'|cut -d . -f 1) - FLANG_LT_16 = $(shell [ $(FLANG_VERSION) -lt 16 ] && echo true || echo false) + FLANG_NEW = $(shell [ $(shell $(FC) --help |head -1| cut -d " " -f 2 ) == flang ] && echo true || echo false) endif ifeq ($(_FC),gfortran) @@ -1344,8 +1344,7 @@ ifeq ($(TARGET),MACX64) ifeq ($(USE_FLANG),1) GNU_GE_4_6=true FOPTIONS+=-fno-backslash - DEFINES += -D__FLANG - ifeq ($(FLANG_LT_16),false) + ifeq ($(FLANG_NEW),true) # FOPTIONS+=-fstack-arrays endif else @@ -2098,13 +2097,11 @@ ifneq ($(TARGET),LINUX) endif ifeq ($(USE_FLANG),1) - FLANG_VERSION=$(shell $(FC) --version |head -1 | sed 's/^.*\(version\)//'|cut -d . -f 1) - FLANG_LT_16 = $(shell [ $(FLANG_VERSION) -lt 16 ] && echo true || echo false) + FLANG_NEW = $(shell [ $(shell $(FC) --help |head -1| cut -d " " -f 2 ) == flang ] && echo true || echo false) endif #@info -#@info flv $(FLANG_VERSION) -#@info FLANG_LT_16 $(FLANG_LT_16) +#@info FLANG_NEW $(FLANG_NEW) #@info ifeq ($(CC),clang) @@ -2155,23 +2152,18 @@ ifneq ($(TARGET),LINUX) FOPTIMIZE = -O2 - ifeq ($(_CPU),aarch64) + ifeq ($(_CPU),$(findstring $(_CPU),aarch64 mips64 loongarch64 riscv64 alpha ia64 hppa)) DONTHAVEM64OPT=Y endif ifeq ($(_CPU),mips64) - DONTHAVEM64OPT=Y COPTIONS = -mabi=64 FOPTIONS = -mabi=64 FFLAGS_FORGA = -mabi=64 CFLAGS_FORGA = -mabi=64 endif - ifeq ($(_CPU),loongarch64) - DONTHAVEM64OPT=Y - endif ifeq ($(_CPU),riscv64) - DONTHAVEM64OPT=Y COPTIONS = -march=rv64gc -mabi=lp64d FOPTIONS = -march=rv64gc -mabi=lp64d FFLAGS_FORGA = -march=rv64gc -mabi=lp64d @@ -2220,7 +2212,7 @@ ifneq ($(TARGET),LINUX) FOPTIONS += -ffast-math #-Wunused endif ifeq ($(V),-1) - ifeq ($(FLANG_LT_16),true) + ifeq ($(FLANG_NEW),false) FOPTIONS += -w endif COPTIONS += -w @@ -2246,13 +2238,11 @@ ifneq ($(TARGET),LINUX) GNU_GE_4_6=true FOPTIONS+=-fno-backslash - ifeq ($(FLANG_LT_16),true) + ifeq ($(FLANG_NEW),false) 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-) diff --git a/src/geom/GNUmakefile b/src/geom/GNUmakefile index c08cee966d..87138624c1 100644 --- a/src/geom/GNUmakefile +++ b/src/geom/GNUmakefile @@ -15,7 +15,7 @@ include ../config/makefile.h include ../config/makelib.h - ifeq ($(FLANG_LT_16),false) + ifeq ($(FLANG_NEW),true) FOPTIONS += -fno-automatic endif ifeq ($(_FC),pgf90) diff --git a/src/inp/inp.F b/src/inp/inp.F index a5bc9a5325..56c54aa48a 100644 --- a/src/inp/inp.F +++ b/src/inp/inp.F @@ -15,7 +15,7 @@ block data inp_data data errmsg /' '/ data input_line /0/ data xblnk /' '/ -#if defined(CRAY) || defined(HPUX) || defined(WIN32) || defined(PSCALE) || defined(__FLANG) || ( __GNUC__ >= 4) || defined(FUJITSU) +#if defined(CRAY) || defined(HPUX) || defined(WIN32) || defined(PSCALE) || defined(__FLANG) || defined(__flang__) || ( __GNUC__ >= 4) || defined(FUJITSU) data xtab /' '/ ! Tab ... no backslash necessary #elif (defined(LINUX) || defined(MACX)) && !defined(PGLINUX) && !defined(XLFLINUX) &&!( __GNUC__ >= 4) data xtab /9/ ! Tab ... g77 has trouble with escape sequence diff --git a/src/libext/openblas/build_openblas.sh b/src/libext/openblas/build_openblas.sh index cf483bbb25..4a5df859ab 100755 --- a/src/libext/openblas/build_openblas.sh +++ b/src/libext/openblas/build_openblas.sh @@ -152,12 +152,7 @@ elif [[ -n ${FC} ]] && [[ $(../../../config/strip_compiler.sh "${FC}") == "flan if [[ ${BLAS_SIZE} == 8 ]]; then LAPACK_FPFLAGS_VAL+=" -fdefault-integer-8" fi - FLANG_VERSION=$(${FC} --version |head -1 | sed 's/^.*\(version\)//'|cut -d . -f 1) - if [[ ${FLANG_VERSION} -lt 17 ]]; then - FLANG_GE_17="false" - else - FLANG_GE_17="true" - fi + FLANG_NEW=$( [ $( ${FC} --help |head -1| cut -d " " -f 2 ) == flang ] && echo true || echo false) elif [[ "${_FC}" == "crayftn" ]] ; then # FORCETARGET+=' F_COMPILER=FLANG ' LAPACK_FPFLAGS_VAL=" -s integer64 -ef " @@ -260,7 +255,9 @@ echo output redirected to libext/openblas/OpenBLAS/openblas.log echo if [[ ${_FC} == xlf ]]; then $MYMAKE FC="xlf -qextname" $FORCETARGET LAPACK_FPFLAGS="$LAPACK_FPFLAGS_VAL" INTERFACE64="$sixty4_int" BINARY="$binary" NUM_THREADS=$MYNTS NO_CBLAS=1 NO_LAPACKE=1 DEBUG=0 USE_THREAD="$THREADOPT" libs netlib $MAKEJ >& openblas.log -elif [[ ${FLANG_GE_17} == "true" ]]; then +elif [[ ${FLANG_NEW} == "true" ]]; then + echo FLANG_NEW + echo $MYMAKE FC=$FC CC=$CC HOSTCC=gcc $FORCETARGET FCOMMON_OPT="$LAPACK_FPFLAGS_VAL" LAPACK_FPFLAGS="$LAPACK_FPFLAGS_VAL" INTERFACE64="$sixty4_int" BINARY="$binary" NUM_THREADS=128 NO_CBLAS=1 NO_LAPACKE=1 DEBUG=0 USE_THREAD ="$THREADOPT" libs netlib $MAKEJ $MYMAKE FC=$FC CC=$CC HOSTCC=gcc $FORCETARGET FCOMMON_OPT="$LAPACK_FPFLAGS_VAL" LAPACK_FPFLAGS="$LAPACK_FPFLAGS_VAL" INTERFACE64="$sixty4_int" BINARY="$binary" NUM_THREADS=128 NO_CBLAS=1 NO_LAPACKE=1 DEBUG=0 USE_THREAD="$THREADOPT" libs netlib $MAKEJ >& openblas.log else $MYMAKE FC=$FC CC=$CC HOSTCC=gcc $FORCETARGET LAPACK_FPFLAGS="$LAPACK_FPFLAGS_VAL" INTERFACE64="$sixty4_int" BINARY="$binary" NUM_THREADS=128 NO_CBLAS=1 NO_LAPACKE=1 DEBUG=0 USE_THREAD="$THREADOPT" libs netlib $MAKEJ >& openblas.log diff --git a/src/nwdft/scf_dft/dft_scf.F b/src/nwdft/scf_dft/dft_scf.F index 0ff9eea384..c4ed784a52 100644 --- a/src/nwdft/scf_dft/dft_scf.F +++ b/src/nwdft/scf_dft/dft_scf.F @@ -893,7 +893,8 @@ logical function dft_scf(rtdb, Etold, Enuc, iVcoul_opt, iVxc_opt, & .true.) c check if movecs read has failed if(movecs_in_org.ne.movecs_in) then - if(ga_nodeid().eq.0) then + if(ga_nodeid().eq.0.and. + A util_print('movecs_info', print_high)) then write(luout,*) ' WARNING: movecs_in_org=', c movecs_in_org(1:inp_strlen(movecs_in_org)), c ' not equal to movecs_in=', diff --git a/src/tools/autoconf_patch.sh b/src/tools/autoconf_patch.sh new file mode 100755 index 0000000000..f2e431a113 --- /dev/null +++ b/src/tools/autoconf_patch.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +rm -f autoconf.patch +cat > autoconf.patch <