summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiziano Müller <dev-zero@gentoo.org>2016-04-22 10:40:02 +0200
committerTiziano Müller <dev-zero@gentoo.org>2016-04-22 10:40:02 +0200
commitc8e6ee71ad4d6e9e6804f56a1e56eab18426284b (patch)
treee0b2d62a42893ffee188c360fde0f4f73054602a /sci-chemistry
parentsci-misc/opari2: add openmp USE flag (diff)
downloaddev-zero-c8e6ee71ad4d6e9e6804f56a1e56eab18426284b.tar.gz
dev-zero-c8e6ee71ad4d6e9e6804f56a1e56eab18426284b.tar.bz2
dev-zero-c8e6ee71ad4d6e9e6804f56a1e56eab18426284b.zip
sci-chemistry/cp2k: add mpi support
Diffstat (limited to 'sci-chemistry')
-rw-r--r--sci-chemistry/cp2k/cp2k-3.0.ebuild36
1 files changed, 28 insertions, 8 deletions
diff --git a/sci-chemistry/cp2k/cp2k-3.0.ebuild b/sci-chemistry/cp2k/cp2k-3.0.ebuild
index b7daf1b..8a047fe 100644
--- a/sci-chemistry/cp2k/cp2k-3.0.ebuild
+++ b/sci-chemistry/cp2k/cp2k-3.0.ebuild
@@ -18,13 +18,17 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
-IUSE="+fftw +libint +libxc +openmp"
+IUSE="+fftw +libint +libxc +openmp mpi"
RDEPEND="virtual/blas
fftw? ( openmp? ( sci-libs/fftw:3.0=[fortran,openmp] )
!openmp? ( sci-libs/fftw:3.0=[fortran,threads] ) )
libint? ( sci-libs/libint:1 )
- libxc? ( =sci-libs/libxc-2.2*[fortran] )"
+ libxc? ( =sci-libs/libxc-2.2*[fortran] )
+ mpi? (
+ virtual/mpi[fortran]
+ virtual/scalapack
+ )"
DEPEND="${RDEPEND}
virtual/pkgconfig
${PYTHON_DEPS}"
@@ -35,14 +39,22 @@ pkg_setup() {
}
src_configure() {
+ incs=("-I/usr/include")
libs=()
- pkgs=("lapack")
+ pkgs=()
if use openmp ; then
append-fflags -fopenmp
append-ldflags -fopenmp
fi
+ if use mpi ; then
+ append-cppflags -D__parallel -D__SCALAPACK -D__MPI_VERSION=3
+ pkgs+=("scalapack")
+ else
+ pkgs+=("lapack")
+ fi
+
if use fftw ; then
append-cppflags -D__FFTW3
@@ -62,16 +74,24 @@ src_configure() {
libs+=("-lxc" "-lxcf90")
fi
+ CC=$(tc-getCC)
+ FC=$(tc-getFC)
+
+ if use mpi ; then
+ CC=mpicc
+ FC=mpifort
+ fi
+
# /usr/include must be included explicitly to have gfortran look for .mod-files there
cat > arch/custom.gentoo << EOF
-CC = $(tc-getCC)
+CC = ${CC}
# empty CPP var makes it use the compiler directly instead of two-step
CPP =
-FC = $(tc-getFC)
-LD = $(tc-getFC)
+FC = ${FC}
+LD = ${FC}
AR = $(tc-getAR) -r
-CPPFLAGS = ${CPPFLAGS} $(pkg-config --cflags ${pkgs[*]})
-FCFLAGS = -ffree-form -ffree-line-length-none ${CPPFLAGS} -I/usr/include $(pkg-config --cflags ${pkgs[*]}) ${FCFLAGS}
+CPPFLAGS = ${CPPFLAGS} ${incs[*]} $(pkg-config --cflags ${pkgs[*]})
+FCFLAGS = -ffree-form -ffree-line-length-none ${CPPFLAGS} ${incs[*]} $(pkg-config --cflags ${pkgs[*]}) ${FCFLAGS}
LDFLAGS = ${LDFLAGS}
LIBS = $(pkg-config --libs ${pkgs[*]}) ${libs[*]}
DATA_DIR = ${EPREFIX}/usr/share/cp2k