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