From c0e9ddc3fc51a65feabc864cebb2dbae9975a806 Mon Sep 17 00:00:00 2001 From: edoapra Date: Wed, 4 May 2022 16:51:12 -0700 Subject: [PATCH] added BUILD_PLUMED to trigger static Plumed install --- src/config/makefile.h | 22 ++++++++--- src/libext/GNUmakefile | 3 ++ src/libext/plumed/GNUmakefile | 19 +++++++++ src/libext/plumed/build_plumed.sh | 64 +++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 src/libext/plumed/GNUmakefile create mode 100755 src/libext/plumed/build_plumed.sh diff --git a/src/config/makefile.h b/src/config/makefile.h index 53f85f34ab..997a099700 100644 --- a/src/config/makefile.h +++ b/src/config/makefile.h @@ -3604,6 +3604,15 @@ ifdef USE_SIMINT endif +ifdef BUILD_PLUMED + NW_CORE_SUBDIRS += libext + PATH := $(NWCHEM_TOP)/src/libext/bin:$(PATH) + LD_LIBRARY_PATH := $(NWCHEM_TOP)/src/libext/lib:$(LD_LIBRARY_PATH) + DEFINES += -DUSE_PLUMED + PLUMED_HOME=$(NWCHEM_TOP)/src/libext + PLUMED_DYNAMIC_LIBS=$(shell test -x $(NWCHEM_TOP)/src/libext/bin/plumed && $(NWCHEM_TOP)/src/libext/bin/plumed info --configuration|egrep DYNAMIC_LIBS| cut -c 14-) + PLUMED_HASMPI = $(shell test -x $(NWCHEM_TOP)/src/libext/bin/plumed && $(NWCHEM_TOP)/src/libext/bin/plumed info --configuration|grep program_can_run_mpi|cut -c 21-21) +endif ifdef USE_PLUMED DEFINES += -DUSE_PLUMED #check presence of plumed command. TODO @@ -3618,13 +3627,8 @@ ifdef USE_PLUMED PLUMED_HOME = $(shell plumed info --configuration|egrep prefix=|head -1|cut -c 8-) PLUMED_DYNAMIC_LIBS = $(shell plumed info --configuration|egrep DYNAMIC_LIBS| cut -c 14-) PLUMED_HASMPI = $(plumed info --configuration|grep program_can_run_mpi|cut -c 21-21) - ifeq ($(PLUMED_HASMPI),y) - DEFINES += -DPLUMED_HASMPI - endif #PLUMED_LOAD= /home/edo/tahoma/apps/plumed262.intel20u2/lib/libplumed.a -ldl -lstdc++ -lfftw3 -lz -ldl -llapack -lblas -rdynamic -Wl,-Bsymbolic -fopenmp - ifdef PLUMED_DYNAMIC_LIBS - EXTRA_LIBS += -L$(PLUMED_HOME)/lib -lplumed $(PLUMED_DYNAMIC_LIBS) - else + ifndef PLUMED_DYNAMIC_LIBS errorplumed: $(info ) $(info PLUMED info command not returning the expected output) @@ -3632,6 +3636,12 @@ ifdef USE_PLUMED $(info ) endif endif + ifdef PLUMED_DYNAMIC_LIBS + EXTRA_LIBS += -L$(PLUMED_HOME)/lib -lplumed $(PLUMED_DYNAMIC_LIBS) + endif + ifeq ($(PLUMED_HASMPI),y) + DEFINES += -DPLUMED_HASMPI + endif #TBLITE diff --git a/src/libext/GNUmakefile b/src/libext/GNUmakefile index 3bee7286fb..72d0de6f68 100644 --- a/src/libext/GNUmakefile +++ b/src/libext/GNUmakefile @@ -25,6 +25,9 @@ endif ifdef USE_TBLITE SUBDIRS += tblite endif +ifdef BUILD_PLUMED + SUBDIRS += plumed +endif include ../config/makelib.h diff --git a/src/libext/plumed/GNUmakefile b/src/libext/plumed/GNUmakefile new file mode 100644 index 0000000000..419382bddc --- /dev/null +++ b/src/libext/plumed/GNUmakefile @@ -0,0 +1,19 @@ +#$Id$ +# makefile,v 1.8 1994/12/05 20:37:08 og845 Exp + +# $Id: GNUmakefile 26876 2015-02-24 06:32:05Z edo $ + +include ../../config/makefile.h + + +../lib/libplumed.a: + ./build_plumed.sh +LIB_TARGETS += scalapack + +include ../../config/makelib.h + +clean: + @rm -rf plumed* ../lib/libplu* ../bin/plumed* ../include/plumed* + + + diff --git a/src/libext/plumed/build_plumed.sh b/src/libext/plumed/build_plumed.sh new file mode 100755 index 0000000000..1d7dd5f5f4 --- /dev/null +++ b/src/libext/plumed/build_plumed.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +#set -ex +if [[ -z "${NWCHEM_TOP}" ]]; then + dir3=$(dirname `pwd`) + dir2=$(dirname "$dir3") + NWCHEM_TOP=$(dirname "$dir2") +fi + +if [[ "$BLAS_SIZE" == 4 ]] && [[ -z "$USE_64TO32" ]] ; then + if [[ "$NWCHEM_TARGET" != "LINUX" ]] && [[ "$NWCHEM_TARGET" != "MACX" ]] ; then + echo USE_64TO32 must be set when BLAS_SIZE=4 on 64-bit architectures + exit 1 + fi +fi +if [[ ! -z "$BUILD_OPENBLAS" ]] ; then + BLASOPT="-L`pwd`/../lib -lnwc_openblas -lpthread" +fi +plumed_branch=cvhd +githubuser=edoapra +#plumed_branch=master +#githubuser=plumed +#rm -rf plumed2 +echo executing git clone --depth=1 -b "$plumed_branch" https://github.com/"$githubuser"/plumed2 plumed2 +git clone --depth=1 -b $plumed_branch https://github.com/$githubuser/plumed2 plumed2 +cd plumed2 +if [[ -z "${FC}" ]]; then + FC=gfortran +fi +FC_EXTRA=$(${NWCHEM_TOP}/src/config/strip_compiler.sh ${FC}) +pkg-config --exists fftw3 +if [[ "$?" == 0 ]]; then + LDFLAGS_EXTRA+=`pkg-config --libs fftw3` +fi +if [[ "${FC_EXTRA}" == "gfortran" ]]; then + LDFLAGS_EXTRA+=" -L"`${FC} -print-file-name=libgfortran.a|sed -e s/libgfortran.a//`" -lgfortran" +fi +if [[ "$BLAS_SIZE" == 8 ]]; then + ILP64=--enable-ilp64 +else + ILP64=" " +fi +echo LDFLAGS_EXTRA is "$LDFLAGS_EXTRA" +MODULES_EXTRA="--enable-modules=+cvhd" +echo executing the command \ +./configure "$MODULES_EXTRA" --disable-mpi --disable-gsl --disable-shared \ + "$ILP64" \ + LDFLAGS="$BLASOPT $LDFLAGS_EXTRA" \ + LIBS="$BLASOPT $LDFLAGS_EXTRA" \ + --prefix=$NWCHEM_TOP/src/libext +./configure "$MODULES_EXTRA" --disable-mpi --disable-gsl --disable-shared\ + "$ILP64" \ + LDFLAGS="$BLASOPT $LDFLAGS_EXTRA" \ + LIBS="$BLASOPT $LDFLAGS_EXTRA" \ + --prefix=$NWCHEM_TOP/src/libext +make -j4 +if [[ "$?" != "0" ]]; then + echo " " + echo "compilation failed" + echo " " + exit 1 +fi +make install +cd .. +#cp lib/libscalapack.a ../../../lib/libnwc_scalapack.a