Gentoo Archives: gentoo-commits

From: Justin Lecher <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/magma/
Date: Sat, 28 Dec 2013 18:59:25
Message-Id: 1388256992.0d0221742da92ce829e7b6cead68a420619408d3.jlec@gentoo
1 commit: 0d0221742da92ce829e7b6cead68a420619408d3
2 Author: Justin Lecher <jlec <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 28 18:56:32 2013 +0000
4 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 28 18:56:32 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=0d022174
7
8 sci-libs/magma: Respect LDFLAGS and set soname, gh#166; use cuda support correctly; use openmp uspport correctly; add missing quotes and die
9
10 Package-Manager: portage-2.2.7
11
12 ---
13 sci-libs/magma/ChangeLog | 10 +++
14 sci-libs/magma/magma-1.3.0.ebuild | 142 --------------------------------------
15 sci-libs/magma/magma-1.4.0.ebuild | 62 +++++++++--------
16 3 files changed, 43 insertions(+), 171 deletions(-)
17
18 diff --git a/sci-libs/magma/ChangeLog b/sci-libs/magma/ChangeLog
19 index 1ad76a6..fb815ca 100644
20 --- a/sci-libs/magma/ChangeLog
21 +++ b/sci-libs/magma/ChangeLog
22 @@ -2,6 +2,16 @@
23 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
24 # $Header: $
25
26 + 28 Dec 2013; Justin Lecher <jlec@g.o> -magma-1.3.0.ebuild,
27 + magma-1.4.0.ebuild:
28 + Respect LDFLAGS and set soname, gh#166; use cuda support correctly; use
29 + openmp uspport correctly; add missing quotes and die
30 +
31 + 28 Dec 2013; Justin Lecher <jlec@g.o> -magma-1.3.0.ebuild,
32 + magma-1.4.0.ebuild:
33 + Respect LDFLAGS and set soname, gh#166; use cuda support correctly; use
34 + openmp uspport correctly; add missing quotes and die
35 +
36 22 Feb 2013; Justin Lecher <jlec@g.o> -magma-1.2.1.ebuild,
37 -files/magma-1.2.1-duplicate-symbols.patch, magma-1.3.0.ebuild, metadata.xml:
38 Use tc-getPKG_CONFIG from toolchain-funcs.eclass instead of plain pkg-config;
39
40 diff --git a/sci-libs/magma/magma-1.3.0.ebuild b/sci-libs/magma/magma-1.3.0.ebuild
41 deleted file mode 100644
42 index 37e7949..0000000
43 --- a/sci-libs/magma/magma-1.3.0.ebuild
44 +++ /dev/null
45 @@ -1,142 +0,0 @@
46 -# Copyright 1999-2013 Gentoo Foundation
47 -# Distributed under the terms of the GNU General Public License v2
48 -# $Header: $
49 -
50 -EAPI=4
51 -
52 -FORTRAN_STANDARD="77 90"
53 -inherit eutils fortran-2 multilib toolchain-funcs versionator
54 -
55 -DESCRIPTION="Matrix Algebra on GPU and Multicore Architectures"
56 -HOMEPAGE="http://icl.cs.utk.edu/magma/"
57 -SRC_URI="http://icl.cs.utk.edu/projectsfiles/${PN}/pubs/${P}.tar.gz"
58 -
59 -LICENSE="BSD"
60 -SLOT="0"
61 -KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
62 -IUSE="fermi kepler static-libs"
63 -
64 -RDEPEND="
65 - dev-util/nvidia-cuda-toolkit
66 - virtual/cblas
67 - virtual/fortran
68 - virtual/lapack"
69 -DEPEND="${RDEPEND}
70 - virtual/pkgconfig"
71 -
72 -# We have to have write acccess /dev/nvidia0 and /dev/nvidiactl and the portage
73 -# user is (usually) not in the video group
74 -RESTRICT="userpriv"
75 -
76 -static_to_shared() {
77 - local libstatic=${1}; shift
78 - local libname=$(basename ${libstatic%.a})
79 - local soname=${libname}$(get_libname $(get_version_component_range 1-2))
80 - local libdir=$(dirname ${libstatic})
81 -
82 - einfo "Making ${soname} from ${libstatic}"
83 - if [[ ${CHOST} == *-darwin* ]] ; then
84 - ${LINK:-$(tc-getCC)} ${LDFLAGS} \
85 - -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
86 - -Wl,-all_load -Wl,${libstatic} \
87 - "$@" -o ${libdir}/${soname} || die "${soname} failed"
88 - else
89 - ${LINK:-$(tc-getCC)} ${LDFLAGS} \
90 - -shared -Wl,-soname=${soname} \
91 - -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
92 - "$@" -o ${libdir}/${soname} || die "${soname} failed"
93 - [[ $(get_version_component_count) -gt 1 ]] && \
94 - ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
95 - ln -s ${soname} ${libdir}/${libname}$(get_libname)
96 - fi
97 -}
98 -
99 -src_prepare() {
100 - epatch "${FILESDIR}"/${PN}-1.2.1-no-cuda-driver.patch
101 -
102 - # http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=789
103 - sed -i -e 's/void magmaSetDevice/static void magmaSetDevice/' src/*getrf2_mgpu.cpp
104 -
105 - # distributed pc file not so useful so replace it
106 - cat <<-EOF > ${PN}.pc
107 - prefix=${EPREFIX}/usr
108 - libdir=\${prefix}/$(get_libdir)
109 - includedir=\${prefix}/include/${PN}
110 - Name: ${PN}
111 - Description: ${DESCRIPTION}
112 - Version: ${PV}
113 - URL: ${HOMEPAGE}
114 - Libs: -L\${libdir} -lmagma -lmagmablas
115 - Libs.private: -lm -lpthread -ldl -lcublas -lcudart
116 - Cflags: -I\${includedir}
117 - Requires: cblas lapack
118 - EOF
119 -}
120 -
121 -src_configure() {
122 - cat <<-EOF > make.inc
123 - ARCH = $(tc-getAR)
124 - ARCHFLAGS = cr
125 - RANLIB = $(tc-getRANLIB)
126 - NVCC = nvcc
127 - CC = $(tc-getCXX)
128 - FORT = $(tc-getFC)
129 - INC = -I"${EPREFIX}/opt/cuda/include" -DADD_ -DCUBLAS_GFORTRAN
130 - OPTS = ${CFLAGS} -fPIC
131 - FOPTS = ${FFLAGS} -fPIC -x f95-cpp-input
132 - F77OPTS = ${FFLAGS} -fPIC
133 - NVOPTS = -DADD_ --compiler-options '-fPIC ${CFLAGS}' -DUNIX
134 - LOADER = $(tc-getFC)
135 - LIBBLAS = $($(tc-getPKG_CONFIG) --libs cblas)
136 - LIBLAPACK = $($(tc-getPKG_CONFIG) --libs lapack)
137 - CUDADIR = "${EPREFIX}/opt/cuda"
138 - LIBCUDA = -L\$(CUDADIR)/$(get_libdir) -lcublas -lcudart
139 - LIB = -pthread -lm -ldl \$(LIBCUDA) \$(LIBBLAS) \$(LIBLAPACK) -lstdc++
140 - EOF
141 - if use kepler; then
142 - echo >> make.inc "GPU_TARGET = Kepler"
143 - elif use fermi; then
144 - echo >> make.inc "GPU_TARGET = Fermi"
145 - else # See http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=227
146 - echo >> make.inc "GPU_TARGET = Tesla"
147 - fi
148 -
149 - # see http://icl.cs.utk.edu/magma/forum/viewtopic.php?f=2&t=532
150 -# sed -i -e 's:[cz]heevd_m.cpp::g' src/Makefile.src src/Makefile
151 - sed -i -e 's:[cz]hegvd_m.cpp::g' src/Makefile.src src/Makefile
152 -}
153 -
154 -src_compile() {
155 - # restrict to -j1 otherwise the static archive is not complete
156 - emake -j1 lib
157 - LINK=$(tc-getFC) static_to_shared lib/libmagmablas.a -lm -lpthread -ldl \
158 - -lcublas -lcudart -L"${EPREFIX}"/opt/cuda/$(get_libdir) -lstdc++ \
159 - $($(tc-getPKG_CONFIG) --libs cblas) $($(tc-getPKG_CONFIG) --libs lapack)
160 - static_to_shared lib/libmagma.a -lm -lpthread -ldl -lcublas -lcudart \
161 - -L"${EPREFIX}"/opt/cuda/$(get_libdir) -lmagmablas \
162 - -Llib $($(tc-getPKG_CONFIG) --libs cblas) $($(tc-getPKG_CONFIG) --libs lapack)
163 - if use static-libs; then
164 - emake cleanall
165 - sed 's/-fPIC//g' make.inc
166 - emake lib
167 - fi
168 -}
169 -
170 -src_test() {
171 - emake test lapacktest
172 - cd testing/lin
173 - # we need to access this while running the tests
174 - addwrite /dev/nvidiactl
175 - addwrite /dev/nvidia0
176 - LD_LIBRARY_PATH=${S}/lib python lapack_testing.py || die
177 -}
178 -
179 -src_install() {
180 - dolib.so lib/lib*$(get_libname)*
181 - use static-libs && dolib.a lib/lib*.a
182 - insinto /usr/include/${PN}
183 - doins include/*.h
184 - insinto /usr/$(get_libdir)/pkgconfig
185 - doins ${PN}.pc
186 - dodoc README ReleaseNotes
187 -}
188
189 diff --git a/sci-libs/magma/magma-1.4.0.ebuild b/sci-libs/magma/magma-1.4.0.ebuild
190 index b17c326..8d1eaf7 100644
191 --- a/sci-libs/magma/magma-1.4.0.ebuild
192 +++ b/sci-libs/magma/magma-1.4.0.ebuild
193 @@ -2,10 +2,13 @@
194 # Distributed under the terms of the GNU General Public License v2
195 # $Header: $
196
197 -EAPI=4
198 +EAPI=5
199 +
200 +PYTHON_COMPAT=( python{2_6,2_7} )
201
202 FORTRAN_STANDARD="77 90"
203 -inherit eutils fortran-2 multilib toolchain-funcs versionator
204 +
205 +inherit cuda eutils flag-o-matic fortran-2 multilib toolchain-funcs versionator python-any-r1
206
207 DESCRIPTION="Matrix Algebra on GPU and Multicore Architectures"
208 HOMEPAGE="http://icl.cs.utk.edu/magma/"
209 @@ -14,7 +17,9 @@ SRC_URI="http://icl.cs.utk.edu/projectsfiles/${PN}/downloads/${P}.tar.gz"
210 LICENSE="BSD"
211 SLOT="0"
212 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
213 -IUSE="fermi kepler static-libs"
214 +IUSE="fermi kepler static-libs test"
215 +
216 +REQUIRED_USE="?? ( fermi kepler )"
217
218 RDEPEND="
219 dev-util/nvidia-cuda-toolkit
220 @@ -22,33 +27,16 @@ RDEPEND="
221 virtual/fortran
222 virtual/lapack"
223 DEPEND="${RDEPEND}
224 - virtual/pkgconfig"
225 + virtual/pkgconfig
226 + test? ( ${PYTHON_DEPS} )"
227
228 # We have to have write acccess /dev/nvidia0 and /dev/nvidiactl and the portage
229 # user is (usually) not in the video group
230 RESTRICT="userpriv"
231
232 -static_to_shared() {
233 - local libstatic=${1}; shift
234 - local libname=$(basename ${libstatic%.a})
235 - local soname=${libname}$(get_libname $(get_version_component_range 1-2))
236 - local libdir=$(dirname ${libstatic})
237 -
238 - einfo "Making ${soname} from ${libstatic}"
239 - if [[ ${CHOST} == *-darwin* ]] ; then
240 - ${LINK:-$(tc-getCC)} ${LDFLAGS} \
241 - -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
242 - -Wl,-all_load -Wl,${libstatic} \
243 - "$@" -o ${libdir}/${soname} || die "${soname} failed"
244 - else
245 - ${LINK:-$(tc-getCC)} ${LDFLAGS} \
246 - -shared -Wl,-soname=${soname} \
247 - -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
248 - "$@" -o ${libdir}/${soname} || die "${soname} failed"
249 - [[ $(get_version_component_count) -gt 1 ]] && \
250 - ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
251 - ln -s ${soname} ${libdir}/${libname}$(get_libname)
252 - fi
253 +pkg_setup() {
254 + fortran-2_pkg_setup
255 + use test && python-any-r1_pkg_setup
256 }
257
258 src_prepare() {
259 @@ -61,11 +49,23 @@ src_prepare() {
260 Description: ${DESCRIPTION}
261 Version: ${PV}
262 URL: ${HOMEPAGE}
263 - Libs: -L\${libdir} -lmagma -lmagmablas
264 + Libs: -L\${libdir} -lmagma
265 Libs.private: -lm -lpthread -ldl -lcublas -lcudart
266 Cflags: -I\${includedir}
267 Requires: cblas lapack
268 EOF
269 +
270 + if [[ $(tc-getCC) =~ gcc ]]; then
271 + local eopenmp=-fopenmp
272 + elif [[ $(tc-getCC) =~ icc ]]; then
273 + local eopenmp=-openmp
274 + else
275 + elog "Cannot detect compiler type so not setting openmp support"
276 + fi
277 + append-flags -fPIC ${eopenmp}
278 + append-ldflags -Wl,-soname,lib${PN}.so.1.4 ${eopenmp}
279 +
280 + cuda_src_prepare
281 }
282
283 src_configure() {
284 @@ -80,7 +80,8 @@ src_configure() {
285 OPTS = ${CFLAGS} -fPIC
286 FOPTS = ${FFLAGS} -fPIC -x f95-cpp-input
287 F77OPTS = ${FFLAGS} -fPIC
288 - NVOPTS = -DADD_ --compiler-options '-fPIC ${CFLAGS}' -DUNIX
289 + NVOPTS = -DADD_ -DUNIX ${NVCCFLAGS}
290 + LDOPTS = ${LDFLAGS}
291 LOADER = $(tc-getFC)
292 LIBBLAS = $($(tc-getPKG_CONFIG) --libs cblas)
293 LIBLAPACK = $($(tc-getPKG_CONFIG) --libs lapack)
294 @@ -100,15 +101,18 @@ src_configure() {
295 src_compile() {
296 emake lib
297 emake shared
298 + mv lib/lib${PN}.so{,.1.4} || die
299 + ln -sf lib${PN}.so.1.4 lib/lib${PN}.so.1 || die
300 + ln -sf lib${PN}.so.1.4 lib/lib${PN}.so || die
301 }
302
303 src_test() {
304 emake test lapacktest
305 - cd testing/lin
306 + cd testing/lin || die
307 # we need to access this while running the tests
308 addwrite /dev/nvidiactl
309 addwrite /dev/nvidia0
310 - LD_LIBRARY_PATH=${S}/lib python lapack_testing.py || die
311 + LD_LIBRARY_PATH="${S}"/lib ${EPYTHON} lapack_testing.py || die
312 }
313
314 src_install() {