gnu packages: Avoid description lines with leading "(".
[jackhill/guix/guix.git] / gnu / packages / maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages maths)
28 #:use-module (ice-9 regex)
29 #:use-module (gnu packages)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix svn-download)
34 #:use-module (guix utils)
35 #:use-module (guix build utils)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages cmake)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages curl)
45 #:use-module (gnu packages elf)
46 #:use-module (gnu packages flex)
47 #:use-module (gnu packages fltk)
48 #:use-module (gnu packages fontutils)
49 #:use-module (gnu packages gettext)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages gd)
52 #:use-module (gnu packages ghostscript)
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages less)
56 #:use-module (gnu packages lisp)
57 #:use-module (gnu packages gnome)
58 #:use-module (gnu packages xorg)
59 #:use-module (gnu packages gl)
60 #:use-module (gnu packages m4)
61 #:use-module (gnu packages mpi)
62 #:use-module (gnu packages multiprecision)
63 #:use-module (gnu packages pcre)
64 #:use-module (gnu packages popt)
65 #:use-module (gnu packages perl)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages readline)
69 #:use-module (gnu packages tbb)
70 #:use-module (gnu packages tcsh)
71 #:use-module (gnu packages tcl)
72 #:use-module (gnu packages texinfo)
73 #:use-module (gnu packages texlive)
74 #:use-module (gnu packages wxwidgets)
75 #:use-module (gnu packages xml)
76 #:use-module (gnu packages zip)
77 #:use-module (srfi srfi-1))
78
79 (define-public units
80 (package
81 (name "units")
82 (version "2.11")
83 (source (origin
84 (method url-fetch)
85 (uri (string-append "mirror://gnu/units/units-" version
86 ".tar.gz"))
87 (sha256 (base32
88 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
89 (build-system gnu-build-system)
90 (synopsis "Conversion between thousands of scales")
91 (description
92 "GNU Units converts numeric quantities between units of measure. It
93 can handle scale changes through adaptive usage of standard scale
94 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
95 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
96 enough to be used effectively as a scientific calculator.")
97 (license license:gpl3+)
98 (home-page "http://www.gnu.org/software/units/")))
99
100 (define-public double-conversion
101 (package
102 (name "double-conversion")
103 (version "1.1.5")
104 (source (origin
105 (method url-fetch)
106 (uri (string-append
107 "https://github.com/floitsch/double-conversion/archive/v"
108 version ".tar.gz"))
109 (file-name (string-append name "-" version ".tar.gz"))
110 (sha256
111 (base32
112 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
113 (build-system cmake-build-system)
114 (arguments
115 '(#:test-target "test"
116 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
117 "-DBUILD_TESTING=ON")))
118 (home-page "https://github.com/floitsch/double-conversion")
119 (synopsis "Conversion routines for IEEE doubles")
120 (description
121 "The double-conversion library provides binary-decimal and decimal-binary
122 routines for IEEE doubles. The library consists of efficient conversion
123 routines that have been extracted from the V8 JavaScript engine.")
124 (license license:bsd-3)))
125
126 (define-public dionysus
127 (package
128 (name "dionysus")
129 (version "1.3.0")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
133 ".tar.gz"))
134 (sha256
135 (base32
136 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
137 (build-system gnu-build-system)
138 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
139 (synopsis "Local search for universal constants and scientific values")
140 (description
141 "GNU Dionysus is a convenient system for quickly retrieving the values of
142 mathematical constants used in science and engineering. Values can be
143 searched using a simple command-line tool, choosing from three databases:
144 universal constants, atomic numbers, and constants related to
145 semiconductors.")
146 (license license:gpl3+)
147 (home-page "http://www.gnu.org/software/dionysus/")))
148
149 (define-public gsl
150 (package
151 (name "gsl")
152 (version "1.16")
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append "mirror://gnu/gsl/gsl-"
157 version ".tar.gz"))
158 (sha256
159 (base32
160 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))
161 (patches (map search-patch '("gsl-poly-test-fix-pt1.patch"
162 "gsl-poly-test-fix-pt2.patch")))))
163 (build-system gnu-build-system)
164 (arguments
165 `(#:parallel-tests? #f
166 #:phases
167 (alist-replace
168 'configure
169 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
170 (let ((configure (assoc-ref %standard-phases 'configure)))
171 ;; disable numerically unstable test on i686, see thread at
172 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
173 (if (string=? (or target system) "i686-linux")
174 (substitute* "ode-initval2/Makefile.in"
175 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
176 (apply configure args)))
177 %standard-phases)))
178 (home-page "http://www.gnu.org/software/gsl/")
179 (synopsis "Numerical library for C and C++")
180 (description
181 "The GNU Scientific Library is a library for numerical analysis in C
182 and C++. It includes a wide range of mathematical routines, with over 1000
183 functions in total. Subject areas covered by the library include:
184 differential equations, linear algebra, Fast Fourier Transforms and random
185 numbers.")
186 (license license:gpl3+)))
187
188 (define-public glpk
189 (package
190 (name "glpk")
191 (version "4.55")
192 (source
193 (origin
194 (method url-fetch)
195 (uri (string-append "mirror://gnu/glpk/glpk-"
196 version ".tar.gz"))
197 (sha256
198 (base32
199 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
200 (build-system gnu-build-system)
201 (inputs
202 `(("gmp" ,gmp)))
203 (arguments
204 `(#:configure-flags '("--with-gmp")))
205 (home-page "http://www.gnu.org/software/glpk/")
206 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
207 (description
208 "GLPK is a C library for solving large-scale linear programming (LP),
209 mixed integer programming (MIP), and other related problems. It supports the
210 GNU MathProg modeling language, a subset of the AMPL language, and features a
211 translator for the language. In addition to the C library, a stand-alone
212 LP/MIP solver is included in the package.")
213 (license license:gpl3+)))
214
215 (define-public pspp
216 (package
217 (name "pspp")
218 (version "0.8.4")
219 (source
220 (origin
221 (method url-fetch)
222 (uri (string-append "mirror://gnu/pspp/pspp-"
223 version ".tar.gz"))
224 (sha256
225 (base32
226 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
227 (build-system gnu-build-system)
228 (inputs
229 `(("cairo" ,cairo)
230 ("fontconfig" ,fontconfig)
231 ("gettext" ,gnu-gettext)
232 ("gsl" ,gsl)
233 ("libxml2" ,libxml2)
234 ("pango" ,pango)
235 ("readline" ,readline)
236 ("gtk" ,gtk+-2)
237 ("gtksourceview" ,gtksourceview)
238 ("zlib" ,zlib)))
239 (native-inputs
240 `(("glib" ,glib "bin") ;for glib-genmarshal
241 ("perl" ,perl)
242 ("pkg-config" ,pkg-config)))
243 (home-page "http://www.gnu.org/software/pspp/")
244 (synopsis "Statistical analysis")
245 (description
246 "GNU PSPP is a statistical analysis program. It can perform
247 descriptive statistics, T-tests, linear regression and non-parametric tests.
248 It features both a graphical interface as well as command-line input. PSPP
249 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
250 can be imported from spreadsheets, text files and database sources and it can
251 be output in text, PostScript, PDF or HTML.")
252 (license license:gpl3+)))
253
254 (define-public arpack-ng
255 (package
256 (name "arpack-ng")
257 (version "3.2.0")
258 (source
259 (origin
260 (method url-fetch)
261 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
262 version ".tar.gz"))
263 (file-name (string-append name "-" version ".tar.gz"))
264 (sha256
265 (base32
266 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
267 (build-system gnu-build-system)
268 (home-page "https://github.com/opencollab/arpack-ng")
269 (inputs
270 `(("lapack" ,lapack)
271 ("fortran" ,gfortran)))
272 (synopsis "Fortran subroutines for solving eigenvalue problems")
273 (description
274 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
275 large scale eigenvalue problems.")
276 (license (license:non-copyleft "file://COPYING"
277 "See COPYING in the distribution."))))
278
279 (define-public arpack-ng-openmpi
280 (package (inherit arpack-ng)
281 (name "arpack-ng-openmpi")
282 (inputs
283 `(("mpi" ,openmpi)
284 ,@(package-inputs arpack-ng)))
285 (arguments `(#:configure-flags '("--enable-mpi")))
286 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
287
288 (define-public lapack
289 (package
290 (name "lapack")
291 (version "3.5.0")
292 (source
293 (origin
294 (method url-fetch)
295 (uri (string-append "http://www.netlib.org/lapack/lapack-"
296 version ".tgz"))
297 (sha256
298 (base32
299 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
300 (build-system cmake-build-system)
301 (home-page "http://www.netlib.org/lapack/")
302 (inputs `(("fortran" ,gfortran)
303 ("python" ,python-2)))
304 (arguments
305 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
306 #:phases (alist-cons-before
307 'check 'patch-python
308 (lambda* (#:key inputs #:allow-other-keys)
309 (let ((python (assoc-ref inputs "python")))
310 (substitute* "lapack_testing.py"
311 (("/usr/bin/env python") python))))
312 %standard-phases)))
313 (synopsis "Library for numerical linear algebra")
314 (description
315 "LAPACK is a Fortran 90 library for solving the most commonly occurring
316 problems in numerical linear algebra.")
317 (license (license:non-copyleft "file://LICENSE"
318 "See LICENSE in the distribution."))))
319
320 (define-public scalapack
321 (package
322 (name "scalapack")
323 (version "2.0.2")
324 (source
325 (origin
326 (method url-fetch)
327 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
328 version ".tgz"))
329 (sha256
330 (base32
331 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
332 (build-system cmake-build-system)
333 (inputs
334 `(("mpi" ,openmpi)
335 ("fortran" ,gfortran)
336 ("lapack" ,lapack))) ;for testing only
337 (arguments
338 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
339 (home-page "http://www.netlib.org/scalapack/")
340 (synopsis "Library for scalable numerical linear algebra")
341 (description
342 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
343 routines on parallel distributed memory machines. ScaLAPACK solves dense and
344 banded linear systems, least squares problems, eigenvalue problems, and
345 singular value problems.")
346 (license (license:bsd-style "file://LICENSE"
347 "See LICENSE in the distribution."))))
348
349 (define-public gnuplot
350 (package
351 (name "gnuplot")
352 (version "4.6.3")
353 (source
354 (origin
355 (method url-fetch)
356 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
357 version "/gnuplot-" version ".tar.gz"))
358 (sha256
359 (base32
360 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
361 (build-system gnu-build-system)
362 (inputs `(("readline" ,readline)
363 ("cairo" ,cairo)
364 ("pango" ,pango)
365 ("gd" ,gd)))
366 (native-inputs `(("texlive" ,texlive)
367 ("pkg-config" ,pkg-config)))
368 (home-page "http://www.gnuplot.info")
369 (synopsis "Command-line driven graphing utility")
370 (description "Gnuplot is a portable command-line driven graphing
371 utility. It was originally created to allow scientists and students to
372 visualize mathematical functions and data interactively, but has grown to
373 support many non-interactive uses such as web scripting. It is also used as a
374 plotting engine by third-party applications like Octave.")
375 ;; X11 Style with the additional restriction that derived works may only be
376 ;; distributed as patches to the original.
377 (license (license:fsf-free
378 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
379
380 (define-public hdf5
381 (package
382 (name "hdf5")
383 (version "1.8.12")
384 (source
385 (origin
386 (method url-fetch)
387 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
388 version "/src/hdf5-"
389 version ".tar.bz2"))
390 (sha256
391 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
392 (build-system gnu-build-system)
393 (inputs
394 `(("zlib" ,zlib)))
395 (arguments
396 `(#:phases
397 (alist-cons-before
398 'configure 'patch-configure
399 (lambda _
400 (substitute* "configure"
401 (("/bin/mv") "mv")))
402 %standard-phases)))
403 (home-page "http://www.hdfgroup.org")
404 (synopsis "Management suite for extremely large and complex data")
405 (description "HDF5 is a suite that makes possible the management of
406 extremely large and complex data collections.")
407 (license (license:x11-style
408 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
409
410
411 ;; For a fully featured Octave, users are strongly recommended also to install
412 ;; the following packages: texinfo, less, ghostscript, gnuplot.
413 (define-public octave
414 (package
415 (name "octave")
416 (version "3.8.2")
417 (source
418 (origin
419 (method url-fetch)
420 (uri (string-append "mirror://gnu/octave/octave-"
421 version ".tar.gz"))
422 (sha256
423 (base32
424 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
425 (build-system gnu-build-system)
426 (inputs
427 `(("lapack" ,lapack)
428 ("readline" ,readline)
429 ("glpk" ,glpk)
430 ("fftw" ,fftw)
431 ("fftwf" ,fftwf)
432 ("arpack" ,arpack-ng)
433 ("curl" ,curl)
434 ("pcre" ,pcre)
435 ("fltk" ,fltk)
436 ("fontconfig" ,fontconfig)
437 ("freetype" ,freetype)
438 ("hdf5" ,hdf5)
439 ("libxft" ,libxft)
440 ("mesa" ,mesa)
441 ("glu" ,glu)
442 ("zlib" ,zlib)))
443 (native-inputs
444 `(("gfortran" ,gfortran)
445 ("pkg-config" ,pkg-config)
446 ("perl" ,perl)
447 ;; The following inputs are not actually used in the build process.
448 ;; However, the ./configure gratuitously tests for their existence and
449 ;; assumes that programs not present at build time are also not, and
450 ;; can never be, available at run time! If these inputs are therefore
451 ;; not present, support for them will be built out. However, Octave
452 ;; will still run without them, albeit without the features they
453 ;; provide.
454 ("less" ,less)
455 ("texinfo" ,texinfo)
456 ("ghostscript" ,ghostscript)
457 ("gnuplot" ,gnuplot)))
458 (arguments
459 `(#:configure-flags (list (string-append "--with-shell="
460 (assoc-ref %build-inputs "bash")
461 "/bin/sh"))))
462 (home-page "http://www.gnu.org/software/octave/")
463 (synopsis "High-level language for numerical computation")
464 (description "GNU Octave is a high-level interpreted language that is
465 specialized for numerical computations. It can be used for both linear and
466 non-linear applications and it provides great support for visualizing results.
467 Work may be performed both at the interactive command-line as well as via
468 script files.")
469 (license license:gpl3+)))
470
471 (define-public gmsh
472 (package
473 (name "gmsh")
474 (version "2.8.4")
475 (source
476 (origin
477 (method url-fetch)
478 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
479 version "-source.tgz"))
480 (sha256
481 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
482 (modules '((guix build utils)))
483 (snippet
484 ;; Remove non-free METIS code
485 '(delete-file-recursively "contrib/Metis"))))
486 (build-system cmake-build-system)
487 (propagated-inputs
488 `(("fltk" ,fltk)
489 ("gfortran" ,gfortran)
490 ("gmp" ,gmp)
491 ("hdf5" ,hdf5)
492 ("lapack" ,lapack)
493 ("mesa" ,mesa)
494 ("glu" ,glu)
495 ("libx11" ,libx11)
496 ("libxext" ,libxext)))
497 (arguments
498 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
499 "-DENABLE_BUILD_SHARED:BOOL=ON"
500 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
501 (home-page "http://www.geuz.org/gmsh/")
502 (synopsis "3D finite element grid generator")
503 (description "Gmsh is a 3D finite element grid generator with a built-in
504 CAD engine and post-processor. Its design goal is to provide a fast, light
505 and user-friendly meshing tool with parametric input and advanced
506 visualization capabilities. Gmsh is built around four modules: geometry,
507 mesh, solver and post-processing. The specification of any input to these
508 modules is done either interactively using the graphical user interface or in
509 ASCII text files using Gmsh's own scripting language.")
510 (license license:gpl2+)))
511
512 (define-public petsc
513 (package
514 (name "petsc")
515 (version "3.6.0")
516 (source
517 (origin
518 (method url-fetch)
519 ;; The *-lite-* tarball does not contain the *large* documentation
520 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
521 "petsc-lite-" version ".tar.gz"))
522 (sha256
523 (base32 "0lzhk1flgszks1wlhz2b92rnlx5np7bgad8vqy9fcqziz5b4pr26"))))
524 (build-system gnu-build-system)
525 (native-inputs
526 `(("python" ,python-2)
527 ("perl" ,perl)))
528 (inputs
529 `(("gfortran" ,gfortran)
530 ("lapack" ,lapack)
531 ("superlu" ,superlu)
532 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
533 ;; leaving out opengl, as configuration seems to only be for mac
534 ))
535 (arguments
536 `(#:test-target "test"
537 #:parallel-build? #f ;build is parallel by default
538 #:configure-flags
539 `("--with-mpi=0"
540 "--with-openmp=1"
541 "--with-superlu=1"
542 ,(string-append "--with-superlu-include="
543 (assoc-ref %build-inputs "superlu") "/include")
544 ,(string-append "--with-superlu-lib="
545 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
546 #:phases
547 (alist-replace
548 'configure
549 ;; PETSc's configure script is actually a python script, so we can't
550 ;; run it with bash.
551 (lambda* (#:key outputs (configure-flags '())
552 #:allow-other-keys)
553 (let* ((prefix (assoc-ref outputs "out"))
554 (flags `(,(string-append "--prefix=" prefix)
555 ,@configure-flags)))
556 (format #t "build directory: ~s~%" (getcwd))
557 (format #t "configure flags: ~s~%" flags)
558 (zero? (apply system* "./configure" flags))))
559 (alist-cons-after
560 'configure 'clean-local-references
561 ;; Try to keep build directory names from leaking into compiled code
562 (lambda* (#:key inputs outputs #:allow-other-keys)
563 (let ((out (assoc-ref outputs "out")))
564 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
565 (((getcwd)) out))))
566 (alist-cons-after
567 'install 'clean-install
568 ;; Try to keep installed files from leaking build directory names.
569 (lambda* (#:key inputs outputs #:allow-other-keys)
570 (let ((out (assoc-ref outputs "out"))
571 (fortran (assoc-ref inputs "gfortran")))
572 (substitute* (map (lambda (file)
573 (string-append out "/lib/petsc/conf/" file))
574 '("petscvariables" "PETScConfig.cmake"))
575 (((getcwd)) out))
576 ;; Make compiler references point to the store
577 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
578 (("= g(cc|\\+\\+|fortran)" _ suffix)
579 (string-append "= " fortran "/bin/g" suffix)))
580 ;; PETSc installs some build logs, which aren't necessary.
581 (for-each (lambda (file)
582 (let ((f (string-append out "/lib/petsc/conf/" file)))
583 (when (file-exists? f)
584 (delete-file f))))
585 '("configure.log" "make.log" "gmake.log"
586 "test.log" "error.log" "RDict.db"
587 ;; Once installed, should uninstall with Guix
588 "uninstall.py"))))
589 %standard-phases)))))
590 (home-page "http://www.mcs.anl.gov/petsc")
591 (synopsis "Library to solve PDEs")
592 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
593 data structures and routines for the scalable (parallel) solution of
594 scientific applications modeled by partial differential equations.")
595 (license (license:non-copyleft
596 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
597
598 (define-public petsc-complex
599 (package (inherit petsc)
600 (name "petsc-complex")
601 (arguments
602 (substitute-keyword-arguments (package-arguments petsc)
603 ((#:configure-flags cf)
604 `(cons "--with-scalar-type=complex" ,cf))))
605 (synopsis "Library to solve PDEs (with complex scalars)")))
606
607 (define-public petsc-openmpi
608 (package (inherit petsc)
609 (name "petsc-openmpi")
610 (inputs
611 `(("openmpi" ,openmpi)
612 ,@(package-inputs petsc)))
613 (arguments
614 (substitute-keyword-arguments (package-arguments petsc)
615 ((#:configure-flags cf)
616 ``("--with-mpiexec=mpirun"
617 ,(string-append "--with-mpi-dir="
618 (assoc-ref %build-inputs "openmpi"))
619 ,@(delete "--with-mpi=0" ,cf)))))
620 (synopsis "Library to solve PDEs (with MPI support)")))
621
622 (define-public petsc-complex-openmpi
623 (package (inherit petsc-complex)
624 (name "petsc-complex-openmpi")
625 (inputs
626 `(("openmpi" ,openmpi)
627 ,@(package-inputs petsc-complex)))
628 (arguments
629 (substitute-keyword-arguments (package-arguments petsc-complex)
630 ((#:configure-flags cf)
631 ``("--with-mpiexec=mpirun"
632 ,(string-append "--with-mpi-dir="
633 (assoc-ref %build-inputs "openmpi"))
634 ,@(delete "--with-mpi=0" ,cf)))))
635 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
636
637 (define-public slepc
638 (package
639 (name "slepc")
640 (version "3.6.0")
641 (source
642 (origin
643 (method url-fetch)
644 (uri (string-append "http://slepc.upv.es/download/download.php?"
645 "filename=slepc-" version ".tar.gz"))
646 (sha256
647 (base32
648 "1ij8w864spzk4cq2mmkssqyj0mbckkkvxm0wpw9gywy2jgbj07jr"))))
649 (build-system gnu-build-system)
650 (native-inputs
651 `(("python" ,python-2)))
652 (inputs
653 `(("arpack" ,arpack-ng)
654 ("gfortran" ,gfortran)))
655 (propagated-inputs
656 `(("petsc" ,petsc)))
657 (arguments
658 `(#:parallel-build? #f ;build is parallel by default
659 #:configure-flags
660 `(,(string-append "--with-arpack-dir="
661 (assoc-ref %build-inputs "arpack")))
662 #:phases
663 (modify-phases %standard-phases
664 (replace
665 'configure
666 ;; configure is a python script, so we can't run it with bash.
667 (lambda* (#:key inputs outputs (configure-flags '())
668 #:allow-other-keys)
669 (let* ((prefix (assoc-ref outputs "out"))
670 (flags `(,(string-append "--prefix=" prefix)
671 ,@configure-flags)))
672 (format #t "build directory: ~s~%" (getcwd))
673 (format #t "configure flags: ~s~%" flags)
674 (setenv "SLEPC_DIR" (getcwd))
675 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
676 (zero? (apply system* "./configure" flags)))))
677 (add-after
678 'install 'delete-doc
679 ;; TODO: SLEPc installs HTML documentation alongside headers in
680 ;; $out/include. We'd like to move them to share/doc, but delete
681 ;; them for now, as they are incomplete and installing the complete
682 ;; documentation is difficult.
683 (lambda* (#:key outputs #:allow-other-keys)
684 (let* ((out (assoc-ref outputs "out")))
685 (for-each delete-file (find-files out "\\.html$")))))
686 (add-after
687 'install 'clean-install
688 ;; Clean up unnecessary build logs from installation.
689 (lambda* (#:key outputs #:allow-other-keys)
690 (let ((out (assoc-ref outputs "out")))
691 (for-each (lambda (file)
692 (let ((f (string-append out "/lib/slepc/conf/" file)))
693 (when (file-exists? f)
694 (delete-file f))))
695 '("configure.log" "make.log" "gmake.log"
696 "test.log" "error.log" "RDict.db"
697 "uninstall.py"))))))))
698 (home-page "http://slepc.upv.es")
699 (synopsis "Scalable library for eigenproblems")
700 (description "SLEPc is a software library for the solution of large sparse
701 eigenproblems on parallel computers. It can be used for the solution of
702 linear eigenvalue problems formulated in either standard or generalized form,
703 as well as other related problems such as the singular value decomposition.
704 The emphasis of the software is on methods and techniques appropriate for
705 problems in which the associated matrices are sparse, for example, those
706 arising after the discretization of partial differential equations.")
707 (license license:lgpl3)))
708
709 (define-public slepc-complex
710 (package (inherit slepc)
711 (name "slepc-complex")
712 (propagated-inputs
713 `(("petsc" ,petsc-complex)
714 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
715 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
716
717 (define-public slepc-openmpi
718 (package (inherit slepc)
719 (name "slepc-openmpi")
720 (inputs
721 `(("mpi" ,openmpi)
722 ("arpack" ,arpack-ng-openmpi)
723 ,@(alist-delete "arpack" (package-inputs slepc))))
724 (propagated-inputs
725 `(("petsc" ,petsc-openmpi)
726 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
727 (synopsis "Scalable library for eigenproblems (with MPI support)")))
728
729 (define-public slepc-complex-openmpi
730 (package (inherit slepc-openmpi)
731 (name "slepc-complex-openmpi")
732 (propagated-inputs
733 `(("petsc" ,petsc-complex-openmpi)
734 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
735 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
736
737 (define-public mumps
738 (package
739 (name "mumps")
740 (version "5.0.0")
741 (source
742 (origin
743 (method url-fetch)
744 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
745 version ".tar.gz"))
746 (sha256
747 (base32
748 "0690yp73sqk8zn2jnrzdr5swnjdyd7j0774s4xamjjwcxarw87hr"))
749 (patches (list (search-patch "mumps-build-parallelism.patch")))))
750 (build-system gnu-build-system)
751 (inputs
752 `(("fortran" ,gfortran)
753 ;; These are required for linking against mumps, but we let the user
754 ;; declare the dependency.
755 ("blas" ,openblas)
756 ("metis" ,metis)
757 ("scotch" ,scotch)))
758 (arguments
759 `(#:modules ((ice-9 match)
760 (ice-9 popen)
761 (srfi srfi-1)
762 ,@%gnu-build-system-modules)
763 #:phases
764 (modify-phases %standard-phases
765 (replace
766 'configure
767 (lambda* (#:key inputs #:allow-other-keys)
768 (call-with-output-file "Makefile.inc"
769 (lambda (port)
770 (format port "
771 PLAT =
772 LIBEXT = .a
773 OUTC = -o
774 OUTF = -o
775 RM = rm -f~:[
776 CC = gcc
777 FC = gfortran
778 FL = gfortran
779 INCSEQ = -I$(topdir)/libseq
780 LIBSEQ = -L$(topdir)/libseq -lmpiseq
781 LIBSEQNEEDED = libseqneeded~;
782 CC = mpicc
783 FC = mpifort
784 FL = mpifort~]
785 AR = ar vr # rules require trailing space, ugh...
786 RANLIB = ranlib
787 LIBBLAS = -L~a -lopenblas~@[
788 SCALAP = -L~a -lscalapack~]
789 LIBOTHERS = -pthread
790 CDEFS = -DAdd_
791 PIC = -fPIC
792 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
793 OPTL = -O2 $(PIC)
794 OPTC = -O2 $(PIC)
795 INCS = $(INCSEQ)
796 LIBS = $(SCALAP) $(LIBSEQ)
797 LPORDDIR = $(topdir)/PORD/lib
798 IPORD = -I$(topdir)/PORD/include
799 LPORD = -L$(LPORDDIR) -lpord
800 ORDERINGSF = -Dpord~@[
801 METISDIR = ~a
802 IMETIS = -I$(METISDIR)/include
803 LMETIS = -L$(METISDIR)/lib -lmetis
804 ORDERINGSF += -Dmetis~]~@[~:{
805 SCOTCHDIR = ~a
806 ISCOTCH = -I$(SCOTCHDIR)/include
807 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
808 ORDERINGSF += ~a~}~]
809 ORDERINGSC = $(ORDERINGSF)
810 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
811 IORDERINGSF = $(ISCOTCH)
812 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
813 (assoc-ref inputs "mpi")
814 (assoc-ref inputs "blas")
815 (assoc-ref inputs "scalapack")
816 (assoc-ref inputs "metis")
817 (match (list (assoc-ref inputs "pt-scotch")
818 (assoc-ref inputs "scotch"))
819 ((#f #f)
820 #f)
821 ((#f scotch)
822 `((,scotch "" "-Dscotch")))
823 ((ptscotch _)
824 `((,ptscotch
825 "-lptesmumps -lptscotch -lptscotcherr "
826 "-Dptscotch")))))))))
827 (replace
828 'build
829 ;; By default only the d-precision library is built. Make with "all"
830 ;; target so that all precision libraries and examples are built.
831 (lambda _
832 (zero? (system* "make" "all"
833 (format #f "-j~a" (parallel-job-count))))))
834 (replace
835 'check
836 ;; Run the simple test drivers, which read test input from stdin:
837 ;; from the "real" input for the single- and double-precision
838 ;; testers, and from the "cmplx" input for complex-precision
839 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
840 ;; package to prefix execution with "mpirun".
841 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
842 (with-directory-excursion "examples"
843 (every
844 (lambda (prec type)
845 (let ((tester (apply open-pipe*
846 `(,OPEN_WRITE
847 ,@exec-prefix
848 ,(string-append "./" prec
849 "simpletest"))))
850 (input (open-input-file
851 (string-append "input_simpletest_" type))))
852 (begin
853 (dump-port input tester)
854 (close-port input)
855 (zero? (close-pipe tester)))))
856 '("s" "d" "c" "z")
857 '("real" "real" "cmplx" "cmplx")))))
858 (replace
859 'install
860 (lambda* (#:key outputs #:allow-other-keys)
861 (let ((out (assoc-ref outputs "out")))
862 (copy-recursively "lib" (string-append out "/lib"))
863 (copy-recursively "include" (string-append out "/include"))
864 (when (file-exists? "libseq/libmpiseq.a")
865 (copy-file "libseq/libmpiseq.a"
866 (string-append out "/lib/libmpiseq.a")))))))))
867 (home-page "http://mumps.enseeiht.fr")
868 (synopsis "Multifrontal sparse direct solver")
869 (description
870 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
871 sparse system of linear equations A x = b using Guassian elimination.")
872 (license license:cecill-c)))
873
874 (define-public mumps-metis
875 (package (inherit mumps)
876 (name "mumps-metis")
877 (inputs
878 (alist-delete "scotch" (package-inputs mumps)))))
879
880 (define-public mumps-openmpi
881 (package (inherit mumps)
882 (name "mumps-openmpi")
883 (inputs
884 `(("mpi" ,openmpi)
885 ("scalapack" ,scalapack)
886 ("pt-scotch" ,pt-scotch)
887 ,@(alist-delete "scotch" (package-inputs mumps))))
888 (arguments
889 (substitute-keyword-arguments (package-arguments mumps)
890 ((#:phases phases)
891 `(modify-phases ,phases
892 (replace
893 'check
894 (lambda _
895 ((assoc-ref ,phases 'check)
896 #:exec-prefix '("mpirun" "-n" "2"))))))))
897 (synopsis "Multifrontal sparse direct solver (with MPI)")))
898
899 (define-public mumps-metis-openmpi
900 (package (inherit mumps-openmpi)
901 (name "mumps-metis-openmpi")
902 (inputs
903 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
904
905 (define-public superlu
906 (package
907 (name "superlu")
908 (version "4.3")
909 (source
910 (origin
911 (method url-fetch)
912 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
913 "superlu_" version ".tar.gz"))
914 (sha256
915 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
916 (build-system gnu-build-system)
917 (native-inputs
918 `(("tcsh" ,tcsh)))
919 (inputs
920 `(("lapack" ,lapack)
921 ("gfortran" ,gfortran)))
922 (arguments
923 `(#:parallel-build? #f
924 #:tests? #f ;tests are run as part of `make all`
925 #:phases
926 (alist-replace
927 'configure
928 (lambda* (#:key inputs outputs #:allow-other-keys)
929 (call-with-output-file "make.inc"
930 (lambda (port)
931 (format port "
932 PLAT =
933 SuperLUroot = ~a
934 SUPERLULIB = ~a/lib/libsuperlu.a
935 TMGLIB = libtmglib.a
936 BLASDEF = -DUSE_VENDOR_BLAS
937 BLASLIB = -L~a/lib -lblas
938 LIBS = $(SUPERLULIB) $(BLASLIB)
939 ARCH = ar
940 ARCHFLAGS = cr
941 RANLIB = ranlib
942 CC = gcc
943 PIC = -fPIC
944 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
945 NOOPTS = -O0 $(PIC)
946 FORTRAN = gfortran
947 FFLAGS = -O2 $(PIC)
948 LOADER = $(CC)
949 CDEFS = -DAdd_"
950 (getcwd)
951 (assoc-ref outputs "out")
952 (assoc-ref inputs "lapack")))))
953 (alist-cons-before
954 'build 'create-install-directories
955 (lambda* (#:key outputs #:allow-other-keys)
956 (for-each
957 (lambda (dir)
958 (mkdir-p (string-append (assoc-ref outputs "out")
959 "/" dir)))
960 '("lib" "include")))
961 (alist-replace
962 'install
963 (lambda* (#:key outputs #:allow-other-keys)
964 ;; Library is placed in lib during the build phase. Copy over
965 ;; headers to include.
966 (let* ((out (assoc-ref outputs "out"))
967 (incdir (string-append out "/include")))
968 (for-each (lambda (file)
969 (let ((base (basename file)))
970 (format #t "installing `~a' to `~a'~%"
971 base incdir)
972 (copy-file file
973 (string-append incdir "/" base))))
974 (find-files "SRC" ".*\\.h$"))))
975 %standard-phases)))))
976 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
977 (synopsis "Supernodal direct solver for sparse linear systems")
978 (description
979 "SuperLU is a general purpose library for the direct solution of large,
980 sparse, nonsymmetric systems of linear equations on high performance machines.
981 The library is written in C and is callable from either C or Fortran. The
982 library routines perform an LU decomposition with partial pivoting and
983 triangular system solves through forward and back substitution. The library
984 also provides threshold-based ILU factorization preconditioners.")
985 (license license:bsd-3)))
986
987 (define-public superlu-dist
988 (package
989 (name "superlu-dist")
990 (version "3.3")
991 (source
992 (origin
993 (method url-fetch)
994 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
995 "superlu_dist_" version ".tar.gz"))
996 (sha256
997 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
998 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
999 (build-system gnu-build-system)
1000 (native-inputs
1001 `(("tcsh" ,tcsh)))
1002 (inputs
1003 `(("gfortran" ,gfortran)))
1004 (propagated-inputs
1005 `(("openmpi" ,openmpi) ;headers include MPI heades
1006 ("lapack" ,lapack) ;required to link with output library
1007 ("pt-scotch" ,pt-scotch))) ;same
1008 (arguments
1009 `(#:parallel-build? #f ;race conditions using ar
1010 #:phases
1011 (alist-replace
1012 'configure
1013 (lambda* (#:key inputs outputs #:allow-other-keys)
1014 (call-with-output-file "make.inc"
1015 (lambda (port)
1016 (format port "
1017 PLAT =
1018 DSuperLUroot = ~a
1019 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1020 BLASDEF = -DUSE_VENDOR_BLAS
1021 BLASLIB = -L~a/lib -lblas
1022 PARMETISLIB = -L~a/lib \
1023 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1024 -lscotch -lscotcherr -lscotcherrexit
1025 METISLIB = -L~:*~a/lib \
1026 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1027 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1028 ARCH = ar
1029 ARCHFLAGS = cr
1030 RANLIB = ranlib
1031 CC = mpicc
1032 PIC = -fPIC
1033 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1034 NOOPTS = -O0 -g $(PIC)
1035 FORTRAN = mpifort
1036 FFLAGS = -O2 -g $(PIC)
1037 LOADER = $(CC)
1038 CDEFS = -DAdd_"
1039 (getcwd)
1040 (assoc-ref outputs "out")
1041 (assoc-ref inputs "lapack")
1042 (assoc-ref inputs "pt-scotch")))))
1043 (alist-cons-after
1044 'unpack 'remove-broken-symlinks
1045 (lambda _
1046 (for-each delete-file
1047 (find-files "MAKE_INC" "\\.#make\\..*")))
1048 (alist-cons-before
1049 'build 'create-install-directories
1050 (lambda* (#:key outputs #:allow-other-keys)
1051 (for-each
1052 (lambda (dir)
1053 (mkdir-p (string-append (assoc-ref outputs "out")
1054 "/" dir)))
1055 '("lib" "include")))
1056 (alist-replace
1057 'check
1058 (lambda _
1059 (with-directory-excursion "EXAMPLE"
1060 (and
1061 (zero? (system* "mpirun" "-n" "2"
1062 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1063 (zero? (system* "mpirun" "-n" "2"
1064 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1065 (alist-replace
1066 'install
1067 (lambda* (#:key outputs #:allow-other-keys)
1068 ;; Library is placed in lib during the build phase. Copy over
1069 ;; headers to include.
1070 (let* ((out (assoc-ref outputs "out"))
1071 (incdir (string-append out "/include")))
1072 (for-each (lambda (file)
1073 (let ((base (basename file)))
1074 (format #t "installing `~a' to `~a'~%"
1075 base incdir)
1076 (copy-file file
1077 (string-append incdir "/" base))))
1078 (find-files "SRC" ".*\\.h$"))))
1079 %standard-phases)))))))
1080 (home-page (package-home-page superlu))
1081 (synopsis "Parallel supernodal direct solver")
1082 (description
1083 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1084 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1085 implemented in ANSI C, and MPI for communications.")
1086 (license license:bsd-3)))
1087
1088 (define-public scotch
1089 (package
1090 (name "scotch")
1091 (version "6.0.4")
1092 (source
1093 (origin
1094 (method url-fetch)
1095 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1096 "scotch_" version ".tar.gz"))
1097 (sha256
1098 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1099 (patches (list (search-patch "scotch-test-threading.patch")
1100 (search-patch "pt-scotch-build-parallelism.patch")))))
1101 (build-system gnu-build-system)
1102 (inputs
1103 `(("zlib" ,zlib)
1104 ("flex" ,flex)
1105 ("bison" ,bison)))
1106 (arguments
1107 `(#:phases
1108 (modify-phases %standard-phases
1109 (add-after
1110 'unpack 'chdir-to-src
1111 (lambda _ (chdir "src")))
1112 (replace
1113 'configure
1114 (lambda _
1115 (call-with-output-file "Makefile.inc"
1116 (lambda (port)
1117 (format port "
1118 EXE =
1119 LIB = .a
1120 OBJ = .o
1121 MAKE = make
1122 AR = ar
1123 ARFLAGS = -ruv
1124 CAT = cat
1125 CCS = gcc
1126 CCP = mpicc
1127 CCD = gcc
1128 CPPFLAGS =~{ -D~a~}
1129 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1130 LDFLAGS = -lz -lm -lrt -lpthread
1131 CP = cp
1132 LEX = flex -Pscotchyy -olex.yy.c
1133 LN = ln
1134 MKDIR = mkdir
1135 MV = mv
1136 RANLIB = ranlib
1137 YACC = bison -pscotchyy -y -b y
1138 "
1139 '("COMMON_FILE_COMPRESS_GZ"
1140 "COMMON_PTHREAD"
1141 "COMMON_RANDOM_FIXED_SEED"
1142 ;; Prevents symbolc clashes with libesmumps
1143 "SCOTCH_RENAME"
1144 ;; XXX: Causes invalid frees in superlu-dist tests
1145 ;; "SCOTCH_PTHREAD"
1146 ;; "SCOTCH_PTHREAD_NUMBER=2"
1147 "restrict=__restrict"))))))
1148 (add-after
1149 'build 'build-esmumps
1150 (lambda _
1151 (zero? (system* "make"
1152 (format #f "-j~a" (parallel-job-count))
1153 "esmumps"))))
1154 (replace
1155 'install
1156 (lambda* (#:key outputs #:allow-other-keys)
1157 (let ((out (assoc-ref outputs "out")))
1158 (mkdir out)
1159 (zero? (system* "make"
1160 (string-append "prefix=" out)
1161 "install"))
1162 ;; esmumps files are not installed with the above
1163 (for-each (lambda (f)
1164 (copy-file f (string-append out "/include/" f)))
1165 (find-files "../include" ".*esmumps.h$"))
1166 (for-each (lambda (f)
1167 (copy-file f (string-append out "/lib/" f)))
1168 (find-files "../lib" "^lib.*esmumps.*"))))))))
1169 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1170 (synopsis "Programs and libraries for graph algorithms")
1171 (description "SCOTCH is a set of programs and libraries which implement
1172 the static mapping and sparse matrix reordering algorithms developed within
1173 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1174 conquer approach, to scientific computing problems such as graph and mesh
1175 partitioning, static mapping, and sparse matrix ordering, in application
1176 domains ranging from structural mechanics to operating systems or
1177 bio-chemistry.")
1178 ;; See LICENSE_en.txt
1179 (license license:cecill-c)))
1180
1181 (define-public pt-scotch
1182 (package (inherit scotch)
1183 (name "pt-scotch")
1184 (propagated-inputs
1185 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1186 (arguments
1187 (substitute-keyword-arguments (package-arguments scotch)
1188 ((#:phases scotch-phases)
1189 `(modify-phases ,scotch-phases
1190 (replace
1191 'build
1192 (lambda _
1193 (and
1194 (zero? (system* "make"
1195 (format #f "-j~a" (parallel-job-count))
1196 "ptscotch" "ptesmumps"))
1197 ;; Install the serial metis compatibility library
1198 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1199 (replace
1200 'check
1201 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1202 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1203
1204 (define-public metis
1205 (package
1206 (name "metis")
1207 (version "5.1.0")
1208 (source
1209 (origin
1210 (method url-fetch)
1211 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1212 "metis-" version ".tar.gz"))
1213 (sha256
1214 (base32
1215 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1216 (build-system cmake-build-system)
1217 (inputs
1218 `(("blas" ,openblas)))
1219 (arguments
1220 `(#:tests? #f ;no tests
1221 #:configure-flags `("-DSHARED=ON"
1222 ,(string-append "-DGKLIB_PATH=" (getcwd)
1223 "/metis-" ,version "/GKlib"))))
1224 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1225 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1226 (description
1227 "METIS is a set of serial programs for partitioning graphs, partitioning
1228 finite element meshes, and producing fill-reducing orderings for sparse
1229 matrices. The algorithms implemented in METIS are based on the multilevel
1230 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1231 schemes.")
1232 (license license:asl2.0))) ;As of version 5.0.3
1233
1234 (define-public p4est
1235 (package
1236 (name "p4est")
1237 (version "1.1")
1238 (source
1239 (origin
1240 (method url-fetch)
1241 (uri (string-append "http://p4est.github.io/release/p4est-"
1242 version ".tar.gz"))
1243 (sha256
1244 (base32
1245 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1246 (build-system gnu-build-system)
1247 (inputs
1248 `(("fortran" ,gfortran)
1249 ("blas" ,openblas)
1250 ("lapack" ,lapack)
1251 ("zlib" ,zlib)))
1252 (arguments
1253 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1254 (assoc-ref %build-inputs "blas")
1255 " -lopenblas")
1256 ,(string-append "LAPACK_LIBS=-L"
1257 (assoc-ref %build-inputs "lapack")
1258 " -llapack"))))
1259 (home-page "http://www.p4est.org")
1260 (synopsis "Adaptive mesh refinement on forests of octrees")
1261 (description
1262 "The p4est software library enables the dynamic management of a
1263 collection of adaptive octrees, conveniently called a forest of octrees.
1264 p4est is designed to work in parallel and scales to hundreds of thousands of
1265 processor cores.")
1266 (license license:gpl2+)))
1267
1268 (define-public p4est-openmpi
1269 (package (inherit p4est)
1270 (name "p4est-openmpi")
1271 (inputs
1272 `(("mpi" ,openmpi)
1273 ,@(package-inputs p4est)))
1274 (arguments
1275 (substitute-keyword-arguments (package-arguments p4est)
1276 ((#:configure-flags cf)
1277 ``("--enable-mpi" ,@,cf))))
1278 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1279
1280 (define-public gsegrafix
1281 (package
1282 (name "gsegrafix")
1283 (version "1.0.6")
1284 (source
1285 (origin
1286 (method url-fetch)
1287 (uri (string-append "mirror://gnu/" name "/" name "-"
1288 version ".tar.gz"))
1289 (sha256
1290 (base32
1291 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1292 (build-system gnu-build-system)
1293 (arguments
1294 `(#:configure-flags '("LDFLAGS=-lm")))
1295 (inputs
1296 `(("libgnomecanvas" ,libgnomecanvas)
1297 ("libbonoboui" ,libbonoboui)
1298 ("libgnomeui" ,libgnomeui)
1299 ("libgnomeprintui" ,libgnomeprintui)
1300 ("popt" ,popt)))
1301 (native-inputs
1302 `(("pkg-config" ,pkg-config)))
1303 (home-page "http://www.gnu.org/software/gsegrafix/")
1304 (synopsis "GNOME application to create scientific and engineering plots")
1305 (description "GSEGrafix is an application which produces high-quality graphical
1306 plots for science and engineering. Plots are specified via simple ASCII
1307 parameter files and data files and are presented in an anti-aliased GNOME
1308 canvas. The program supports rectangular two-dimensional plots, histograms,
1309 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1310 to BMP, JPEG or PNG image formats.")
1311 (license license:gpl3+)))
1312
1313 (define-public maxima
1314 (package
1315 (name "maxima")
1316 (version "5.36.1")
1317 (source
1318 (origin
1319 (method url-fetch)
1320 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1321 version "-source/" name "-" version ".tar.gz"))
1322 (sha256
1323 (base32
1324 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1325 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1326 (build-system gnu-build-system)
1327 (inputs
1328 `(("gcl" ,gcl)
1329 ("gnuplot" ,gnuplot) ;for plots
1330 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1331 (native-inputs
1332 `(("texinfo" ,texinfo)
1333 ("perl" ,perl)))
1334 (arguments
1335 `(#:configure-flags
1336 (list "--enable-gcl"
1337 (string-append "--with-posix-shell="
1338 (assoc-ref %build-inputs "bash")
1339 "/bin/sh")
1340 (string-append "--with-wish="
1341 (assoc-ref %build-inputs "tk")
1342 "/bin/wish"
1343 (let ((v ,(package-version tk)))
1344 (string-take v (string-index-right v #\.)))))
1345 ;; By default Maxima attempts to write temporary files to
1346 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1347 ;; Work around that.
1348 #:make-flags (list "TMPDIR=/tmp")
1349 #:phases (alist-cons-before
1350 'check 'pre-check
1351 (lambda _
1352 (chmod "src/maxima" #o555))
1353 ;; Make sure the doc and emacs files are found in the
1354 ;; standard location. Also configure maxima to find gnuplot
1355 ;; without having it on the PATH.
1356 (alist-cons-after
1357 'install 'post-install
1358 (lambda* (#:key outputs inputs #:allow-other-keys)
1359 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1360 (out (assoc-ref outputs "out"))
1361 (datadir (string-append out "/share/maxima/" ,version)))
1362 (with-directory-excursion out
1363 (mkdir-p "share/emacs")
1364 (mkdir-p "share/doc")
1365 (symlink
1366 (string-append datadir "/emacs/")
1367 (string-append out "/share/emacs/site-lisp"))
1368 (symlink
1369 (string-append datadir "/doc/")
1370 (string-append out "/share/doc/maxima"))
1371 (with-atomic-file-replacement
1372 (string-append datadir "/share/maxima-init.lisp")
1373 (lambda (in out)
1374 (format out "~a ~s~a~%"
1375 "(setf $gnuplot_command "
1376 (string-append gnuplot "/bin/gnuplot") ")")
1377 (dump-port in out))))))
1378 %standard-phases))))
1379 (home-page "http://maxima.sourceforge.net")
1380 (synopsis "Numeric and symbolic expression manipulation")
1381 (description "Maxima is a system for the manipulation of symbolic and
1382 numerical expressions. It yields high precision numeric results by using
1383 exact fractions, arbitrary precision integers, and variable precision floating
1384 point numbers")
1385 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1386 ;; Others simply say "GNU General Public License" without stating a
1387 ;; version (which implicitly means gpl1+).
1388 ;; At least one file (src/maxima.asd) says "version 2."
1389 ;; GPLv2 only is therefore the smallest subset.
1390 (license license:gpl2)))
1391
1392 (define-public wxmaxima
1393 (package
1394 (name "wxmaxima")
1395 (version "15.04.0")
1396 (source
1397 (origin
1398 (method url-fetch)
1399 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1400 version "/" name "-" version ".tar.gz"))
1401 (sha256
1402 (base32
1403 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1404 (build-system gnu-build-system)
1405 (inputs
1406 `(("wxwidgets" ,wxwidgets)
1407 ("maxima" ,maxima)))
1408 (arguments
1409 `(#:phases (modify-phases %standard-phases
1410 (add-after
1411 'install 'wrap-program
1412 (lambda* (#:key inputs outputs #:allow-other-keys)
1413 (wrap-program (string-append (assoc-ref outputs "out")
1414 "/bin/wxmaxima")
1415 `("PATH" ":" prefix
1416 (,(string-append (assoc-ref inputs "maxima")
1417 "/bin"))))
1418 #t)))))
1419 (home-page "https://andrejv.github.io/wxmaxima/")
1420 (synopsis "Graphical user interface for the Maxima computer algebra system")
1421 (description
1422 "wxMaxima is a graphical user interface for the Maxima computer algebra
1423 system. It eases the use of Maxima by making most of its commands available
1424 through a menu system and by providing input dialogs for commands that require
1425 more than one argument. It also implements its own display engine that
1426 outputs mathematical symbols directly instead of depicting them with ASCII
1427 characters.
1428
1429 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1430 text and mathematical calculations to create documents, exporting of input and
1431 output to TeX, and a browser for Maxima's manual including command index and
1432 full text searching.")
1433 (license license:gpl2+)))
1434
1435 (define-public muparser
1436 (package
1437 (name "muparser")
1438 (version "2.2.5")
1439 (source
1440 (origin
1441 (method svn-fetch)
1442 (uri (svn-reference
1443 (url "http://muparser.googlecode.com/svn/trunk/")
1444 (revision 34)))
1445 (sha256
1446 (base32
1447 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1448 (build-system gnu-build-system)
1449 (arguments
1450 `(#:configure-flags '("--enable-samples=no")
1451 #:tests? #f)) ;no "check" target
1452 (home-page "http://muparser.beltoforion.de/")
1453 (synopsis "Fast parser library for mathematical expressions")
1454 (description
1455 "muParser is an extensible high performance math parser library. It is
1456 based on transforming an expression into a bytecode and precalculating
1457 constant parts of it.")
1458 (license license:expat)))
1459
1460 (define-public openblas
1461 (package
1462 (name "openblas")
1463 (version "0.2.14")
1464 (source
1465 (origin
1466 (method url-fetch)
1467 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1468 version))
1469 (file-name (string-append name "-" version ".tar.gz"))
1470 (sha256
1471 (base32
1472 "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
1473 (build-system gnu-build-system)
1474 (arguments
1475 `(#:tests? #f ;no "check" target
1476 ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
1477 ;; OpenBLAS will tune itself to the build host, so we need to disable
1478 ;; substitutions.
1479 #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
1480 #:make-flags
1481 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1482 "SHELL=bash"
1483 "NO_LAPACK=1"
1484 ;; Build the library for all supported CPUs. This allows
1485 ;; switching CPU targets at runtime with the environment variable
1486 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1487 ;; Unfortunately, this is not supported on MIPS.
1488 ,@(if (string-prefix? "mips" (%current-system))
1489 '()
1490 '("DYNAMIC_ARCH=1")))
1491 ;; no configure script
1492 #:phases (alist-delete 'configure %standard-phases)))
1493 (inputs
1494 `(("fortran" ,gfortran)))
1495 (native-inputs
1496 `(("cunit" ,cunit)
1497 ("perl" ,perl)))
1498 (home-page "http://www.openblas.net/")
1499 (synopsis "Optimized BLAS library based on GotoBLAS")
1500 (description
1501 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1502 (license license:bsd-3)))
1503
1504 (define-public openlibm
1505 (package
1506 (name "openlibm")
1507 (version "0.4.1")
1508 (source
1509 (origin
1510 (method url-fetch)
1511 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1512 version ".tar.gz"))
1513 (file-name (string-append name "-" version ".tar.gz"))
1514 (sha256
1515 (base32
1516 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1517 (build-system gnu-build-system)
1518 (arguments
1519 `(#:make-flags
1520 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1521 #:phases
1522 ;; no configure script
1523 (alist-delete 'configure %standard-phases)
1524 #:tests? #f)) ;the tests are part of the default target
1525 (home-page "http://openlibm.org/")
1526 (synopsis "Portable C mathematical library (libm)")
1527 (description
1528 "OpenLibm is an effort to have a high quality, portable, standalone C
1529 mathematical library (libm). It can be used standalone in applications and
1530 programming language implementations. The project was born out of a need to
1531 have a good libm for the Julia programming langage that worked consistently
1532 across compilers and operating systems, and in 32-bit and 64-bit
1533 environments.")
1534 ;; See LICENSE.md for details.
1535 (license (list license:expat
1536 license:isc
1537 license:bsd-2
1538 license:public-domain
1539 license:lgpl2.1+))))
1540
1541 (define-public openspecfun
1542 (package
1543 (name "openspecfun")
1544 (version "0.4")
1545 (source
1546 (origin
1547 (method url-fetch)
1548 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1549 version ".tar.gz"))
1550 (file-name (string-append name "-" version ".tar.gz"))
1551 (sha256
1552 (base32
1553 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1554 (build-system gnu-build-system)
1555 (arguments
1556 '(#:tests? #f ;no "check" target
1557 #:make-flags
1558 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1559 ;; no configure script
1560 #:phases (alist-delete 'configure %standard-phases)))
1561 (inputs
1562 `(("fortran" ,gfortran)))
1563 (home-page "https://github.com/JuliaLang/openspecfun")
1564 (synopsis "Collection of special mathematical functions")
1565 (description
1566 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1567 portable package for Bessel Functions of a Complex Argument and Nonnegative
1568 Order; it contains subroutines for computing Bessel functions and Airy
1569 functions. Faddeeva allows computing the various error functions of arbitrary
1570 complex arguments (Faddeeva function, error function, complementary error
1571 function, scaled complementary error function, imaginary error function, and
1572 Dawson function); given these, one can also easily compute Voigt functions,
1573 Fresnel integrals, and similar related functions as well.")
1574 ;; Faddeeva is released under the Expat license; AMOS is included as
1575 ;; public domain software.
1576 (license (list license:expat license:public-domain))))
1577
1578 (define-public suitesparse
1579 (package
1580 (name "suitesparse")
1581 (version "4.4.3")
1582 (source
1583 (origin
1584 (method url-fetch)
1585 (uri (string-append
1586 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1587 version ".tar.gz"))
1588 (sha256
1589 (base32
1590 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1591 (build-system gnu-build-system)
1592 (arguments
1593 '(#:parallel-build? #f ;cholmod build fails otherwise
1594 #:tests? #f ;no "check" target
1595 #:make-flags
1596 (list "CC=gcc"
1597 "BLAS=-lblas"
1598 "TBB=-ltbb"
1599 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1600 (string-append "INSTALL_LIB="
1601 (assoc-ref %outputs "out") "/lib")
1602 (string-append "INSTALL_INCLUDE="
1603 (assoc-ref %outputs "out") "/include"))
1604 #:phases
1605 (alist-cons-before
1606 'install 'prepare-out
1607 ;; README.txt states that the target directories must exist prior to
1608 ;; running "make install".
1609 (lambda _
1610 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1611 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1612 ;; no configure script
1613 (alist-delete 'configure %standard-phases))))
1614 (inputs
1615 `(("tbb" ,tbb)
1616 ("lapack" ,lapack)))
1617 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1618 (synopsis "Suite of sparse matrix software")
1619 (description
1620 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1621 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1622 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1623 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1624 CXSparse, a concise sparse Cholesky factorization package; and many other
1625 packages.")
1626 ;; LGPLv2.1+:
1627 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1628 ;; GPLv2+:
1629 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1630 (license (list license:gpl2+ license:lgpl2.1+))))
1631
1632 (define-public atlas
1633 (package
1634 (name "atlas")
1635 (version "3.10.2")
1636 (source (origin
1637 (method url-fetch)
1638 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1639 version ".tar.bz2"))
1640 (sha256
1641 (base32
1642 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1643 (build-system gnu-build-system)
1644 (home-page "http://math-atlas.sourceforge.net/")
1645 (inputs `(("gfortran" ,gfortran)
1646 ("lapack-tar" ,(package-source lapack))))
1647 (outputs '("out" "doc"))
1648 ;; For the moment we drop support for MIPS at it fails to compile. See
1649 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1650 (supported-systems (delete "mips64el-linux" %supported-systems))
1651 (arguments
1652 `(#:parallel-build? #f
1653 #:parallel-tests? #f
1654
1655 ;; ATLAS tunes itself for the machine it is built on, as explained at
1656 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1657 ;; For this reason, we want users to build it locally instead of using
1658 ;; substitutes.
1659 #:substitutable? #f
1660
1661 #:modules ((srfi srfi-26)
1662 (srfi srfi-1)
1663 (guix build gnu-build-system)
1664 (guix build utils))
1665 #:configure-flags
1666 `(;; Generate position independent code suitable for dynamic libraries
1667 ;; and use WALL timer to get more accurate timing.
1668 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1669 ;; Set word width.
1670 "-b"
1671 ,,(if (string-match "64" (%current-system))
1672 "64"
1673 "32")
1674 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1675 ;; needed to compile C files before it is generated.
1676 "-Ss" "pmake" "make -j 1"
1677 ;; Probe is failing for MIPS. We therefore define the system
1678 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1679 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1680 ,,@(if (string-prefix? "mips" (%current-system))
1681 (list "-A" "49" "-V" "1")
1682 (list))
1683 ;; Generate shared libraries.
1684 "--shared"
1685 ;; Build a full LAPACK library.
1686 ,(string-append "--with-netlib-lapack-tarfile="
1687 (assoc-ref %build-inputs "lapack-tar")))
1688 #:phases
1689 (alist-cons-after
1690 'install 'install-doc
1691 (lambda* (#:key outputs inputs #:allow-other-keys)
1692 (let ((doc (string-append (assoc-ref outputs "doc")
1693 "/share/doc/atlas")))
1694 (mkdir-p doc)
1695 (fold (lambda (file previous)
1696 (and previous (zero? (system* "cp" file doc))))
1697 #t (find-files "../ATLAS/doc" ".*"))))
1698 (alist-cons-after
1699 'check 'check-pt
1700 (lambda _ (zero? (system* "make" "ptcheck")))
1701 ;; Fix files required to run configure.
1702 (alist-cons-before
1703 'configure 'fix-/bin/sh
1704 (lambda _
1705 ;; Use `sh', not `/bin/sh'.
1706 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1707 (("/bin/sh")
1708 "sh")))
1709 ;; Fix /bin/sh in generated make files.
1710 (alist-cons-after
1711 'configure 'fix-/bin/sh-in-generated-files
1712 (lambda _
1713 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1714 (("/bin/sh")
1715 "sh")))
1716 ;; ATLAS configure program does not accepts the default flags
1717 ;; passed by the 'gnu-build-system'.
1718 (alist-replace
1719 'configure
1720 (lambda* (#:key native-inputs inputs outputs
1721 (configure-flags '())
1722 #:allow-other-keys #:rest args)
1723 (let* ((prefix (assoc-ref outputs "out"))
1724 (bash (or (and=> (assoc-ref
1725 (or native-inputs inputs) "bash")
1726 (cut string-append <> "/bin/bash"))
1727 "/bin/sh"))
1728 (flags `(,(string-append "--prefix=" prefix)
1729 ,@configure-flags))
1730 (abs-srcdir (getcwd))
1731 (srcdir (string-append "../" (basename abs-srcdir))))
1732 (format #t "source directory: ~s (relative from build: ~s)~%"
1733 abs-srcdir srcdir)
1734 (mkdir "../build")
1735 (chdir "../build")
1736 (format #t "build directory: ~s~%" (getcwd))
1737 (format #t "configure flags: ~s~%" flags)
1738 (zero? (apply system* bash
1739 (string-append srcdir "/configure")
1740 flags))))
1741 %standard-phases)))))))
1742 (synopsis "Automatically Tuned Linear Algebra Software")
1743 (description
1744 "ATLAS is an automatically tuned linear algebra software library
1745 providing C and Fortran77 interfaces to a portably efficient BLAS
1746 implementation, as well as a few routines from LAPACK.
1747
1748 Optimization occurs at build time. For this reason, the library is built on
1749 the machine where it is installed, without resorting to pre-built substitutes.
1750
1751 Before building the library, CPU throttling should be disabled. This can be
1752 done in the BIOS, or, on GNU/Linux, with the following commands:
1753
1754 cpufreq-selector -g performance -c 0
1755 ...
1756 cpufreq-selector -g performance -c N-1
1757
1758 where N is the number of cores of your CPU. Failure to do so will result in a
1759 library with poor performance.")
1760 (license license:bsd-3)))
1761
1762 (define-public glm
1763 (package
1764 (name "glm")
1765 (version "0.9.6.3")
1766 (source
1767 (origin
1768 (method url-fetch)
1769 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1770 version ".zip"))
1771 (sha256
1772 (base32
1773 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1774 (build-system cmake-build-system)
1775 (native-inputs
1776 `(("unzip" ,unzip)))
1777 (home-page "http://glm.g-truc.net")
1778 (synopsis "OpenGL Mathematics library")
1779 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1780 library for graphics software based on the OpenGL Shading Language (GLSL)
1781 specifications.")
1782 (license license:expat)))
1783
1784 (define-public lpsolve
1785 (package
1786 (name "lpsolve")
1787 (version "5.5.2.0")
1788 (source
1789 (origin
1790 (method url-fetch)
1791 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1792 "/lp_solve_" version "_source.tar.gz"))
1793 (sha256
1794 (base32
1795 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1796 (modules '((guix build utils)))
1797 (snippet
1798 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1799 (("^c=cc") "c=gcc")
1800 ;; Pretend to be on a 64 bit platform to obtain a common directory
1801 ;; name for the build results on all architectures; nothing else
1802 ;; seems to depend on it.
1803 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1804 (build-system gnu-build-system)
1805 (arguments
1806 `(#:tests? #f ; no check target
1807 #:phases
1808 (modify-phases %standard-phases
1809 (delete 'configure)
1810 (replace 'build
1811 (lambda _
1812 (with-directory-excursion "lpsolve55"
1813 (system* "bash" "ccc"))
1814 (with-directory-excursion "lp_solve"
1815 (system* "bash" "ccc"))
1816 #t))
1817 (replace 'install
1818 (lambda* (#:key outputs #:allow-other-keys)
1819 (let* ((out (assoc-ref outputs "out"))
1820 (bin (string-append out "/bin"))
1821 (lib (string-append out "/lib"))
1822 ;; This is where LibreOffice expects to find the header
1823 ;; files, and where they are installed by Debian.
1824 (include (string-append out "/include/lpsolve")))
1825 (mkdir-p lib)
1826 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1827 (string-append lib "/liblpsolve55.a"))
1828 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1829 (string-append lib "/liblpsolve55.so"))
1830 (mkdir-p bin)
1831 (copy-file "lp_solve/bin/ux64/lp_solve"
1832 (string-append bin "/lp_solve"))
1833 (mkdir-p include)
1834 ;; Install a subset of the header files as on Debian
1835 ;; (plus lp_bit.h, which matches the regular expression).
1836 (for-each
1837 (lambda (name)
1838 (copy-file name (string-append include "/" name)))
1839 (find-files "." "lp_[HMSa-z].*\\.h$"))
1840 (with-directory-excursion "shared"
1841 (for-each
1842 (lambda (name)
1843 (copy-file name (string-append include "/" name)))
1844 (find-files "." "\\.h$")))
1845 #t))))))
1846 (home-page "http://lpsolve.sourceforge.net/")
1847 (synopsis "Mixed integer linear programming (MILP) solver")
1848 (description
1849 "lp_solve is a mixed integer linear programming solver based on the
1850 revised simplex and the branch-and-bound methods.")
1851 (license license:lgpl2.1+)))
1852
1853 (define-public dealii
1854 (package
1855 (name "dealii")
1856 (version "8.2.1")
1857 (source
1858 (origin
1859 (method url-fetch)
1860 (uri (string-append "https://github.com/dealii/dealii/releases/"
1861 "download/v" version "/dealii-" version ".tar.gz"))
1862 (sha256
1863 (base32
1864 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1865 (patches (list (search-patch "dealii-p4est-interface.patch")))
1866 (modules '((guix build utils)))
1867 (snippet
1868 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1869 '(delete-file-recursively "bundled"))))
1870 (build-system cmake-build-system)
1871 (inputs
1872 `(("tbb" ,tbb)
1873 ("zlib" ,zlib)
1874 ("boost" ,boost)
1875 ("p4est" ,p4est)
1876 ("blas" ,openblas)
1877 ("lapack" ,lapack)
1878 ("arpack" ,arpack-ng)
1879 ("muparser" ,muparser)
1880 ("gfortran" ,gfortran)
1881 ("suitesparse" ,suitesparse))) ;for UMFPACK
1882 (arguments
1883 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
1884 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
1885 #:phases (modify-phases %standard-phases
1886 (add-after
1887 'install 'hint-example-prefix
1888 ;; Set Cmake hints in examples so that they can find this
1889 ;; deal.II when configuring.
1890 (lambda* (#:key outputs #:allow-other-keys)
1891 (let* ((out (assoc-ref %outputs "out"))
1892 (exmpl (string-append out "/share/doc"
1893 "/dealii/examples")))
1894 (substitute* (find-files exmpl "CMakeLists.txt")
1895 (("([[:space:]]*HINTS.*)\n" _ line)
1896 (string-append line " $ENV{HOME}/.guix-profile "
1897 out "\n")))
1898 #t))))))
1899 (home-page "https://www.dealii.org")
1900 (synopsis "Finite element library")
1901 (description
1902 "Deal.II is a C++ program library targeted at the computational solution
1903 of partial differential equations using adaptive finite elements. The main
1904 aim of deal.II is to enable rapid development of modern finite element codes,
1905 using among other aspects adaptive meshes and a wide array of tools often used
1906 in finite element programs.")
1907 (license license:lgpl2.1+)))
1908
1909 (define-public dealii-openmpi
1910 (package (inherit dealii)
1911 (name "dealii-openmpi")
1912 (inputs
1913 `(("mpi" ,openmpi)
1914 ;;Supported only with MPI:
1915 ("p4est" ,p4est-openmpi)
1916 ("petsc" ,petsc-openmpi)
1917 ("slepc" ,slepc-openmpi)
1918 ("metis" ,metis) ;for MUMPS
1919 ("scalapack" ,scalapack) ;for MUMPS
1920 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
1921 ("arpack" ,arpack-ng-openmpi)
1922 ,@(fold alist-delete (package-inputs dealii)
1923 '("p4est" "arpack"))))
1924 (arguments
1925 (substitute-keyword-arguments (package-arguments dealii)
1926 ((#:configure-flags cf)
1927 ``("-DMPI_C_COMPILER=mpicc"
1928 "-DMPI_CXX_COMPILER=mpicxx"
1929 "-DMPI_Fortran_COMPILER=mpifort"
1930 ,@,cf))))
1931 (synopsis "Finite element library (with MPI support)")))