Skip to content

Commit

Permalink
Merge pull request #916 from edoapra/flaccid-fraction
Browse files Browse the repository at this point in the history
makefile updates
  • Loading branch information
nwchemgit authored Nov 30, 2023
2 parents 3c1b014 + 79052f2 commit 118d5ff
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 192 deletions.
4 changes: 2 additions & 2 deletions src/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ clear_dbl_to_sngl:

directories:
test \! -f 64_to_32 -o \! -f 32_to_64 || rm -f 64_to_32 32_to_64
test -d $(LIBDIR) || $(MKDIR) -p $(LIBDIR)
test -d $(BINDIR) || $(MKDIR) -p $(BINDIR)
test -d $(LIBDIR) || mkdir -p $(LIBDIR)
test -d $(BINDIR) || mkdir -p $(BINDIR)
./util/util_nwchem_version.bash

auxiliary:
Expand Down
264 changes: 130 additions & 134 deletions src/config/makefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ ifeq ($(USE_ARUR),Y)
ARFLAGS = rU
endif


ifndef SKIP_COMPILERS
# strip long paths when FC and/or CC are set from user
ifneq ($(FC),f77)
_FC = $(notdir $(FC))
Expand Down Expand Up @@ -3480,124 +3480,6 @@ endif
# All machine dependent sections should be above here, otherwise #
# some of the definitions below will be 'lost' #
###################################################################
#the new GA uses ARMCI library
ifdef OLD_GA
ORE_LIBS += -larmci
else
ifeq ($(ARMCI_NETWORK),ARMCI)
ifdef EXTERNAL_ARMCI_PATH
CORE_LIBS += -L$(EXTERNAL_ARMCI_PATH)/lib -larmci
else
CORE_LIBS += -larmci
endif
else
CORE_LIBS +=
endif
endif


# MPI version requires tcgmsg-mpi library
ifdef USE_MPI
#ifeq ($(FC),$(findstring $(FC),mpifrt mpfort mpif77 mpxlf mpif90 ftn scorep-ftn))
ifeq ($(FC),$(findstring $(FC), ftn scorep-ftn))
NWLIBMPI =
NWMPI_INCLUDE =
NWMPI_LIB =
else ifdef BUILD_MPICH
NW_CORE_SUBDIRS += libext
PATH := $(NWCHEM_TOP)/src/libext/bin:$(PATH)
NWMPI_INCLUDE = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
NWMPI_LIB = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib)
NWLIBMPI = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi)
NWLIBMPI += $(shell pkg-config --libs-only-L hwloc 2> /dev/null)
ifeq ($(NWCHEM_TARGET),MACX64)
GOT_BREW = $(shell command -v brew 2> /dev/null)
ifdef GOT_BREW
NWLIBMPI += -L$(shell brew --prefix)/lib
endif
endif
else ifdef FORCE_MPI_ENV
ifndef MPI_INCLUDE
errormpi1:
$(info )
$(info FORCE_MPI_ENV set but MPI_INCLUDE not set)
$(info )
$(error )
else
NWMPI_INCLUDE = $(MPI_INCLUDE)
endif
ifndef MPI_LIB
errormpi2:
$(info )
$(info FORCE_MPI_ENV set but MPI_LIB not set)
$(info )
$(error )
else
NWMPI_LIB = $(MPI_LIB)
endif
ifndef LIBMPI
errormpi3:
$(info )
$(info FORCE_MPI_ENV set but LIBMPI not set)
$(info )
$(error )
else
NWLIBMPI = $(LIBMPI)
endif
else
ifeq ($(shell pwd), $(NWCHEM_TOP)/src)
ifndef FORCE_MPI_ENV
ifdef LIBMPI
$(info ***warning LIBMPI ignored since FORCE_MPI_ENV not set***)
endif
ifdef MPI_LIB
$(info ***warning MPI_LIB ignored since FORCE_MPI_ENV not set***)
endif
ifdef MPI_INCLUDE
$(info ***warning MPI_INCLUDE ignored since FORCE_MPI_ENV not set***)
endif
endif
endif
# check if mpif90 is present
MPIF90YN = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
ifeq ($(MPIF90YN),mpif90notfound)
errormpif90:
$(info )
$(info mpif90 not found. Please add its location to PATH)
$(info e.g. export PATH=/usr/local/bin:/usr/lib64/openmpi/bin:...)
$(info )
$(error )
endif
NWMPI_INCLUDE = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
NWMPI_LIB = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib)
NWLIBMPI = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi)
endif

ifdef NWMPI_INCLUDE
LIB_INCLUDES += $(patsubst -I-I%,-I%,-I$(NWMPI_INCLUDE))
endif
ifdef NWMPI_LIB
CORE_LIBS += $(patsubst -L-L%,-L%,-L$(NWMPI_LIB))
endif
ifdef OLD_GA
CORE_LIBS += -ltcgmsg-mpi $(NWLIBMPI)
else
CORE_LIBS += $(NWLIBMPI)
endif
else
errornousempi:
$(info )
$(info please set the env. variable USE_MPI)
$(info and provide a working MPI installation)
$(info )
$(error )
ifdef OLD_GA
CORE_LIBS += -ltcgmsg
else
CORE_LIBS +=
endif
endif


# FFTW3 library inclusion
ifdef USE_FFTW3
Expand Down Expand Up @@ -3695,6 +3577,8 @@ endif
DEFINES += -DPLUMED_HASMPI
endif

#endif #SKIP_COMPILERS


#TBLITE
ifeq ("$(wildcard $(NWCHEM_TOP)/src/config/NWCHEM_CONFIG)","")
Expand All @@ -3718,17 +3602,9 @@ ifdef USE_TBLITE
DEFINES += -DUSE_TBLITE
EXTRA_LIBS += -L$(NWCHEM_TOP)/src/libext/lib
ifdef TBLITE_MESON
TBLITE_MODS=$(NWCHEM_TOP)/src/libext/tblite/tblite/_build/libtblite.so.0.2.0.p
MCTC_MODS=$(NWCHEM_TOP)/src/libext/tblite/tblite/_build/subprojects/mctc-lib/libmctc-lib.a.p
EXTRA_LIBS += -ltblite
else
EXTRA_LIBS += -ltblite -ltoml-f -ldftd4 -lmulticharge -ls-dftd3 -lmctc-lib
TBLITE_MODS=$(NWCHEM_TOP)/src/libext/include/tblite
MCTC_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/mctc-lib/*/)))
MCHR_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/multicharge/*/)))
TOMLF_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/toml-f/*/)))
DFTD3_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/s-dftd3/*/)))
DFTD4_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/dftd4/*/)))
endif
EXTRA_LIBS += $(LAPACK_LIB) $(BLASOPT)
endif
Expand Down Expand Up @@ -3837,15 +3713,9 @@ else
CFLAGS += $(EXTRA_COPTIONS) $(EXTRA_CDEBUG)
endif

INCLUDES = -I. $(LIB_INCLUDES) -I$(INCDIR) $(INCPATH)
CPPFLAGS = $(INCLUDES) $(DEFINES) $(LIB_DEFINES)
LDFLAGS = $(LDOPTIONS) -L$(LIBDIR) $(LIBPATH)
LIBS = $(NW_MODULE_LIBS) $(CORE_LIBS)

# I think this will work everywhere, but it might have to become
# machine-dependent

MKDIR = mkdir
#extract defines to be used with linear algebra libraries
ifdef USE_INTERNALBLAS
DEFINES += -DBLAS_NOTHREADS
Expand Down Expand Up @@ -3943,6 +3813,133 @@ ifeq ($(BLAS_SIZE),8)
LIB_DEFINES += -DUSE_INTEGER8
endif

endif #SKIP_COMPILERS
#the new GA uses ARMCI library
ifdef OLD_GA
CORE_LIBS += -larmci
else
ifeq ($(ARMCI_NETWORK),ARMCI)
ifdef EXTERNAL_ARMCI_PATH
CORE_LIBS += -L$(EXTERNAL_ARMCI_PATH)/lib -larmci
else
CORE_LIBS += -larmci
endif
else
CORE_LIBS +=
endif
endif


# MPI version requires tcgmsg-mpi library
ifdef USE_MPI
#ifeq ($(FC),$(findstring $(FC),mpifrt mpfort mpif77 mpxlf mpif90 ftn scorep-ftn))
ifeq ($(FC),$(findstring $(FC), ftn scorep-ftn))
NWLIBMPI =
NWMPI_INCLUDE =
NWMPI_LIB =
else ifdef BUILD_MPICH
NW_CORE_SUBDIRS += libext
PATH := $(NWCHEM_TOP)/src/libext/bin:$(PATH)
NWMPI_INCLUDE = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
NWMPI_LIB = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib)
NWLIBMPI = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi)
NWLIBMPI += $(shell pkg-config --libs-only-L hwloc 2> /dev/null)
ifeq ($(NWCHEM_TARGET),MACX64)
GOT_BREW = $(shell command -v brew 2> /dev/null)
ifdef GOT_BREW
NWLIBMPI += -L$(shell brew --prefix)/lib
endif
endif
else ifdef FORCE_MPI_ENV
ifndef MPI_INCLUDE
errormpi1:
$(info )
$(info FORCE_MPI_ENV set but MPI_INCLUDE not set)
$(info )
$(error )
else
NWMPI_INCLUDE = $(MPI_INCLUDE)
endif
ifndef MPI_LIB
errormpi2:
$(info )
$(info FORCE_MPI_ENV set but MPI_LIB not set)
$(info )
$(error )
else
NWMPI_LIB = $(MPI_LIB)
endif
ifndef LIBMPI
errormpi3:
$(info )
$(info FORCE_MPI_ENV set but LIBMPI not set)
$(info )
$(error )
else
NWLIBMPI = $(LIBMPI)
endif
else
ifeq ($(shell pwd), $(NWCHEM_TOP)/src)
ifndef FORCE_MPI_ENV
ifdef LIBMPI
$(info ***warning LIBMPI ignored since FORCE_MPI_ENV not set***)
endif
ifdef MPI_LIB
$(info ***warning MPI_LIB ignored since FORCE_MPI_ENV not set***)
endif
ifdef MPI_INCLUDE
$(info ***warning MPI_INCLUDE ignored since FORCE_MPI_ENV not set***)
endif
endif
endif
# check if mpif90 is present
MPIF90YN = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
ifeq ($(MPIF90YN),mpif90notfound)
errormpif90:
$(info )
$(info mpif90 not found. Please add its location to PATH)
$(info e.g. export PATH=/usr/local/bin:/usr/lib64/openmpi/bin:...)
$(info )
$(error )
endif
NWMPI_INCLUDE = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include)
NWMPI_LIB = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib)
NWLIBMPI = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi)
endif

ifdef NWMPI_INCLUDE
LIB_INCLUDES += $(patsubst -I-I%,-I%,-I$(NWMPI_INCLUDE))
endif
ifdef NWMPI_LIB
CORE_LIBS += $(patsubst -L-L%,-L%,-L$(NWMPI_LIB))
endif
ifdef OLD_GA
CORE_LIBS += -ltcgmsg-mpi $(NWLIBMPI)
else
CORE_LIBS += $(NWLIBMPI)
endif
else
ifneq ($(MAKECMDGOALS),$(findstring $(MAKECMDGOALS), clean realclean distclean dependencies include_stamp deps_stamp directories $(BINDIR)/depend.x))
errornousempi:
$(info )
$(info MAKECMDGOALS $(MAKECMDGOALS))
$(info please set the env. variable USE_MPI)
$(info and provide a working MPI installation)
$(info )
$(error )
ifdef OLD_GA
CORE_LIBS += -ltcgmsg
else
CORE_LIBS +=
endif
endif
endif

INCLUDES = -I. $(LIB_INCLUDES) -I$(INCDIR) $(INCPATH)
CPPFLAGS = $(INCLUDES) $(DEFINES) $(LIB_DEFINES)
LDFLAGS = $(LDOPTIONS) -L$(LIBDIR) $(LIBPATH)
LIBS = $(NW_MODULE_LIBS) $(CORE_LIBS)

#
# Define known suffixes mostly so that .p files don\'t cause pc to be invoked
#
Expand Down Expand Up @@ -4074,5 +4071,4 @@ else
.f.o:; flint $(CPPFLAGS) -g -f -u $(SRCDIR)/nwchem.lbt $<

endif

endif
2 changes: 1 addition & 1 deletion src/tools/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ clean:
@test -e $(BUILDDIR)/Makefile && { cd $(BUILDDIR) && $(MAKE) clean; } || echo "Not configured"

realclean:
@rm -rf $(BUILDDIR) $(INSTALLDIR)
@rm -rf $(BUILDDIR) $(INSTALLDIR) *amp
# remove all files that are not .o objects (eg lib*.a) from libga.a
cleanlibga:
mkdir -p ob
Expand Down
15 changes: 15 additions & 0 deletions src/xtb/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ ifndef USE_TBLITE
$(error USE_TBLITE must be set in order to use xTB methods)
endif

ifdef USE_TBLITE
DEFINES += -DUSE_TBLITE
ifdef TBLITE_MESON
TBLITE_MODS=$(NWCHEM_TOP)/src/libext/tblite/tblite/_build/libtblite.so.0.2.0.p
MCTC_MODS=$(NWCHEM_TOP)/src/libext/tblite/tblite/_build/subprojects/mctc-lib/libmctc-lib.a.p
else
TBLITE_MODS=$(NWCHEM_TOP)/src/libext/include/tblite
MCTC_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/mctc-lib/*/)))
MCHR_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/multicharge/*/)))
TOMLF_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/toml-f/*/)))
DFTD3_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/s-dftd3/*/)))
DFTD4_MODS=$(sort $(dir $(wildcard $(NWCHEM_TOP)/src/libext/include/dftd4/*/)))
endif
endif

OBJ = xtb_energy.o xtb_input.o xtb_energy_gradient.o \
xtb_rdinput.o xtb_guess.o xtb_spinpol.o xtb_print_param.o \
xtb_restart_read.o xtb_restart_write.o
Expand Down
2 changes: 1 addition & 1 deletion travis/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if [[ "$os" == "Linux" ]]; then
fi
echo pkg to install: gfortran python3-dev make perl python3 rsync $mpi_libdev $mpi_bin $pkg_extra
tries=0 ; until [ "$tries" -ge 10 ] ; do \
$MYSUDO apt-get -y install gfortran python3-dev make perl python3 rsync $mpi_libdev $mpi_bin $pkg_extra \
$MYSUDO apt-get -y install gfortran python3-dev python-dev-is-python3 make perl python3 rsync $mpi_libdev $mpi_bin $pkg_extra \
&& break ;\
tries=$((tries+1)) ; echo attempt no. $tries ; sleep 30 ; done

Expand Down
Loading

0 comments on commit 118d5ff

Please sign in to comment.