# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit mpi fortran flag-o-matic eutils multilib toolchain-funcs SLOT="0" LICENSE="BSD" KEYWORDS="~x86 ~amd64" DESCRIPTION="MVAPICH2 MPI-over-infiniband package auto-configured for OpenIB." HOMEPAGE="http://mvapich.cse.ohio-state.edu/" SRC_URI="${HOMEPAGE}/download/mvapich2/mvapich2-${PV/_/-}p1.tgz" S="${WORKDIR}/mvapich2-${PV/_/-}p1" IUSE="debug medium-cluster large-cluster rdma romio threads fortran" RDEPEND=" || ( ( sys-cluster/libibverbs sys-cluster/libibumad sys-cluster/libibmad rdma? ( sys-cluster/librdmacm ) ) sys-cluster/openib-userspace ) $(mpi_imp_deplist)" DEPEND="${RDEPEND}" pkg_setup() { MPI_ESELECT_FILE="eselect.mpi.mvapich2" if [ -z "${MVAPICH_HCA_TYPE}" ]; then elog "${PN} needs to know which HCA it should optimize for. This is" elog "passed to the ebuild with the variable, \${MVAPICH_HCA_TYPE}." elog "Please choose one of: _MLX_PCI_EX_SDR_, _MLX_PCI_EX_DDR_," elog "_MLX_PCI_X, _PATH_HT_, or _IBM_EHCA_." elog "See make.mvapich2.detect in ${S} for more information." die "MVAPICH_HCA_TYPE undefined" fi case ${ARCH} in amd64) if grep Intel /proc/cpuinfo &>/dev/null; then BUILD_ARCH=-D_EM64T_ else BUILD_ARCH=-D_X86_64_ fi ;; x86) BUILD_ARCH=-D_IA32_ ;; ia64) BUILD_ARCH=-D_IA64_ ;; ppc64) BUILD_ARCH=-D_PPC64_ ;; *) die "unsupported architecture: ${ARCH}" ;; esac use fortran && fortran_pkg_setup } src_unpack() { unpack ${A} cd "${S}" einfo "Disabling examples" # Examples are always compiled with the default 'all' target. This # causes problems when we don't build support for everything, including # threads, mpe2, etc. So we're not going to build them. sed -i 's:.*cd examples && ${MAKE} all.*::' Makefile.in } src_compile() { local vcluster="small" use large-cluster && vcluster="large" use medium-cluster && vcluster="medium" local c="--with-device=ch3:sock --with-link=DDR $(use_enable romio) --with-cluster-size=${vcluster} --enable-sharedlibs=gcc" local enable_srq [ "${MVAPICH_HCA_TYPE}" == "_MLX_PCI_X_" ] && enable_srq="-DSRQ" append-flags "${BUILD_ARCH}" append-flags "${enable_srq}" append-flags "-D${MVAPICH_HCA_TYPE}" use debug && c="${c} --enable-g=all --enable-debuginfo" if use threads; then c="${c} --enable-threads=multiple --with-thread-package=pthreads" else c="${c} --with-thread-package=none" fi # enable f90 support for appropriate compilers if use fortran; then case "${FORTRANC}" in gfortran|ifc|ifort|f95) c="${c} --enable-f77 --enable-f90";; g77|f77|f2c) c="${c} --enable-f77 --disable-f90";; esac else c="${c} --disable-f77 --disable-f90" fi sed -i \ -e 's/ ${exec_prefix}/ ${DESTDIR}${exec_prefix}/' \ -e 's/ ${libdir}/ ${DESTDIR}${libdir}/' \ ${S/-beta2/}/Makefile.in sed -i '/bindir/s/ ${bindir}/ ${DESTDIR}${bindir}/' ${S/-beta2/}/src/pm/mpd/Makefile.in cd ${S/-beta2/} ! mpi_classed && c="${c} --sysconfdir=/etc/${PN}" econf $(mpi_econf_args) ${c} # http://www.mcs.anl.gov/research/projects/mpich2/support/index.php?s=faqs#parmake # https://trac.mcs.anl.gov/projects/mpich2/ticket/297 emake -j1 || die "emake failed" #emake || die "emake failed" } src_install() { emake DESTDIR="${D}" install || die "make install failed" mpi_imp_add_eselect } pkg_postinst() { einfo "To allow normal users to use infiniband, it is necessary to" einfo "increase the system limits on locked memory." einfo "You must increase the kernel.shmmax sysctl value, and increase" einfo "the memlock limits in /etc/security/limits.conf. i.e.:" echo einfo "echo 'kernel.shmmax = 512000000' >> /etc/sysctl.conf" einfo "echo 512000000 > /proc/sys/kernel/shmmax" einfo "echo -e '* soft memlock unlimited\n* hard memlock unlimited' > /etc/security/limits.conf" }