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
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-cluster/mvapich2/mvapich2-1.6.ebuild,v 1.1 2011/06/30 23:11:15 alexxy Exp $
EAPI="4"
inherit fortran-2
DESCRIPTION="MVAPICH2 MPI-over-infiniband package auto-configured for OpenIB"
HOMEPAGE="http://mvapich.cse.ohio-state.edu/"
SRC_URI="${HOMEPAGE}/download/mvapich2/mvapich2-${PV/_/-}.tgz"
SLOT="0"
LICENSE="BSD"
KEYWORDS="~x86 ~amd64"
IUSE="debug fortran large-cluster medium-cluster romio threads"
RDEPEND="
|| (
(
sys-infiniband/libibverbs
sys-infiniband/libibumad
sys-infiniband/libibmad
sys-infiniband/librdmacm )
sys-infiniband/openib-userspace )"
DEPEND="${RDEPEND}"
S="${WORKDIR}/mvapich2-${PV/_/-}"
pkg_setup() {
fortran-2_pkg_setup
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
}
src_prepare() {
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_configure() {
local c="--with-device=osu_ch3:mrail
--with-rdma=gen2
--with-pm=mpd
$(use_enable romio)
--with-mpe=no"
# TODO Shared libs should build with this, but they don't
# --enable-shared=gcc"
local enable_srq
local vcluster=-D_SMALL_CLUSTER
use large-cluster && vcluster=-D_LARGE_CLUSTER
use medium-cluster && vcluster=-D_MEDIUM_CLUSTER
[ "${MVAPICH_HCA_TYPE}" == "_MLX_PCI_X_" ] && enable_srq="-DSRQ"
append-ldflags "-lrdmacm"
append-flags "-DADAPTIVE_RDMA_FAST_PATH -DRDMA_CM"
append-ldflags "-libverbs -libumad -libmad"
append-flags "${BUILD_ARCH} -DUSE_INLINE -D_SMP_ -D_GNU_SOURCE"
append-flags "${enable_srq} -DUSE_HEADER_CACHING -DLAZY_MEM_UNREGISTER"
append-flags "-DONE_SIDED -D${MVAPICH_HCA_TYPE} ${vcluster}"
append-flags "-DMPID_USE_SEQUENCE_NUMBERS -DUSE_MPD_RING"
use debug && c="${c} --enable-g=all --enable-debuginfo"
if use threads; then
c="${c} --enable-threads=multiple --with-thread-package=pthreads"
append-flags "-pthread"
else
c="${c} --with-thread-package=none"
fi
# enable f90 support for appropriate compilers
if use fortran; then
case "$(tc-getFC)" in
gfortran|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/}
econf ${c}
}
src_install() {
emake DESTDIR="${D}"|| die
dodoc CHANGES_MPICH2 COPYRIGHT COPYRIGHT_MVAPICH2 LICENSE.TXT \
README* RELEASE_NOTES*
}
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 500000\n* hard memlock 500000' > /etc/security/limits.conf"
}
|