guix system: Fix return value for 'reconfigure'.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages maths)
23 #:use-module (gnu packages)
24 #:use-module ((guix licenses)
25 #:renamer (symbol-prefix-proc 'license:))
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages cmake)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages curl)
36 #:use-module (gnu packages elf)
37 #:use-module (gnu packages flex)
38 #:use-module (gnu packages fltk)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gettext)
41 #:use-module (gnu packages gcc)
42 #:use-module (gnu packages gd)
43 #:use-module (gnu packages ghostscript)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages less)
46 #:use-module (gnu packages lisp)
47 #:use-module (gnu packages gnome)
48 #:use-module (gnu packages xorg)
49 #:use-module (gnu packages gl)
50 #:use-module (gnu packages m4)
51 #:use-module (gnu packages mpi)
52 #:use-module (gnu packages multiprecision)
53 #:use-module (gnu packages pcre)
54 #:use-module (gnu packages popt)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages readline)
59 #:use-module (gnu packages tcsh)
60 #:use-module (gnu packages texinfo)
61 #:use-module (gnu packages texlive)
62 #:use-module (gnu packages xml))
63
64 (define-public units
65 (package
66 (name "units")
67 (version "2.11")
68 (source (origin
69 (method url-fetch)
70 (uri (string-append "mirror://gnu/units/units-" version
71 ".tar.gz"))
72 (sha256 (base32
73 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
74 (build-system gnu-build-system)
75 (synopsis "Conversion between thousands of scales")
76 (description
77 "GNU Units converts numeric quantities between units of measure. It
78 can handle scale changes through adaptive usage of standard scale prefixes
79 (micro-, kilo-, etc.). It can also handle nonlinear conversions such as
80 Fahrenheit to Celsius. Its interpreter is powerful enough to be used
81 effectively as a scientific calculator.")
82 (license license:gpl3+)
83 (home-page "http://www.gnu.org/software/units/")))
84
85 (define-public gsl
86 (package
87 (name "gsl")
88 (version "1.16")
89 (source
90 (origin
91 (method url-fetch)
92 (uri (string-append "mirror://gnu/gsl/gsl-"
93 version ".tar.gz"))
94 (sha256
95 (base32
96 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
97 (build-system gnu-build-system)
98 (arguments
99 `(#:parallel-tests? #f
100 #:phases
101 (alist-replace
102 'configure
103 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
104 (let ((configure (assoc-ref %standard-phases 'configure)))
105 ;; disable numerically unstable test on i686, see thread at
106 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
107 (if (string=? (or target system) "i686-linux")
108 (substitute* "ode-initval2/Makefile.in"
109 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
110 (apply configure args)))
111 %standard-phases)))
112 (home-page "http://www.gnu.org/software/gsl/")
113 (synopsis "Numerical library for C and C++")
114 (description
115 "The GNU Scientific Library is a library for numerical analysis in C
116 and C++. It includes a wide range of mathematical routines, with over 1000
117 functions in total. Subject areas covered by the library include:
118 differential equations, linear algebra, Fast Fourier Transforms and random
119 numbers.")
120 (license license:gpl3+)))
121
122 (define-public glpk
123 (package
124 (name "glpk")
125 (version "4.54")
126 (source
127 (origin
128 (method url-fetch)
129 (uri (string-append "mirror://gnu/glpk/glpk-"
130 version ".tar.gz"))
131 (sha256
132 (base32
133 "18gr2anv8gyps6j9f22k7li6w07glvww666sdqblvlq2hh3whwmb"))))
134 (build-system gnu-build-system)
135 (inputs
136 `(("gmp" ,gmp)))
137 (arguments
138 `(#:configure-flags '("--with-gmp")))
139 (home-page "http://www.gnu.org/software/glpk/")
140 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
141 (description
142 "GLPK is a C library for solving large-scale linear programming (LP),
143 mixed integer programming (MIP), and other related problems. It supports the
144 GNU MathProg modeling language, a subset of the AMPL language, and features a
145 translator for the language. In addition to the C library, a stand-alone
146 LP/MIP solver is included in the package.")
147 (license license:gpl3+)))
148
149 (define-public pspp
150 (package
151 (name "pspp")
152 (version "0.8.3")
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append "mirror://gnu/pspp/pspp-"
157 version ".tar.gz"))
158 (sha256
159 (base32
160 "0vri2pzvmm38qaihfvwlry30f40lcnps4blg59ixic4q20ldxf5d"))))
161 (build-system gnu-build-system)
162 (inputs
163 `(("cairo" ,cairo)
164 ("fontconfig" ,fontconfig)
165 ("gettext" ,gnu-gettext)
166 ("gsl" ,gsl)
167 ("libxml2" ,libxml2)
168 ("pango" ,pango)
169 ("readline" ,readline)
170 ("gtk" ,gtk+-2)
171 ("gtksourceview" ,gtksourceview)
172 ("zlib" ,zlib)))
173 (native-inputs
174 `(("perl" ,perl)
175 ("pkg-config" ,pkg-config)))
176 (home-page "http://www.gnu.org/software/pspp/")
177 (synopsis "Statistical analysis")
178 (description
179 "GNU PSPP is a statistical analysis program. It can perform
180 descriptive statistics, T-tests, linear regression and non-parametric tests.
181 It features both a graphical interface as well as command-line input. PSPP is
182 designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data can
183 be imported from spreadsheets, text files and database sources and it can be
184 output in text, PostScript, PDF or HTML.")
185 (license license:gpl3+)))
186
187 (define-public lapack
188 (package
189 (name "lapack")
190 (version "3.5.0")
191 (source
192 (origin
193 (method url-fetch)
194 (uri (string-append "http://www.netlib.org/lapack/lapack-"
195 version ".tgz"))
196 (sha256
197 (base32
198 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
199 (build-system cmake-build-system)
200 (home-page "http://www.netlib.org/lapack/")
201 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
202 (inputs `(("fortran" ,gfortran-4.8)
203 ("python" ,python-2)))
204 (arguments
205 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
206 #:phases (alist-cons-before
207 'check 'patch-python
208 (lambda* (#:key inputs #:allow-other-keys)
209 (let ((python (assoc-ref inputs "python")))
210 (substitute* "lapack_testing.py"
211 (("/usr/bin/env python") python))))
212 %standard-phases)))
213 (synopsis "Library for numerical linear algebra")
214 (description
215 "LAPACK is a Fortran 90 library for solving the most commonly occurring
216 problems in numerical linear algebra.")
217 (license (license:bsd-style "file://LICENSE"
218 "See LICENSE in the distribution."))))
219
220 (define-public gnuplot
221 (package
222 (name "gnuplot")
223 (version "4.6.3")
224 (source
225 (origin
226 (method url-fetch)
227 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
228 version "/gnuplot-" version ".tar.gz"))
229 (sha256
230 (base32
231 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
232 (build-system gnu-build-system)
233 (inputs `(("readline" ,readline)
234 ("cairo" ,cairo)
235 ("pango" ,pango)
236 ("gd" ,gd)))
237 (native-inputs `(("texlive" ,texlive)
238 ("pkg-config" ,pkg-config)))
239 (home-page "http://www.gnuplot.info")
240 (synopsis "Command-line driven graphing utility")
241 (description "Gnuplot is a portable command-line driven graphing
242 utility. It was originally created to allow scientists and students to
243 visualize mathematical functions and data interactively, but has grown to
244 support many non-interactive uses such as web scripting. It is also used as a
245 plotting engine by third-party applications like Octave.")
246 ;; X11 Style with the additional restriction that derived works may only be
247 ;; distributed as patches to the original.
248 (license (license:fsf-free
249 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
250
251 (define-public hdf5
252 (package
253 (name "hdf5")
254 (version "1.8.12")
255 (source
256 (origin
257 (method url-fetch)
258 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
259 version "/src/hdf5-"
260 version ".tar.bz2"))
261 (sha256
262 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
263 (build-system gnu-build-system)
264 (arguments
265 `(#:phases
266 (alist-cons-before
267 'configure 'patch-configure
268 (lambda _
269 (substitute* "configure"
270 (("/bin/mv") "mv")))
271 %standard-phases)))
272 (outputs '("out" "bin" "lib" "include"))
273 (home-page "http://www.hdfgroup.org")
274 (synopsis "Management suite for extremely large and complex data")
275 (description "HDF5 is a suite that makes possible the management of
276 extremely large and complex data collections.")
277 (license (license:x11-style
278 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
279
280
281 ;; For a fully featured Octave, users are strongly recommended also to install
282 ;; the following packages: texinfo, less, ghostscript, gnuplot.
283 (define-public octave
284 (package
285 (name "octave")
286 (version "3.8.0")
287 (source
288 (origin
289 (method url-fetch)
290 (uri (string-append "mirror://gnu/octave/octave-"
291 version ".tar.gz"))
292 (sha256
293 (base32
294 "0ks9pr154syw0vb3jn6xsnrkkrbvf9y7i7gaxa28rz6ngxbxvq9l"))))
295 (build-system gnu-build-system)
296 (inputs
297 `(("lapack" ,lapack)
298 ("readline" ,readline)
299 ("glpk" ,glpk)
300 ("curl" ,curl)
301 ("pcre" ,pcre)
302 ("fltk" ,fltk)
303 ("fontconfig" ,fontconfig)
304 ("freetype" ,freetype)
305 ("hdf5-lib" ,hdf5 "lib")
306 ("hdf5-include" ,hdf5 "include")
307 ("libxft" ,libxft)
308 ("mesa" ,mesa)
309 ("zlib" ,zlib)))
310 (native-inputs
311 `(("gfortran" ,gfortran-4.8)
312 ("pkg-config" ,pkg-config)
313 ("perl" ,perl)
314 ;; The following inputs are not actually used in the build process. However, the
315 ;; ./configure gratuitously tests for their existence and assumes that programs not
316 ;; present at build time are also not, and can never be, available at run time!
317 ;; If these inputs are therefore not present, support for them will be built out.
318 ;; However, Octave will still run without them, albeit without the features they
319 ;; provide.
320 ("less" ,less)
321 ("texinfo" ,texinfo)
322 ("ghostscript" ,ghostscript)
323 ("gnuplot" ,gnuplot)))
324 (arguments
325 `(#:configure-flags (list (string-append "--with-shell="
326 (assoc-ref %build-inputs "bash")
327 "/bin/sh"))))
328 (home-page "http://www.gnu.org/software/octave/")
329 (synopsis "High-level language for numerical computation")
330 (description "GNU Octave is a high-level interpreted language that is specialized
331 for numerical computations. It can be used for both linear and non-linear
332 applications and it provides great support for visualizing results. Work may
333 be performed both at the interactive command-line as well as via script
334 files.")
335 (license license:gpl3+)))
336
337 (define-public gmsh
338 (package
339 (name "gmsh")
340 (version "2.8.4")
341 (source
342 (origin
343 (method url-fetch)
344 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
345 version "-source.tgz"))
346 (sha256
347 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
348 (modules '((guix build utils)))
349 (snippet
350 ;; Remove non-free METIS code
351 '(delete-file-recursively "contrib/Metis"))))
352 (build-system cmake-build-system)
353 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
354 (propagated-inputs
355 `(("fltk" ,fltk)
356 ("gfortran" ,gfortran-4.8)
357 ("gmp" ,gmp)
358 ("hdf5-lib" ,hdf5 "lib")
359 ("hdf5-include" ,hdf5 "include")
360 ("lapack" ,lapack)
361 ("mesa" ,mesa)
362 ("libx11" ,libx11)
363 ("libxext" ,libxext)))
364 (arguments
365 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
366 "-DENABLE_BUILD_SHARED:BOOL=ON"
367 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
368 (home-page "http://www.geuz.org/gmsh/")
369 (synopsis "3D finite element grid generator")
370 (description "Gmsh is a 3D finite element grid generator with a built-in
371 CAD engine and post-processor. Its design goal is to provide a fast, light
372 and user-friendly meshing tool with parametric input and advanced
373 visualization capabilities. Gmsh is built around four modules: geometry,
374 mesh, solver and post-processing. The specification of any input to these
375 modules is done either interactively using the graphical user interface or in
376 ASCII text files using Gmsh's own scripting language.")
377 (license license:gpl2+)))
378
379 (define-public petsc
380 (package
381 (name "petsc")
382 (version "3.4.4")
383 (source
384 (origin
385 (method url-fetch)
386 ;; The *-lite-* tarball does not contain the *large* documentation
387 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
388 "petsc-lite-" version ".tar.gz"))
389 (sha256
390 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
391 (patches
392 (list (search-patch "petsc-fix-threadcomm.patch")))))
393 (build-system gnu-build-system)
394 (native-inputs
395 `(("python" ,python-2)
396 ("perl" ,perl)))
397 (inputs
398 `(("gfortran" ,gfortran-4.8)
399 ("lapack" ,lapack)
400 ("superlu" ,superlu)
401 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
402 ;; leaving out opengl, as configuration seems to only be for mac
403 ))
404 (arguments
405 `(#:test-target "test"
406 #:parallel-build? #f
407 #:configure-flags
408 `("--with-mpi=0"
409 "--with-openmp=1"
410 "--with-superlu=1"
411 ,(string-append "--with-superlu-include="
412 (assoc-ref %build-inputs "superlu") "/include")
413 ,(string-append "--with-superlu-lib="
414 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
415 #:phases
416 (alist-replace
417 'configure
418 ;; PETSc's configure script is actually a python script, so we can't
419 ;; run it with bash.
420 (lambda* (#:key outputs (configure-flags '())
421 #:allow-other-keys)
422 (let* ((prefix (assoc-ref outputs "out"))
423 (flags `(,(string-append "--prefix=" prefix)
424 ,@configure-flags)))
425 (format #t "build directory: ~s~%" (getcwd))
426 (format #t "configure flags: ~s~%" flags)
427 (zero? (apply system* "./configure" flags))))
428 (alist-cons-after
429 'configure 'clean-local-references
430 ;; Try to keep build directory names from leaking into compiled code
431 (lambda* (#:key inputs outputs #:allow-other-keys)
432 (let ((out (assoc-ref outputs "out")))
433 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
434 (((getcwd)) out))))
435 (alist-cons-after
436 'install 'clean-install
437 ;; Try to keep installed files from leaking build directory names.
438 (lambda* (#:key inputs outputs #:allow-other-keys)
439 (let ((out (assoc-ref outputs "out"))
440 (fortran (assoc-ref inputs "gfortran")))
441 (substitute* (map (lambda (file)
442 (string-append out "/" file))
443 '("conf/petscvariables"
444 "conf/PETScConfig.cmake"))
445 (((getcwd)) out))
446 ;; Make compiler references point to the store
447 (substitute* (string-append out "/conf/petscvariables")
448 (("= g(cc|\\+\\+|fortran)" _ suffix)
449 (string-append "= " fortran "/bin/g" suffix)))
450 ;; PETSc installs some build logs, which aren't necessary.
451 (for-each (lambda (file)
452 (let ((f (string-append out "/" file)))
453 (when (file-exists? f)
454 (delete-file f))))
455 '("conf/configure.log"
456 "conf/make.log"
457 "conf/test.log"
458 "conf/error.log"
459 "conf/RDict.db"
460 ;; Once installed, should uninstall with Guix
461 "conf/uninstall.py"))))
462 %standard-phases)))))
463 (home-page "http://www.mcs.anl.gov/petsc")
464 (synopsis "Library to solve PDEs")
465 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
466 data structures and routines for the scalable (parallel) solution of
467 scientific applications modeled by partial differential equations.")
468 (license (license:bsd-style
469 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
470
471 (define-public petsc-complex
472 (package (inherit petsc)
473 (name "petsc-complex")
474 (arguments
475 (substitute-keyword-arguments (package-arguments petsc)
476 ((#:configure-flags cf)
477 `(cons "--with-scalar-type=complex" ,cf))))
478 (synopsis "Library to solve PDEs (with complex scalars)")))
479
480 (define-public petsc-openmpi
481 (package (inherit petsc)
482 (name "petsc-openmpi")
483 (inputs
484 `(("openmpi" ,openmpi)
485 ,@(package-inputs petsc)))
486 (arguments
487 (substitute-keyword-arguments (package-arguments petsc)
488 ((#:configure-flags cf)
489 ``("--with-mpiexec=mpirun"
490 ,(string-append "--with-mpi-dir="
491 (assoc-ref %build-inputs "openmpi"))
492 ,@(delete "--with-mpi=0" ,cf)))))
493 (synopsis "Library to solve PDEs (with MPI support)")))
494
495 (define-public petsc-complex-openmpi
496 (package (inherit petsc-complex)
497 (name "petsc-complex-openmpi")
498 (inputs
499 `(("openmpi" ,openmpi)
500 ,@(package-inputs petsc-complex)))
501 (arguments
502 (substitute-keyword-arguments (package-arguments petsc-complex)
503 ((#:configure-flags cf)
504 ``("--with-mpiexec=mpirun"
505 ,(string-append "--with-mpi-dir="
506 (assoc-ref %build-inputs "openmpi"))
507 ,@(delete "--with-mpi=0" ,cf)))))
508 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
509
510 (define-public superlu
511 (package
512 (name "superlu")
513 (version "4.3")
514 (source
515 (origin
516 (method url-fetch)
517 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
518 "superlu_" version ".tar.gz"))
519 (sha256
520 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
521 (build-system gnu-build-system)
522 (native-inputs
523 `(("tcsh" ,tcsh)))
524 (inputs
525 `(("lapack" ,lapack)
526 ("gfortran" ,gfortran-4.8)))
527 (arguments
528 `(#:parallel-build? #f
529 #:tests? #f ;tests are run as part of `make all`
530 #:phases
531 (alist-replace
532 'configure
533 (lambda* (#:key inputs outputs #:allow-other-keys)
534 (call-with-output-file "make.inc"
535 (lambda (port)
536 (format port "
537 PLAT =
538 SuperLUroot = ~a
539 SUPERLULIB = ~a/lib/libsuperlu.a
540 TMGLIB = libtmglib.a
541 BLASDEF = -DUSE_VENDOR_BLAS
542 BLASLIB = -L~a/lib -lblas
543 LIBS = $(SUPERLULIB) $(BLASLIB)
544 ARCH = ar
545 ARCHFLAGS = cr
546 RANLIB = ranlib
547 CC = gcc
548 PIC = -fPIC
549 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
550 NOOPTS = -O0 $(PIC)
551 FORTRAN = gfortran
552 FFLAGS = -O2 $(PIC)
553 LOADER = $(CC)
554 CDEFS = -DAdd_"
555 (getcwd)
556 (assoc-ref outputs "out")
557 (assoc-ref inputs "lapack")))))
558 (alist-cons-before
559 'build 'create-install-directories
560 (lambda* (#:key outputs #:allow-other-keys)
561 (for-each
562 (lambda (dir)
563 (mkdir-p (string-append (assoc-ref outputs "out")
564 "/" dir)))
565 '("lib" "include")))
566 (alist-replace
567 'install
568 (lambda* (#:key outputs #:allow-other-keys)
569 ;; Library is placed in lib during the build phase. Copy over
570 ;; headers to include.
571 (let* ((out (assoc-ref outputs "out"))
572 (incdir (string-append out "/include")))
573 (for-each (lambda (file)
574 (let ((base (basename file)))
575 (format #t "installing `~a' to `~a'~%"
576 base incdir)
577 (copy-file file
578 (string-append incdir "/" base))))
579 (find-files "SRC" ".*\\.h$"))))
580 %standard-phases)))))
581 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
582 (synopsis "Supernodal direct solver for sparse linear systems")
583 (description
584 "SuperLU is a general purpose library for the direct solution of large,
585 sparse, nonsymmetric systems of linear equations on high performance machines.
586 The library is written in C and is callable from either C or Fortran. The
587 library routines perform an LU decomposition with partial pivoting and
588 triangular system solves through forward and back substitution. The library
589 also provides threshold-based ILU factorization preconditioners.")
590 (license license:bsd-3)))
591
592 (define-public superlu-dist
593 (package
594 (name "superlu-dist")
595 (version "3.3")
596 (source
597 (origin
598 (method url-fetch)
599 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
600 "superlu_dist_" version ".tar.gz"))
601 (sha256
602 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
603 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
604 (build-system gnu-build-system)
605 (native-inputs
606 `(("tcsh" ,tcsh)))
607 (inputs
608 `(("gfortran" ,gfortran-4.8)))
609 (propagated-inputs
610 `(("openmpi" ,openmpi) ;headers include MPI heades
611 ("lapack" ,lapack) ;required to link with output library
612 ("pt-scotch" ,pt-scotch))) ;same
613 (arguments
614 `(#:parallel-build? #f ;race conditions using ar
615 #:phases
616 (alist-replace
617 'configure
618 (lambda* (#:key inputs outputs #:allow-other-keys)
619 (call-with-output-file "make.inc"
620 (lambda (port)
621 (format port "
622 PLAT =
623 DSuperLUroot = ~a
624 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
625 BLASDEF = -DUSE_VENDOR_BLAS
626 BLASLIB = -L~a/lib -lblas
627 PARMETISLIB = -L~a/lib \
628 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
629 -lscotch -lscotcherr -lscotcherrexit
630 METISLIB = -L~:*~a/lib \
631 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
632 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
633 ARCH = ar
634 ARCHFLAGS = cr
635 RANLIB = ranlib
636 CC = mpicc
637 PIC = -fPIC
638 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
639 NOOPTS = -O0 -g $(PIC)
640 FORTRAN = mpifort
641 FFLAGS = -O2 -g $(PIC)
642 LOADER = $(CC)
643 CDEFS = -DAdd_"
644 (getcwd)
645 (assoc-ref outputs "out")
646 (assoc-ref inputs "lapack")
647 (assoc-ref inputs "pt-scotch")))))
648 (alist-cons-after
649 'unpack 'remove-broken-symlinks
650 (lambda _
651 (for-each delete-file
652 (find-files "MAKE_INC" "\\.#make\\..*")))
653 (alist-cons-before
654 'build 'create-install-directories
655 (lambda* (#:key outputs #:allow-other-keys)
656 (for-each
657 (lambda (dir)
658 (mkdir-p (string-append (assoc-ref outputs "out")
659 "/" dir)))
660 '("lib" "include")))
661 (alist-replace
662 'check
663 (lambda _
664 (with-directory-excursion "EXAMPLE"
665 (and
666 (zero? (system* "mpirun" "-n" "2"
667 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
668 (zero? (system* "mpirun" "-n" "2"
669 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
670 (alist-replace
671 'install
672 (lambda* (#:key outputs #:allow-other-keys)
673 ;; Library is placed in lib during the build phase. Copy over
674 ;; headers to include.
675 (let* ((out (assoc-ref outputs "out"))
676 (incdir (string-append out "/include")))
677 (for-each (lambda (file)
678 (let ((base (basename file)))
679 (format #t "installing `~a' to `~a'~%"
680 base incdir)
681 (copy-file file
682 (string-append incdir "/" base))))
683 (find-files "SRC" ".*\\.h$"))))
684 %standard-phases)))))))
685 (home-page (package-home-page superlu))
686 (synopsis "Parallel supernodal direct solver")
687 (description
688 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
689 It is targeted for distributed memory parallel machines. SuperLU_DIST is
690 implemented in ANSI C, and MPI for communications.")
691 (license license:bsd-3)))
692
693 (define-public scotch
694 (package
695 (name "scotch")
696 (version "6.0.0")
697 (source
698 (origin
699 (method url-fetch)
700 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
701 "scotch_" version ".tar.gz"))
702 (sha256
703 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
704 (patches (list (search-patch "scotch-test-threading.patch")))))
705 (build-system gnu-build-system)
706 (inputs
707 `(("zlib" ,zlib)
708 ("flex" ,flex)
709 ("bison" ,bison)))
710 (arguments
711 `(#:phases
712 (alist-cons-after
713 'unpack 'chdir-to-src
714 (lambda _ (chdir "src"))
715 (alist-replace
716 'configure
717 (lambda _
718 (call-with-output-file "Makefile.inc"
719 (lambda (port)
720 (format port "
721 EXE =
722 LIB = .a
723 OBJ = .o
724 MAKE = make
725 AR = ar
726 ARFLAGS = -ruv
727 CCS = gcc
728 CCP = mpicc
729 CCD = gcc
730 CPPFLAGS =~{ -D~a~}
731 CFLAGS = -O2 -g $(CPPFLAGS)
732 LDFLAGS = -lz -lm -lrt -lpthread
733 CP = cp
734 LEX = flex -Pscotchyy -olex.yy.c
735 LN = ln
736 MKDIR = mkdir
737 MV = mv
738 RANLIB = ranlib
739 YACC = bison -pscotchyy -y -b y
740 "
741 '("COMMON_FILE_COMPRESS_GZ"
742 "COMMON_PTHREAD"
743 "COMMON_RANDOM_FIXED_SEED"
744 ;; TODO: Define once our MPI supports
745 ;; MPI_THREAD_MULTIPLE
746 ;; "SCOTCH_PTHREAD"
747 ;; "SCOTCH_PTHREAD_NUMBER=2"
748 "restrict=__restrict")))))
749 (alist-replace
750 'install
751 (lambda* (#:key outputs #:allow-other-keys)
752 (let ((out (assoc-ref outputs "out")))
753 (mkdir out)
754 (zero? (system* "make"
755 (string-append "prefix=" out)
756 "install"))))
757 %standard-phases)))))
758 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
759 (synopsis "Programs and libraries for graph algorithms")
760 (description "SCOTCH is a set of programs and libraries which implement
761 the static mapping and sparse matrix reordering algorithms developed within
762 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
763 conquer approach, to scientific computing problems such as graph and mesh
764 partitioning, static mapping, and sparse matrix ordering, in application
765 domains ranging from structural mechanics to operating systems or
766 bio-chemistry.")
767 ;; See LICENSE_en.txt
768 (license license:cecill-c)))
769
770 (define-public pt-scotch
771 (package (inherit scotch)
772 (name "pt-scotch")
773 (propagated-inputs
774 `(("openmpi" ,openmpi))) ;Headers include MPI headers
775 (arguments
776 (substitute-keyword-arguments (package-arguments scotch)
777 ((#:phases scotch-phases)
778 `(alist-replace
779 'build
780 ;; TODO: Would like to add parallelism here
781 (lambda _
782 (and
783 (zero? (system* "make" "ptscotch"))
784 ;; Install the serial metis compatibility library
785 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
786 (alist-replace
787 'check
788 (lambda _ (zero? (system* "make" "ptcheck")))
789 (alist-replace
790 'install
791 (lambda* (#:key outputs #:allow-other-keys)
792 (let ((out (assoc-ref outputs "out")))
793 (mkdir out)
794 (zero? (system* "make"
795 (string-append "prefix=" out)
796 "install"))))
797 ,scotch-phases))))))
798 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
799
800 (define-public gsegrafix
801 (package
802 (name "gsegrafix")
803 (version "1.0.6")
804 (source
805 (origin
806 (method url-fetch)
807 (uri (string-append "mirror://gnu/" name "/" name "-"
808 version ".tar.gz"))
809 (sha256
810 (base32
811 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
812 (build-system gnu-build-system)
813 (arguments
814 `(#:configure-flags '("LDFLAGS=-lm")))
815 (inputs
816 `(("libgnomecanvas" ,libgnomecanvas)
817 ("libbonoboui" ,libbonoboui)
818 ("libgnomeui" ,libgnomeui)
819 ("libgnomeprintui" ,libgnomeprintui)
820 ("popt" ,popt)))
821 (native-inputs
822 `(("pkg-config" ,pkg-config)))
823 (home-page "http://www.gnu.org/software/gsegrafix/")
824 (synopsis "GNOME application to create scientific and engineering plots")
825 (description "GSEGrafix is an application which produces high-quality graphical
826 plots for science and engineering. Plots are specified via simple ASCII
827 parameter files and data files and are presented in an anti-aliased GNOME
828 canvas. The program supports rectangular two-dimensional plots, histograms,
829 polar-axis plots and three-dimensional plots. Plots can be printed or saved
830 to BMP, JPEG or PNG image formats.")
831 (license license:gpl3+)))
832
833 (define-public maxima
834 (package
835 (name "maxima")
836 (version "5.33.0")
837 (source
838 (origin
839 (method url-fetch)
840 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
841 version "-source/" name "-" version ".tar.gz"))
842 (sha256
843 (base32
844 "13axm11xw0f3frx5b0qdidi7igkn1524fzz77s9rbpl2yy2nrbz2"))))
845 (build-system gnu-build-system)
846 (arguments
847 `(#:phases (alist-cons-before
848 'check 'pre-check
849 (lambda _
850 (chmod "src/maxima" #o555))
851 %standard-phases)))
852 (inputs
853 `(("gcl" ,gcl)))
854 (native-inputs
855 `(("texinfo" ,texinfo)
856 ("perl" ,perl)))
857 (home-page "http://maxima.sourceforge.net")
858 (synopsis "Numeric and symbolic expression manipulation")
859 (description "Maxima is a system for the manipulation of symbolic and
860 numerical expressions. It yields high precision numeric results by using
861 exact fractions, arbitrary precision integers, and variable precision floating
862 point numbers")
863 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
864 ;; Others simply say "GNU General Public License" without stating a
865 ;; version (which implicitly means gpl1+).
866 ;; At least one file (src/maxima.asd) says "version 2."
867 ;; GPLv2 only is therefore the smallest subset.
868 (license license:gpl2)))