1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
#!/usr/bin/make -f
# -*- makefile -*-
#export DH_VERBOSE=1
DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
include /usr/share/mpi-default-dev/debian_defaults
empty :=
space := $(empty)$(empty)
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(OPENMPI_AVAILABLE_ARCHITECTURES)$(space)))
MPI_SUPPORTED = openmpi
endif
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(MPICH_AVAILABLE_ARCHITECTURES)$(space)))
MPI_SUPPORTED += mpich
endif
ifneq (,$(filter checkall,$(DEB_BUILD_OPTIONS)))
export RUN_ALL_TESTS ="yes"
endif
include /usr/share/mpi-default-dev/debian_defaults
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
NUMJOBS = 1
endif
# generic debian package builds don't use chip-specific optimisations
# e.g. don't use i786 instructions in the i386 build
export USE_HWOPT=n
ifeq ($(DEB_HOST_ARCH_BITS),64)
export NWCHEM_TARGET=LINUX64
export USE_64TO32="yes"
else
export NWCHEM_TARGET=LINUX
endif
export BLAS_SIZE=4
export BLAS_LIB="-lblas"
export LAPACK_LIB="-llapack"
export USE_SCALAPACK="yes"
export SCALAPACK_SIZE=4
export NWCHEM_MODULES="pnnl"
export NWCHEM_LONG_PATHS="y"
export PYTHONVERSION=$(shell py3versions -dv)
export PYTHONHOME=$(shell python3-config --prefix)
export LARGE_FILES=TRUE
export FC=gfortran
export USE_MPI="y"
export USE_MPIF="y"
export USE_MPIF4="y"
export MPI_LIB=/usr/lib
LIBMPI_MPICH="$(shell for w in `mpifort.mpich -show`; do if [ "x$${w%$${w#??}}" = "x-L" -o "x$${w%$${w#??}}" = "x-l" ]; then echo -n "$$w "; fi; done)"
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(OPENMPI_AVAILABLE_ARCHITECTURES)$(space)))
LIBMPI_OPENMPI="$(shell pkg-config ompi-fort --libs)"
endif
ifneq (,$(filter ccsdtq,$(DEB_BUILD_OPTIONS)))
export CCSDTQ="yes"
endif
ifneq (,$(filter ccsdtlr,$(DEB_BUILD_OPTIONS)))
export CCSDTLR="yes"
endif
export MRCC_METHODS=y
export IPCCSD=y
export EACCSD=y
export HAS_BLAS="yes"
export BLASOPT=-lblas -llapack
export ARMCI_NETWORK=SOCKETS
export USE_ARUR="yes"
%:
dh $@ --with python3
execute_before_dh_auto_configure:
rm -rf $(CURDIR)/pristine-src $(CURDIR)/build-mpich $(CURDIR)/build-openmpi
tmpdir=`mktemp -d`; \
cp -ra $(CURDIR)/* $${tmpdir}; \
cp debian/dftd3/dftd3.tgz $${tmpdir}/src/nwpw/nwpwlib/nwpwxc; \
mv $$tmpdir $(CURDIR)/pristine-src
cp -ra pristine-src build-mpich
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(OPENMPI_AVAILABLE_ARCHITECTURES)$(space)))
cp -ra pristine-src build-openmpi
endif
override_dh_auto_build-arch:
set -e; \
for mpi_flavor in $(MPI_SUPPORTED); do \
if [ "x$${mpi_flavor}" = "xmpich" ]; then \
export LIBMPI=$"$(LIBMPI_MPICH)$"; \
export LDFLAGS="$${LDFLAGS} -pthread"; \
else \
export LIBMPI=$"$(LIBMPI_OPENMPI)$"; \
fi; \
echo "building nwchem against $${mpi_flavor}"; \
echo "using LIBMPI=$${LIBMPI}"; \
export NWCHEM_TOP=$(CURDIR)/build-$${mpi_flavor}; \
export MPICC=mpicc.$${mpi_flavor}; \
export MPICXX=mpicxx.$${mpi_flavor}; \
export MPIF77=mpif77.$${mpi_flavor}; \
export MPIFC=mpifort.$${mpi_flavor}; \
export MPIF90=mpif90.$${mpi_flavor}; \
export MPI_INCLUDE=/usr/include/$(DEB_HOST_MULTIARCH)/$${mpi_flavor}; \
export MPIRUN_PATH=/usr/bin/mpirun.$${mpi_flavor}; \
export SCALAPACK=-lscalapack-$${mpi_flavor}; \
export BLACS=-lscalapack-$${mpi_flavor}; \
export EXTERNAL_GA_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/ga/$${mpi_flavor}; \
export GA_INCLUDE_PATH=/usr; \
export LIBDIR=$${NWCHEM_TOP}/lib/$(NWCHEM_TARGET); \
mkdir -p $${NWCHEM_TOP}/bin/$${NWCHEM_TARGET}; \
(cd $${NWCHEM_TOP}/src && NWCHEM_TOP=$${NWCHEM_TOP} make -j $(NUMJOBS) nwchem_config); \
if [ "x$(DEB_HOST_ARCH_BITS)" = "x64" ]; then \
(cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) 64_to_32) ; \
find $${NWCHEM_TOP}/src -name include_stamp | xargs rm -f; \
find $${NWCHEM_TOP}/src -name dependencies | xargs rm -f; \
fi; \
(cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS)); \
(cd $${NWCHEM_TOP}/src/util && make -j $(NUMJOBS)); \
(cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) link); \
if [ "x$(DEB_HOST_ARCH_BITS)" = "x64" ]; then \
(cd $${NWCHEM_TOP}/src && make -j $(NUMJOBS) 32_to_64); \
fi; \
cp $${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem $${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem.$${mpi_flavor}; \
done
override_dh_auto_clean:
rm -rf $(CURDIR)/pristine-src $(CURDIR)/build-mpich $(CURDIR)/build-openmpi
dh_testdir
-(cd $(CURDIR)/src && make -j $(NUMJOBS) realclean)
-(cd $(CURDIR)/doc && make -j $(NUMJOBS) realclean)
rm -rf $(CURDIR)/bin $(CURDIR)/lib $(CURDIR)/src/tools/lib
rm -rf $(CURDIR)/QA/scratchdir $(CURDIR)/QA/testoutputs
rm -f src/util/util_version.F src/stubs.F src/util/util_module_avail.F src/util/util_nwchem_version.F
find $(CURDIR) -name "*.stamp" | xargs rm -f
dh_auto_clean
rm -f src/config/NWCHEM_CONFIG src/config/nwchem_config.h
override_dh_auto_test:
dh_testdir
-for mpi_flavor in $(MPI_SUPPORTED); do \
export NWCHEM_TOP=$(CURDIR)/build-$${mpi_flavor}; \
export NWCHEM_BASIS_LIBRARY=$${NWCHEM_TOP}/src/basis/libraries/; \
export NWCHEM_NWPW_LIBRARY=$${NWCHEM_TOP}/src/nwpw/libraryps/; \
export RUNTESTS=$${NWCHEM_TOP}/QA/runtests.mpi.unix; \
export NWCHEM_EXECUTABLE=$${NWCHEM_TOP}/bin/$(NWCHEM_TARGET)/nwchem}; \
(cd $(CURDIR)/build-$${mpi_flavor}/QA && if [ "$(RUN_ALL_TESTS)" = "yes" ]; then \
../debian/testsuite all; \
else \
../debian/testsuite; \
fi); \
done
execute_after_dh_link:
dh_link -pnwchem-$(ARCH_DEFAULT_MPI_IMPL) usr/bin/nwchem.$(ARCH_DEFAULT_MPI_IMPL) usr/bin/nwchem
dh_link -pnwchem-openmpi usr/share/man/man1/nwchem.1.gz usr/share/man/man1/nwchem.openmpi.1.gz
dh_link -pnwchem-mpich usr/share/man/man1/nwchem.1.gz usr/share/man/man1/nwchem.mpich.1.gz
override_dh_gencontrol:
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(OPENMPI_AVAILABLE_ARCHITECTURES)$(space)))
dh_gencontrol -- -Vnwchem:Depends="nwchem-$(ARCH_DEFAULT_MPI_IMPL) | nwchem-mpich | nwchem-openmpi"
else
dh_gencontrol -- -Vnwchem:Depends="nwchem-$(ARCH_DEFAULT_MPI_IMPL) | nwchem-mpich"
endif
|