Skip to content

Commit

Permalink
Merge pull request #893 from edoapra/flaccid-fraction
Browse files Browse the repository at this point in the history
compilation updates
  • Loading branch information
nwchemgit authored Oct 23, 2023
2 parents d1110a5 + 39afa0f commit 060f945
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 39 deletions.
5 changes: 4 additions & 1 deletion src/ccsd/ccsd_trpdrv.F
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 8 additions & 18 deletions src/config/makefile.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


# $Id$
#

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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-)
Expand Down
2 changes: 1 addition & 1 deletion src/geom/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/inp/inp.F
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 4 additions & 7 deletions src/libext/openblas/build_openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/nwdft/scf_dft/dft_scf.F
Original file line number Diff line number Diff line change
Expand Up @@ -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=',
Expand Down
16 changes: 16 additions & 0 deletions src/tools/autoconf_patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
rm -f autoconf.patch
cat > autoconf.patch <<EOF
--- $1/configure.org 2022-11-03 14:47:40.000000000 -0700
+++ $1/configure 2023-10-20 15:36:29.516676155 -0700
@@ -21699 +21698,0 @@
- s/\/.*\/lib.*\.a//p ;
@@ -21811 +21809,0 @@
- s/\/.*\/lib.*\.a//p ;
@@ -22145 +22142,0 @@
- s/\/.*\/lib.*\.a//p ;
@@ -22257 +22253,0 @@
- s/\/.*\/lib.*\.a//p ;
EOF
patch -p0 -s -N < ./autoconf.patch
echo autoconf.patch applied
3 changes: 3 additions & 0 deletions src/tools/get-tools-github
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ if [[ -d "ga-5.8.2" ]]; then
./peigstubs_patch.sh $GA_DIR
./mpipr-too-many_patch.sh $GA_DIR
./ga_ma_align_patch.sh $GA_DIR
if [ $(uname -s) != "Darwin" ]; then
./autoconf_patch.sh $GA_DIR
fi
echo patched
touch ga-5.8.2/patched581
fi
Expand Down
20 changes: 12 additions & 8 deletions travis/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,27 @@ if [[ "$os" == "Linux" ]]; then
fi
if [[ "$FC" == "flang" ]]; then
if [[ "USE_AOMP" == "Y" ]]; then
aomp_major=16
aomp_minor=0-3
aomp_major=18
aomp_minor=0-0
wget -nv https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_"$aomp_major"."$aomp_minor"/aomp_Ubuntu2004_"$aomp_major"."$aomp_minor"_amd64.deb
$MYSUDO dpkg -i aomp_Ubuntu2004_"$aomp_major"."$aomp_minor"_amd64.deb
export PATH=/usr/lib/aomp_"$aomp_major"."$aomp_minor"/bin/:$PATH
export LD_LIBRARY_PATH=/usr/lib/aomp_"$aomp_major"."$aomp_minor"/lib:$LD_LIBRARY_PATH
ls -lrt /usr/lib | grep aomp ||true
else
aocc_version=4.0.0
aocc_dir=aocc-compiler-${aocc_version}
aocc_major=4
aocc_minor=1
aocc_patch=0
aocc_version=${aocc_major}.${aocc_minor}.${aocc_patch}
aocc_dir=aocc-${aocc_major}-${aocc_minor}
aocc_file=aocc-compiler-${aocc_version}
# curl -sS -LJO https://developer.amd.com/wordpress/media/files/${aocc_dir}.tar
tries=0 ; until [ "$tries" -ge 10 ] ; do \
curl -sS -LJO https://download.amd.com/developer/eula/aocc-compiler/${aocc_dir}.tar \
curl -sS -LJO https://download.amd.com/developer/eula/aocc/${aocc_dir}/${aocc_file}.tar \
&& break ; \
tries=$((tries+1)) ; echo attempt no. $tries ; sleep 30 ; done
tar xf ${aocc_dir}.tar
./${aocc_dir}/install.sh
tar xf ${aocc_file}.tar
./${aocc_file}/install.sh
source setenv_AOCC.sh
pwd
fi
Expand All @@ -247,7 +251,7 @@ if [[ "$os" == "Linux" ]]; then
fi
if [[ "$FC" == "amdflang" ]]; then
$MYSUDO apt-get install -y wget gnupg2 coreutils dialog tzdata
rocm_version=5.4.3
rocm_version=5.6.1
tries=0 ; until [ "$tries" -ge 10 ] ; do \
wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | $MYSUDO apt-key add - \
&& break ; \
Expand Down
4 changes: 2 additions & 2 deletions travis/nwchem.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ echo NWCHEM_TOP is $NWCHEM_TOP
export USE_MPI=y
if [[ "$FC" == "flang" ]]; then
if [[ "USE_AOMP" == "Y" ]]; then
aomp_major=16
aomp_minor=0-3
aomp_major=18
aomp_minor=0-0
export PATH=/usr/lib/aomp_"$aomp_major"."$aomp_minor"/bin/:$PATH
export LD_LIBRARY_PATH=/usr/lib/aomp_"$aomp_major"."$aomp_minor"/lib:$LD_LIBRARY_PATH
else
Expand Down

0 comments on commit 060f945

Please sign in to comment.