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
|
# Copyright (C) 2001-2020 Quantum ESPRESSO group
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License. See the file `License' in the root directory
# of the present distribution.
#
# Makefile for fundamental math and utility libraries
include ../make.inc
include install_utils
LAPACK_NETLIB=lapack-3.6.1.tgz
LAPACK_NETLIB_NAME=lapack-3.6.1
LAPACK_NETLIB_URL=http://www.netlib.org/lapack/${LAPACK_NETLIB}
# For NVIDIA Eigensolver
EIGENSOLVER_VERSION=0.3.1
EIGENSOLVER_GPU=v${EIGENSOLVER_VERSION}.tar.gz
EIGENSOLVER_GPU_NAME=Eigensolver_gpu-${EIGENSOLVER_VERSION}
EIGENSOLVER_GPU_URL=https://github.com/NVIDIA/Eigensolver_gpu/archive/${EIGENSOLVER_GPU}
# For DevXlib
DEVXLIB_VERSION=master
DEVXLIB_URL="https://gitlab.com/max-centre/components/devicexlib/-/archive/master/devicexlib-${DEVXLIB_VERSION}.tar.gz"
# MAIN target
all: libcuda
###################################
# LAPACK (includes BLAS)
###################################
liblapack : liblapack_$(LAPACK_LIBS_SWITCH)
# lapack is external: don't do anything
liblapack_external :
liblapack_internal:
$(call download_and_unpack,$(LAPACK_NETLIB_NAME),$(LAPACK_NETLIB_URL),LAPACK,LAPACK)
if test ! -e ../LAPACK/liblapack.a && test -e make_lapack.inc; then \
(cp make_lapack.inc ../LAPACK/make.inc; \
cd ../LAPACK; $(MAKE) blaslib lapacklib); else \
(echo "no configuration file found for lapack"; \
echo "run configure from main QE dir"; exit); fi
lapack_clean:
if test -d ../LAPACK; then (cd ../LAPACK; $(MAKE) clean); fi
lapack_veryclean:
if test -d ../LAPACK; then (rm -R -f ../LAPACK ../${LAPACK_NETLIB_NAME}); fi
###################################
# FoX
###################################
libfox:
if test ! -d ../FoX; then \
mkdir ../FoX; \
(gzip -dc ../archive/fox.tgz | (cd ../FoX; tar -xvf -)); \
cd ../FoX/fox/; \
cp -f /usr/share/misc/config.sub config/; \
cp -f /usr/share/misc/config.guess config/; \
export FC=$(F90); export FCFLAGS="$(FOX_FLAGS)"; \
./configure --prefix=$(TOPDIR)/FoX ;\
touch cp_test; \
if cp -p cp_test cp_test_1; then \
echo "cp -p works"; \
else \
find -type f | xargs sed -i 's/cp -p/cp/g'; \
fi; \
$(MAKE) install; cd ../; rm -fr fox;fi
fox_clean:
if test -d ../FoX; then (rm -R -f ../FoX); fi
###################################
# CUDA
###################################
libcuda : $(addprefix libcuda_,$(CUDA_EXTLIBS))
libcuda_eigensolver :
$(call download_and_unpack,$(EIGENSOLVER_GPU_NAME),$(EIGENSOLVER_GPU_URL),EIGENSOLVER_GPU,EIGENSOLVER_GPU)
if test ! -e ../EIGENSOLVER_GPU/lib_eigsolve/lib_eigsolve.a ; then \
(cp Makefile.lib_eigsolve ../EIGENSOLVER_GPU/lib_eigsolve/Makefile; \
cd ../EIGENSOLVER_GPU/lib_eigsolve/; $(MAKE) ); else \
(echo "No configuration file found for GPU custom eigensolver"; exit); fi
libcuda_eigensolver_clean:
if test -d ../EIGENSOLVER_GPU; then (cd ../EIGENSOLVER_GPU/lib_eigsolve ; $(MAKE) clean); fi
libcuda_eigensolver_veryclean:
if test -d ../EIGENSOLVER_GPU; then (rm -R -f ../EIGENSOLVER_GPU ../${EIGENSOLVER_GPU_NAME}); fi
CUDA_PATH := $(if $(GPU_ARCH),$(CUDA_PATH),no)
libcuda_devxlib :
cd ../external/devxlib; \
if test ! -e configure; then \
wget $(DEVXLIB_URL) -O devxlib.tar.gz || curl $(DEVXLIB_URL) -o devxlib.tar.gz ; \
tar xzf devxlib.tar.gz --strip-components=1 -C . ; \
rm devxlib.tar.gz ; \
fi; \
if test ! -f make.inc; then \
touch make.inc; \
$(MAKE) clean; \
export F90FLAGS="$(FOX_FLAGS)"; \
./configure FC=$(F90) CC=$(CC) \
--with-cuda=$(CUDA_PATH) \
--with-cuda-cc=$(GPU_ARCH) \
--with-cuda-runtime=$(CUDA_RUNTIME) \
--disable-parallel \
--enable-cuda-env-check=no; \
fi; \
make all
touch ../install/libcuda_devxlib # do not download and configure again
libcuda_devxlib_clean:
rm libcuda_devxlib
cd ../external/devxlib; \
if test -f make.inc; then ($(MAKE) clean); fi
libcuda_devxlib_veryclean:
cd ../external/devxlib; \
if test -f make.inc; then ($(MAKE) distclean && rm make.inc); fi
###################################
# BEEF
###################################
# NOTA BENE: BEEF is not strictly speaking a mathematical libraries
# It should be compiled like, and together with, the other XC functionals
libbeef : libbeef_$(BEEF_LIBS_SWITCH)
libbeef_external : fake_libbeef_external
fake_libbeef_external :
touch fake_libbeef.a
-rm fake_libbeef.a
libbeef_internal:
if test ! -d ../LIBBEEF; then mkdir ../LIBBEEF; \
( gzip -dc ../archive/libbeef-0.1.2.tar.gz |(cd ../LIBBEEF; tar -xvf -)); fi
cd ../LIBBEEF; $(MAKE)
libbeef_clean:
if test -d ../LIBBEEF; then (cd ../LIBBEEF ; $(MAKE) clean); fi
libbeef_veryclean:
if test -d ../LIBBEEF; then (rm -R -f ../LIBBEEF); fi
###################################
# cleaning
###################################
clean: lapack_clean fox_clean libcuda_eigensolver_clean libcuda_devxlib_clean libbeef_clean
veryclean: lapack_veryclean fox_clean libcuda_eigensolver_veryclean libcuda_devxlib_veryclean libbeef_veryclean
|