Gentoo Archives: gentoo-commits

From: "Honza Macháček" <Hloupy.Honza@×××××××.cz>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-physics/abinit/
Date: Fri, 27 Jun 2014 13:54:20
Message-Id: 1403877229.4f1c3ab6bcdefdade71186214b625663eada8a77.honza_machacek@gentoo
1 commit: 4f1c3ab6bcdefdade71186214b625663eada8a77
2 Author: Honza Macháček <Hloupy.Honza <AT> centrum <DOT> cz>
3 AuthorDate: Fri Jun 27 13:53:49 2014 +0000
4 Commit: Honza Macháček <Hloupy.Honza <AT> centrum <DOT> cz>
5 CommitDate: Fri Jun 27 13:53:49 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=4f1c3ab6
7
8 Version bumped to 7.6.4. ScaLAPACK support, and use of the MPI implementation of sci-libs/fftw added. Minor attempts on enhancements and cleanup.
9
10 Package-Manager: portage-2.2.10
11
12 ---
13 sci-physics/abinit/ChangeLog | 9 +-
14 sci-physics/abinit/abinit-7.6.4.ebuild | 388 +++++++++++++++++++++++++++++++++
15 sci-physics/abinit/metadata.xml | 23 +-
16 3 files changed, 415 insertions(+), 5 deletions(-)
17
18 diff --git a/sci-physics/abinit/ChangeLog b/sci-physics/abinit/ChangeLog
19 index 6baa378..11dd22a 100644
20 --- a/sci-physics/abinit/ChangeLog
21 +++ b/sci-physics/abinit/ChangeLog
22 @@ -1,7 +1,14 @@
23 # ChangeLog for sci-physics/abinit
24 -# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
25 +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
26 # $Header: $
27
28 +*abinit-7.6.4 (27 Jun 2014)
29 +
30 + 27 Jun 2014; Honza Macháček <Hloupy.Honza@×××××××.cz> +abinit-7.6.4.ebuild,
31 + metadata.xml:
32 + Version bumped to 7.6.4. ScaLAPACK support, and use of the MPI implementation
33 + of sci-libs/fftw added. Minor attempts on enhancements and cleanup.
34 +
35 10 Oct 2013; Honza Macháček <Hloupy.Honza@×××××××.cz> abinit-7.4.2.ebuild,
36 +files/7.4.2-cuda_link_stdc++.patch:
37 Added a patch to link libstdc++ with the C++ CUDA objects.
38
39 diff --git a/sci-physics/abinit/abinit-7.6.4.ebuild b/sci-physics/abinit/abinit-7.6.4.ebuild
40 new file mode 100644
41 index 0000000..6947f11
42 --- /dev/null
43 +++ b/sci-physics/abinit/abinit-7.6.4.ebuild
44 @@ -0,0 +1,388 @@
45 +# Copyright 1999-2014 Gentoo Foundation
46 +# Distributed under the terms of the GNU General Public License v2
47 +# $Header: $
48 +
49 +EAPI=5
50 +
51 +PYTHON_COMPAT=( python{2_5,2_6,2_7} )
52 +
53 +inherit autotools-utils eutils flag-o-matic fortran-2 multilib python-single-r1 toolchain-funcs
54 +
55 +DESCRIPTION="Find total energy, charge density and electronic structure using density functional theory"
56 +HOMEPAGE="http://www.abinit.org/"
57 +SRC_URI="http://ftp.abinit.org/${P}.tar.gz"
58 +
59 +LICENSE="GPL-2"
60 +SLOT="0"
61 +KEYWORDS="~amd64 ~x86"
62 +IUSE="atompaw bigdft cuda cuda-double -debug +etsf_io +fftw fftw-mpi +fftw-threads +fox gsl +hdf5 levmar -libabinit libxc -lotf mpi +netcdf openmp python scalapack scripts -test +threads wannier"
63 +
64 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
65 +#" scalapack? ( !bigdft )"
66 +
67 +RDEPEND="virtual/blas
68 + virtual/lapack
69 + ${PYTHON_DEPS}
70 + dev-python/numpy
71 + atompaw? ( >=sci-physics/atompaw-3.0.1.9-r1[libxc?] )
72 + bigdft? ( ~sci-libs/bigdft-abi-1.0.4[scalapack?] )
73 + cuda? ( dev-util/nvidia-cuda-sdk )
74 + etsf_io? ( >=sci-libs/etsf_io-1.0.3-r2 )
75 + fftw? (
76 + sci-libs/fftw:3.0
77 + fftw-threads? (
78 + openmp? ( sci-libs/fftw:3.0[openmp] )
79 + !openmp? ( sci-libs/fftw:3.0[threads] )
80 + )
81 + fftw-mpi? (
82 + sci-libs/fftw:3.0[mpi]
83 + openmp? ( sci-libs/fftw:3.0[openmp] )
84 + !openmp? ( sci-libs/fftw:3.0[threads] )
85 + )
86 + )
87 + fox? ( >=sci-libs/fox-4.1.2-r2[sax] )
88 + gsl? ( sci-libs/gsl )
89 + hdf5? ( sci-libs/hdf5[fortran] )
90 + levmar? ( sci-libs/levmar )
91 + libxc? ( =sci-libs/libxc-2.0*[fortran] )
92 + netcdf? (
93 + sci-libs/netcdf[hdf5?]
94 + || (
95 + sci-libs/netcdf[fortran]
96 + sci-libs/netcdf-fortran
97 + )
98 + )
99 + mpi? ( virtual/mpi )
100 + scalapack? ( virtual/scalapack )
101 + scripts? ( dev-python/PyQt4 )
102 + wannier? ( >=sci-libs/wannier90-1.2-r1 )"
103 +DEPEND="${RDEPEND}
104 + virtual/pkgconfig
105 + dev-perl/Text-Markdown"
106 +
107 +S=${WORKDIR}/${P%[a-z]}
108 +
109 +DOCS=( AUTHORS ChangeLog COPYING INSTALL KNOWN_PROBLEMS NEWS PACKAGING
110 + README README.ChangeLog README.GPU README.xlf RELNOTES THANKS )
111 +
112 +FORTRAN_STANDARD=90
113 +
114 +pkg_setup() {
115 + # Doesn't compile with gcc-4.0, only >=4.1
116 + if [[ $(tc-getFC) == *gfortran ]]; then
117 + if [[ $(gcc-major-version) -eq 4 ]] \
118 + && [[ $(gcc-minor-version) -lt 1 ]]; then
119 + die "Requires gcc-4.1 or newer"
120 + fi
121 + fi
122 +
123 + # fortran-2.eclass does not handle mpi wrappers
124 + if use mpi; then
125 + export FC="mpif90"
126 + export F77="mpif77"
127 + export CC="mpicc"
128 + export CXX="mpic++"
129 + else
130 + tc-export FC F77 CC CXX
131 + fi
132 +
133 + # Preprocesor macross can make some lines really long
134 + append-fflags -ffree-line-length-none
135 +
136 + # This should be correct:
137 + # It is gcc-centric because toolchain-funcs.eclass is gcc-centric.
138 + # Should a bug be filed against toolchain-funcs.eclass?
139 + # if use openmp; then
140 + # tc-has-openmp || \
141 + # die "Please select an openmp capable compiler like gcc[openmp]"
142 + # fi
143 + #
144 + # This is completely wrong:
145 + # If other compilers than Gnu Compiler Collection can be used by portage,
146 + # their support of OpenMP should be properly tested. This code limits the test
147 + # to gcc, and blindly supposes that other compilers do support OpenMP.
148 + # if use openmp && [[ $(tc-getCC)$ == *gcc* ]] && ! tc-has-openmp; then
149 + # die "Please select an openmp capable compiler like gcc[openmp]"
150 + # fi
151 + #
152 + # Luckily Abinit is a fortran package.
153 + # fortran-2.eclass has its own test for OpenMP support,
154 + # more general than toolchain-funcs.eclass
155 + # The test itself proceeds inside fortran-2_pkg_setup
156 + if use openmp; then FORTRAN_NEED_OPENMP=1; fi
157 +
158 + fortran-2_pkg_setup
159 +
160 + if use openmp; then
161 + # based on _fortran-has-openmp() of fortran-2.eclass
162 + local code=ebuild-openmp-flags
163 + local ret
164 + local openmp
165 +
166 + pushd "${T}"
167 + cat <<- EOF > "${code}.c"
168 + # include <omp.h>
169 + main () {
170 + int nthreads;
171 + nthreads=omp_get_num_threads();
172 + }
173 + EOF
174 +
175 + for openmp in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
176 + ${CC} ${openmp} "${code}.c" -o "${code}.o" &>> "${T}"/_c_compile_test.log
177 + ret=$?
178 + (( ${ret} )) || break
179 + done
180 +
181 + rm -f "${code}.*"
182 + popd
183 +
184 + if (( ${ret} )); then
185 + die "Please switch to an openmp compatible C compiler"
186 + else
187 + export CC="${CC} ${openmp}"
188 + export CXX="${CXX} ${openmp}"
189 + fi
190 +
191 + pushd "${T}"
192 + cat <<- EOF > "${code}.f"
193 + 1 call omp_get_num_threads
194 + 2 end
195 + EOF
196 +
197 + for openmp in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
198 + ${FC} ${openmp} "${code}.f" -o "${code}.o" &>> "${T}"/_f_compile_test.log
199 + ret=$?
200 + (( ${ret} )) || break
201 + done
202 +
203 + rm -f "${code}.*"
204 + popd
205 +
206 + if (( ${ret} )); then
207 + die "Please switch to an openmp compatible fortran compiler."
208 + else
209 + export FC="${FC} ${openmp}"
210 + export F77="${F77} ${openmp}"
211 + fi
212 + fi
213 +
214 + # Sort out some USE options
215 + if use fftw-threads && ! use fftw; then
216 + ewarn "fftw-threads set but fftw not used, ignored."
217 + fi
218 + if use fftw-mpi; then
219 + if ! use fftw; then
220 + ewarn "fftw-mpi set but fftw not used, ignored."
221 + elif ! use mpi; then
222 + ewarn "fftw-mpi set but mpi not used, ignored."
223 + elif ! use fftw-threads; then
224 + ewarn "fftw-mpi set but fftw-threads not. Will use a threaded fftw nevertheless, required with MPI."
225 + fi
226 + fi
227 + if use cuda-double && ! use cuda; then
228 + ewarn "cuda-double set but cuda not used, ignored"
229 + fi
230 +
231 + python-single-r1_pkg_setup
232 +
233 +}
234 +
235 +src_prepare() {
236 + epatch \
237 + "${FILESDIR}"/6.2.2-change-default-directories.patch \
238 + "${FILESDIR}"/6.12.1-autoconf.patch \
239 + "${FILESDIR}"/6.12.1-xmalloc.patch \
240 + "${FILESDIR}"/7.6.3-libabinit_options.patch \
241 + "${FILESDIR}"/7.4.2-levmar_diag_scaling.patch \
242 + "${FILESDIR}"/7.4.2-syntax.patch \
243 + "${FILESDIR}"/7.4.2-cuda_link_stdc++.patch
244 + eautoreconf
245 + sed -e"s/\(grep '\^-\)\(\[LloW\]\)'/\1\\\(\2\\\|pthread\\\)'/g" -i configure
246 + python_fix_shebang "${S}"
247 +}
248 +
249 +src_configure() {
250 + local modules="$(FoX-config --sax --fcflags)"
251 + local FoX_libs="$(FoX-config --sax --libs)"
252 +
253 + local trio_flavor=""
254 + use etsf_io && trio_flavor="${trio_flavor}+etsf_io"
255 + use fox && trio_flavor="${trio_flavor}+fox"
256 + use netcdf && trio_flavor="${trio_flavor}+netcdf"
257 + test "no${trio_flavor}" = "no" && trio_flavor="none"
258 +
259 + local netcdff_libs="-lnetcdff"
260 + use hdf5 && netcdff_libs="${netcdff_libs} -lhdf5_fortran"
261 +
262 +# local linalg_flavor="atlas"
263 + local linalg_flavor="custom"
264 + local mylapack="lapack"
265 + use scalapack && mylapack="scalapack" && linalg_flavor="${linalg_flavor}+scalapack"
266 +
267 + local dft_flavor=""
268 + use atompaw && dft_flavor="${dft_flavor}+atompaw"
269 + use bigdft && dft_flavor="${dft_flavor}+bigdft"
270 + use libxc && dft_flavor="${dft_flavor}+libxc"
271 + use wannier && dft_flavor="${dft_flavor}+wannier90"
272 + test "no${dft_flavor}" = "no" && dft_flavor="none"
273 +
274 + local fft_flavor="fftw3"
275 + local fft_libs=""
276 + # The fftw threads support is protected by black magick.
277 + # Anybody removes it, dies.
278 + # New USE flag "fftw-threads" was added to control usage
279 + # of the threaded fftw variant. Since fftw-3.3 has expanded
280 + # the paralel options by MPI and OpenMP support, analogical
281 + # USE flags should be added to select them in future;
282 + # unusable with previous FFTW versions, they are postponed
283 + # for now.
284 + if use mpi && use fftw-mpi; then
285 + fft_flavor="fftw3-mpi"
286 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3_mpi)"
287 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f_mpi)"
288 + if use openmp; then
289 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3_omp)"
290 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f_omp)"
291 + else
292 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3_threads)"
293 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f_threads)"
294 + fi
295 + elif use fftw-threads; then
296 + fft_flavor="fftw3-threads"
297 + if use openmp; then
298 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3_omp)"
299 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f_omp)"
300 + else
301 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3_threads)"
302 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f_threads)"
303 + fi
304 + else
305 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3)"
306 + fft_libs+="$($(tc-getPKG_CONFIG) --libs fftw3f)"
307 + fi
308 +
309 + local gpu_flavor="none"
310 + if use cuda; then
311 + gpu_flavor="cuda-single"
312 + if use cuda-double; then
313 + gpu_flavor="cuda-double"
314 + fi
315 + fi
316 +
317 + local myeconfargs=(
318 + --enable-clib
319 + --enable-exports
320 + --enable-pkg-check
321 + $(use_enable debug debug enhanced)
322 + $(use_enable mpi)
323 + $(use_enable mpi mpi-io)
324 + $(use_enable openmp)
325 + $(use_enable lotf)
326 + $(use_enable cuda gpu)
327 + "$(use cuda && echo "--with-gpu-flavor=${gpu_flavor}")"
328 + "$(use cuda && echo "--with-gpu-prefix=/opt/cuda/")"
329 + "$(use gsl && echo "--with-math-flavor=gsl")"
330 + "$(use gsl && echo "--with-math-incs=$($(tc-getPKG_CONFIG) --cflags gsl)")"
331 + "$(use gsl && echo "--with-math-libs=$($(tc-getPKG_CONFIG) --libs gsl)")"
332 + "$(use levmar && echo "--with-algo-flavor=levmar")"
333 + "$(use levmar && echo "--with-algo-libs=-llevmar")"
334 + --with-linalg-flavor="${linalg_flavor}"
335 + --with-linalg-libs="$($(tc-getPKG_CONFIG) --libs "${mylapack}")"
336 + --with-trio-flavor="${trio_flavor}"
337 + "$(use netcdf && echo "--with-netcdf-incs=-I/usr/include")"
338 + "$(use netcdf && echo "--with-netcdf-libs=$($(tc-getPKG_CONFIG) --libs netcdf) ${netcdff_libs}")"
339 + "$(use fox && echo "--with-fox-incs=${modules}")"
340 + "$(use fox && echo "--with-fox-libs=${FoX_libs}")"
341 + "$(use etsf_io && echo "--with-etsf-io-incs=${modules}")"
342 + "$(use etsf_io && echo "--with-etsf-io-libs=-letsf_io -letsf_io_utils -letsf_io_low_level")"
343 + --with-dft-flavor="${dft_flavor}"
344 + "$(use atompaw && echo "--with-atompaw-incs=${modules}")"
345 + "$(use atompaw && echo "--with-atompaw-libs=-latompaw")"
346 + "$(use bigdft && echo "--with-bigdft-incs=${modules}")"
347 + "$(use bigdft && echo "--with-bigdft-libs=$($(tc-getPKG_CONFIG) --libs bigdft)")"
348 + "$(use libxc && echo "--with-libxc-incs=${modules}")"
349 + "$(use libxc && echo "--with-libxc-libs=$($(tc-getPKG_CONFIG) --libs libxc)")"
350 + "$(use wannier && echo "--with-wannier90-bins=/usr/bin")"
351 + "$(use wannier && echo "--with-wannier90-incs=${modules}")"
352 + "$(use wannier && echo "--with-wannier90-libs=-lwannier $($(tc-getPKG_CONFIG) --libs blas lapack)")"
353 + "$(use fftw && echo "--with-fft-flavor=${fft_flavor}")"
354 + "$(use fftw && echo "--with-fft-incs=-I/usr/include")"
355 + "$(use fftw && echo "--with-fft-libs=${fft_libs}")"
356 + --with-timer-flavor="abinit"
357 + LD="$(tc-getLD)"
358 + FCFLAGS="${FCFLAGS:- ${FFLAGS:- -O2}} ${modules} -I/usr/include"
359 + )
360 +
361 + MARKDOWN=Markdown.pl autotools-utils_src_configure
362 +}
363 +
364 +src_compile() {
365 + autotools-utils_src_compile
366 +
367 + # Apparently libabinit.a is not built by default
368 + # Used by BigDFT. Should probably be built separately,
369 + # as a package of its own: BigDFT used by Abinit.
370 + # Does libabinit.a depend on BigDFT, if used?
371 + # Can Abinit use external libabinit.a?
372 + use libabinit && autotools-utils_src_compile libabinit.a
373 +
374 + sed -i -e's/libatlas/lapack/' "${AUTOTOOLS_BUILD_DIR}"/config.pc
375 +}
376 +
377 +src_test() {
378 + einfo "The complete tests take quite a while, easily several hours or even days."
379 + # autotools-utils_src_test expanded and modified
380 + _check_build_dir
381 + pushd "${BUILD_DIR}" > /dev/null || die
382 +
383 + einfo "Running the internal tests."
384 + emake tests_in || die 'The internal tests failed.'
385 +
386 + einfo "Running the thorough tests. Be patient, please."
387 + "${S}"/tests/runtests.py || ewarn "The package has not passed the thorough tests."
388 +
389 + popd > /dev/null || die
390 +}
391 +
392 +src_install() {
393 + #autotools-utils_src_install() expanded
394 + _check_build_dir
395 + pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
396 + emake DESTDIR="${D}" install || die "make install failed"
397 +
398 + use libabinit && dolib libabinit.a
399 +
400 + if use test; then
401 + for dc in results.tar.gz results.txt suite_report.html; do
402 + test -e Test_suite/"${dc}" && dodoc Test_suite/"${dc}" || ewarn "Copying tests results ${dc} failed"
403 + done
404 + fi
405 +
406 + popd > /dev/null
407 +
408 + # XXX: support installing them from builddir as well!!!
409 + if [[ ${DOCS} ]]; then
410 + dodoc "${DOCS[@]}" || die "dodoc failed"
411 + else
412 + local f
413 + # same list as in PMS
414 + for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \
415 + THANKS BUGS FAQ CREDITS CHANGELOG; do
416 + if [[ -s ${f} ]]; then
417 + dodoc "${f}" || die "(default) dodoc ${f} failed"
418 + fi
419 + done
420 + fi
421 + if [[ ${HTML_DOCS} ]]; then
422 + dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
423 + fi
424 +
425 + if use scripts; then
426 + insinto /usr/share/"${P}"
427 + doins -r scripts
428 + fi
429 +
430 + # Remove libtool files and unnecessary static libs
431 + prune_libtool_files
432 +}
433
434 diff --git a/sci-physics/abinit/metadata.xml b/sci-physics/abinit/metadata.xml
435 index 192c6f3..eb0c4e6 100644
436 --- a/sci-physics/abinit/metadata.xml
437 +++ b/sci-physics/abinit/metadata.xml
438 @@ -36,7 +36,12 @@ ABINIT code, different utility programs are provided.
439 </use>
440 <use>
441 <flag name="fftw-threads">
442 - Use the threaded version of <pkg>sci-libs/fftw</pkg>
443 + Use the threaded (openMP or pthreads) version of <pkg>sci-libs/fftw</pkg>
444 + </flag>
445 + </use>
446 + <use>
447 + <flag name="fftw-mpi">
448 + Use the MPI version of <pkg>sci-libs/fftw</pkg> (always with either openMP or pthreads too)
449 </flag>
450 </use>
451 <use>
452 @@ -45,7 +50,7 @@ ABINIT code, different utility programs are provided.
453 <use>
454 <flag name="gui">
455 Build the abinit GUI (requires java);
456 - since 7.4.x a separate package
457 + since 7.4.0 a separate package
458 </flag>
459 </use>
460 <use>
461 @@ -67,12 +72,22 @@ ABINIT code, different utility programs are provided.
462 <flag name="lotf">Activate the Learn on The Fly method (LOTF) for Molecular Dynamics</flag>
463 </use>
464 <use>
465 + <flag name="scalapack">
466 + Use ScaLAPACK, a subset of LAPACK routines redesigned for heterogenous computing
467 + </flag>
468 + </use>
469 + <use>
470 <flag name="scripts">Install helper scripts, mostly Python</flag>
471 </use>
472 <use>
473 - <flag name="vdwxc">Activate van der Waals exchange-correlation correction</flag>
474 + <flag name="vdwxc">
475 + Activate van der Waals exchange-correlation correction. Since 7.4.0
476 + no longer optional
477 + </flag>
478 </use>
479 <use>
480 - <flag name="wannier">Enable support for wannier90, a maximally localized Wannier functions (MLWFs) calculator</flag>
481 + <flag name="wannier">
482 + Enable support for wannier90, a maximally localized Wannier functions (MLWFs) calculator
483 + </flag>
484 </use>
485 </pkgmetadata>