firedrake: Moved to new overlay system and shared sub-scope

Firedrake contains a ton of inter-connected dependencies, many of
which are either firedrake specific or forked versions of upstream
packages.  Cleaner to create a firedrake sub-scope for all these.
This commit is contained in:
Tyson Whitehead
2018-01-18 00:17:48 -05:00
parent d4dd6ff700
commit 8dda256fad
28 changed files with 373 additions and 372 deletions

27
pkgs/firedrake/coffee.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, pulp }:
pythonPackages.buildPythonPackage rec {
version = "bdbc5fc0a8dfc45683489c6835c3c00cb27c0427";
name = "firedrake-COFFEE-${version}";
src = fetchFromGitHub {
owner = "coneoproject";
repo = "COFFEE";
rev = "${version}";
sha256 = "0b4jgnz05n6lapcnljpnq1p5z6j4bbdnq0mm3c53gzx4r47rkgyk";
};
propagatedBuildInputs = [
pythonPackages.networkx
pythonPackages.numpy
pythonPackages.six
pulp
];
meta = with lib; {
homepage = "https://github.com/coneoproject/COFFEE";
description = "A COmpiler For Fast Expression Evaluation (COFFEE).";
license = licenses.bsd3;
};
}

View File

@@ -0,0 +1,49 @@
# This just brings in everything.
#
# This isn't really informative or overridable in any practical sense. Could put the closure of the dependencies
# of all the packages declared here instead. This would be overridable/informative, but a bigger pain to maintain.
#
# Likely this should be added into the python packages set instead of dropped on the top-level.
#
{ pkgs }:
let
self =
let
# Top-level scope extended with this set of packages.
#
# Possibly it would make more sense to use the python-level scope instead?
#
callPackage = pkgs.newScope self;
in
with self; {
inherit callPackages;
# Python to use for all this stuff (much of it is python)
python = pkgs.python27;
pythonPackages = python.pkgs;
# Forked and unavailable packages required by firedrake and its dependencies
ufl = callPackage ./ufl.nix { };
fiat = callPackage ./fiat.nix { };
finat = callPackage ./finat.nix { };
tsfc = callPackage ./tsfc.nix { };
pyop2 = callPackage ./pyop2.nix { };
petsc = callPackage ./petsc.nix { };
petsc4py = callPackage ./petsc4py.nix { };
coffee = callPackage ./coffee.nix { };
firedrake = callPackage ./firedrake.nix { };
pulp = callPackage ./pulp.nix { };
sowing = callPackage ./sowing.nix { };
metis = callPackage ./metis.nix { };
hypre = callPackage ./hypre.nix { };
parmetis = callPackage ./parmetis.nix { };
exodus = callPackage ./exodus.nix { };
# Incompatible version (something with communicator/datatype cleanup callbacks?)
mpi4py = callPackage ./mpi4py.nix { };
};
in
self.firedrake

View File

@@ -0,0 +1,10 @@
--- exodus/forbind/CMakeLists.txt_ 2017-04-28 15:32:19.000000000 -0400
+++ exodus/forbind/CMakeLists.txt 2017-04-28 15:49:31.000000000 -0400
@@ -43,6 +43,7 @@
INCLUDE_DIRECTORIES(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
+ "${CMAKE_SOURCE_DIR}/cbind/include"
"${NETCDF_INCLUDE_DIR}"
)

29
pkgs/firedrake/exodus.nix Normal file
View File

@@ -0,0 +1,29 @@
{ stdenv, fetchurl, cmake, gfortran
, netcdf, hdf5 }:
stdenv.mkDerivation rec {
version = "5.24";
name = "exodus-${version}";
src = fetchurl {
url = "http://ftp.mcs.anl.gov/pub/petsc/externalpackages/${name}.tar.bz2";
sha256 = "0pai6v322x1z09z4zp0plx5p9zg1g4645mpqh3kcfh93az070sn1";
};
buildInputs = [
gfortran
cmake
netcdf
hdf5
];
patches = ./exodus-include.patch;
sourceRoot = "${name}/exodus";
meta = with stdenv.lib; {
homepage = "http://gsjaardema.github.io/seacas";
description = "A model developed to store and retrieve data for finite element analyses.";
license = licenses.bsd3;
};
}

25
pkgs/firedrake/fiat.nix Normal file
View File

@@ -0,0 +1,25 @@
{ lib, fetchFromGitHub, pythonPackages }:
pythonPackages.buildPythonPackage rec {
version = "20847cdee0d323726571324f565ff3da6f19e700";
name = "firedrake-fiat-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "fiat";
rev = "${version}";
sha256 = "1id0p06m7mwx8caz30g0cgci2n73mvqf6i6hnm1w08m605fxvwwf";
};
propagatedBuildInputs = [
pythonPackages.numpy
pythonPackages.sympy
pythonPackages.six
];
meta = with lib; {
homepage = "https://github.com/firedrakeproject/fiat";
description = "Copy of upstream FIAT for use with Firedrake.";
license = licenses.lgpl3;
};
}

25
pkgs/firedrake/finat.nix Normal file
View File

@@ -0,0 +1,25 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, fiat }:
pythonPackages.buildPythonPackage rec {
version = "fecac5b4d4ecf4b02b1ee440bdc4a57bfa9f1d87";
name = "FInAT-${version}";
src = fetchFromGitHub {
owner = "FInAT";
repo = "FInAT";
rev = "${version}";
sha256 = "1ad7vzpvlwmx5pgmvj2v8s6n5kdrz02j7wzj25wn974a2ff6pvvd";
};
propagatedBuildInputs = [
pythonPackages.numpy
fiat
];
meta = with lib; {
homepage = "https://github.com/FInAT/FInAT";
description = "FInAT is an attempt to provide a more abstract, smarter library of finite elements.";
license = licenses.mit;
};
}

View File

@@ -0,0 +1,14 @@
--- firedrake/setup.py.orig 2017-04-21 17:04:48.554347140 -0400
+++ firedrake/setup.py 2017-04-21 23:09:34.794283607 -0400
@@ -73,4 +73,5 @@
url="http://firedrakeproject.org",
packages=["firedrake", "firedrake.mg", "firedrake.slope_limiter",
+ "firedrake.slate","firedrake.slate.slac",
"firedrake.matrix_free", "firedrake_configuration"],
package_data={"firedrake": ["firedrake_geometry.h",
@@ -98,4 +99,5 @@
"%s/include" % sys.prefix],
libraries=["spatialindex_c"],
+ language="c++",
extra_link_args=["-L%s/lib" % sys.prefix,
"-Wl,-rpath,%s/lib" % sys.prefix]),

View File

@@ -0,0 +1,52 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, openmpi, hdf5, libspatialindex
, ufl, fiat, finat, tsfc, pyop2, petsc, petsc4py, coffee }:
pythonPackages.buildPythonPackage rec {
version = "a967a34c0f05d3dbfb9be05825777da40a6195dc";
name = "firedrake-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "firedrake";
rev = "${version}";
sha256 = "0flj0ca3b3pmcnak058alx5kfhz0h7s3hz0q7qiciag9m8p6ccnl";
};
buildInputs = [
openmpi
hdf5
libspatialindex
pythonPackages.cython
pythonPackages.pytest_29
pythonPackages.pytest_xdist
pythonPackages.pylint
petsc
];
propagatedBuildInputs = [
pythonPackages.h5py
pythonPackages.six
pythonPackages.sympy
pythonPackages.psutil
pythonPackages.cachetools
pythonPackages.singledispatch
pythonPackages.ipython
pythonPackages.matplotlib
ufl
fiat
finat
tsfc
pyop2
petsc4py
coffee
];
patches = [ ./firedrake-setup.patch ];
meta = with lib; {
homepage = "http://www.firedrakeproject.org";
description = "Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM).";
license = licenses.gpl3;
};
}

30
pkgs/firedrake/hypre.nix Normal file
View File

@@ -0,0 +1,30 @@
{ stdenv, fetchFromGitHub, cmake
, openmpi }:
stdenv.mkDerivation rec {
version = "xsdk-0.2.0-rc2";
name = "hypre-${version}";
src = fetchFromGitHub {
owner = "LLNL";
repo = "hypre";
rev = "${version}";
sha256 = "0ql1zs0imv14q511aj5g82mfhlycy8rqa5b6rzzw86c4cslasgch";
};
buildInputs = [
cmake
openmpi
];
sourceRoot = "source/src";
preConfigure = "cmakeFlags=\"-DHYPRE_INSTALL_PREFIX=$prefix $cmakeFlags\"";
makeFlags = [ "VERBOSE=1" ];
meta = with stdenv.lib; {
homepage = "http://www.llnl.gov/casc/hypre";
description = "Parallel solvers for sparse linear systems featuring multigrid methods.";
license = licenses.gpl2;
};
}

24
pkgs/firedrake/metis.nix Normal file
View File

@@ -0,0 +1,24 @@
{ stdenv, fetchFromBitbucket, cmake }:
stdenv.mkDerivation rec {
version = "5.1.0-p4";
name = "metis-${version}";
src = fetchFromBitbucket {
owner = "petsc";
repo = "pkg-metis";
rev = "v${version}";
sha256 = "1mw87w7jz8kfi7jw3kjfagxbagh2x794z0aj3g9z7w3g6wdbvlrr";
};
buildInputs = [
cmake
];
makeFlags = [ "VERBOSE=1" ];
meta = with stdenv.lib; {
homepage = "https://bitbucket.org/petsc/metis";
description = "A set of serial programs for partitioning graphs, partitioning finite element meshes, and producing fill reducing orderings for sparse matrices.";
};
}

58
pkgs/firedrake/mpi4py.nix Normal file
View File

@@ -0,0 +1,58 @@
{ stdenv, fetchurl, python
, openmpi, openssh }:
python.pkgs.buildPythonPackage rec {
name = "mpi4py-2.0.0";
src = fetchurl {
url = "https://bitbucket.org/mpi4py/mpi4py/downloads/${name}.tar.gz";
sha256 = "10fb01595rg17ycz08a23v24akm25d13srsy2rnixam7a5ca0hv5";
};
passthru = {
inherit openmpi;
};
# The tests in the `test_spawn` module fail in the chroot build environment.
# However, they do pass in a pure, or non-pure nix-shell. Hence, we
# deactivate these particular tests.
# Unfortunately, the command-line arguments to `./setup.py test` are not
# correctly passed to the test-runner. Hence, these arguments are patched
# directly into `setup.py`.
patchPhase = ''
sed 's/err = main(cmd.args or \[\])/err = main(cmd.args or ["-v", "-e", "test_spawn"])/' -i setup.py
'';
configurePhase = "";
installPhase = ''
mkdir -p "$out/lib/${python.libPrefix}/site-packages"
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
${python}/bin/${python.executable} setup.py install \
--install-lib=$out/lib/${python.libPrefix}/site-packages \
--prefix="$out"
# --install-lib:
# sometimes packages specify where files should be installed outside the usual
# python lib prefix, we override that back so all infrastructure (setup hooks)
# work as expected
'';
setupPyBuildFlags = ["--mpicc=${openmpi}/bin/mpicc"];
buildInputs = [ openmpi ];
# Requires openssh for tests. Tests of dependent packages will also fail,
# if openssh is not present. E.g. h5py with mpi support.
propagatedBuildInputs = [ openssh ];
# hangs on some test so just disabled for now
doCheck = false;
meta = {
description =
"Python bindings for the Message Passing Interface standard";
homepage = "http://code.google.com/p/mpi4py/";
license = stdenv.lib.licenses.bsd3;
};
}

View File

@@ -0,0 +1,29 @@
{ stdenv, fetchFromBitbucket, cmake
, openmpi
, metis }:
stdenv.mkDerivation rec {
version = "4.0.3-p4";
name = "parmetis-${version}";
src = fetchFromBitbucket {
owner = "petsc";
repo = "pkg-parmetis";
rev = "v${version}";
sha256 = "088pzcyjgv1i8jbdznxnxy04cd8kk5y3a46vc7mh1na901s0msm2";
};
buildInputs = [
cmake
openmpi
metis
];
cmakeFlags = [ "-DGKLIB_PATH=../headers" ];
makeFlags = [ "VERBOSE=1" ];
meta = with stdenv.lib; {
homepage = "http://glaros.dtc.umn.edu/gkhome/metis/parmetis";
description = "An MPI-based parallel library that implements a variety of algorithms for partitioning unstructured graphs, meshes, and for computing fill-reducing orderings of sparse matrices.";
};
}

53
pkgs/firedrake/petsc.nix Normal file
View File

@@ -0,0 +1,53 @@
{ stdenv, callPackage, writeText, fetchFromGitHub, python, gfortran
, openmpi, blas, liblapack, hdf5, netcdf, eigen
, sowing, metis, hypre, parmetis, exodus }:
stdenv.mkDerivation rec {
version = "156a1856fd44f55220132393778f0fda1e6096e3";
name = "firedrake-petsc-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "petsc";
rev = "${version}";
sha256 = "1fmkd818idbiwbr6q9bmsxgwsc7igk13amfvb160llvsj32i93s9";
};
buildInputs = [
sowing
metis
parmetis
hypre
exodus
python
gfortran
openmpi
blas
liblapack
hdf5
netcdf
eigen
];
postPatch = "patchShebangs .";
configureFlags = [
"--with-sowing-dir=${sowing}"
"--with-hdf5-dir=${hdf5}"
"--with-netcdf-dir=${netcdf}"
"--with-metis-dir=${metis}"
"--with-parmetis-dir=${parmetis}"
"--with-hypre-dir=${hypre}"
"--with-exodusii-dir=${exodus}"
"--with-eign-dir=${eigen}"
"--with-64-bit-indices"
];
setupHook = writeText "setupHook.sh" "export PETSC_DIR=@out@";
meta = with stdenv.lib; {
homepage = "https://github.com/firedrakeproject/petsc";
description = "A suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.";
license = licenses.bsd2;
};
}

View File

@@ -0,0 +1,31 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, openmpi, hdf5, petsc }:
pythonPackages.buildPythonPackage rec {
version = "fbe23a494ab485f44f00ee37eee9f8be8dcd9eb5";
name = "firedrake-petsc4py-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "petsc4py";
rev = "${version}";
sha256 = "0172rgpyqh2ylr4wv4a79xfls8fbbdb86n4p6r7cx5kdy8d2y05b";
};
buildInputs = [
pythonPackages.cython
openmpi
hdf5
petsc
];
propagatedBuildInputs = [
pythonPackages.numpy
];
meta = with lib; {
homepage = "https://bitbucket.org/petsc/petsc4py/";
description = "Python bindings for PETSc.";
license = licenses.bsd2;
};
}

34
pkgs/firedrake/pulp.nix Normal file
View File

@@ -0,0 +1,34 @@
{ lib, fetchFromGitHub, pythonPackages
, glpk, cbc }:
pythonPackages.buildPythonPackage rec {
version = "1.6.4";
name = "PuLP-${version}";
src = fetchFromGitHub {
owner = "coin-or";
repo = "pulp";
rev = "${version}";
sha256 = "02i915ixrz66bpaka82j0x72kl76sr2b5xdx4ahwdlsffvmv9qnx";
};
buildInputs = [
glpk
cbc
];
propagatedBuildInputs = [
pythonPackages.pyparsing
];
postPatch = ''
sed -i -e 's|^CbcPath = .*$|CbcPath = ${cbc}/bin/cbc|' src/pulp/pulp.cfg.linux
sed -i -e 's|^GlpkPath = .*$|GlpkPath = ${glpk}/bin/glpsol|' src/pulp/pulp.cfg.linux
'';
meta = with lib; {
homepage = "https://github.com/coin-or/pulp";
description = "A python Linear Programming API.";
license = licenses.mit;
};
}

45
pkgs/firedrake/pyop2.nix Normal file
View File

@@ -0,0 +1,45 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, openmpi
, coffee, petsc, petsc4py, mpi4py }:
pythonPackages.buildPythonPackage rec {
version = "98aab7bbbab2945317c1b9ecf5885652cf20e709";
name = "PyOP2-${version}";
src = fetchFromGitHub {
owner = "OP2";
repo = "PyOP2";
rev = "${version}";
sha256 = "1hw8wpbfgw8j48jfhv72pxq33as2mkw9a9k2qg0607d77agjmpz5";
};
buildInputs = [
openmpi
pythonPackages.cython
pythonPackages.pytest
pythonPackages.flake8
pythonPackages.pycparser
petsc
];
propagatedBuildInputs = [
pythonPackages.six
pythonPackages.numpy
pythonPackages.decorator
mpi4py
coffee
petsc4py
];
postPatch = ''
sed -i -e 's|self\._cc = os\.environ\.get(ccenv, cc)|self._cc = '\'"$(type -p mpicxx)"\''' if cpp else '\'"$(type -p mpicc)"\'''|' pyop2/compilation.py
sed -i -e 's|self\._ld = os\.environ\.get('\'''LDSHARED'\''', ld)|self._ld = None|' pyop2/compilation.py
sed -i -e 's|os\.environ\['\'''PETSC_DIR'\'''\]|'\'''${petsc}'\'''|' pyop2/utils.py
'';
meta = with lib; {
homepage = "http://op2.github.io/PyOP2/";
description = "Framework for performance-portable parallel computations on unstructured meshes.";
license = licenses.bsd3;
};
}

23
pkgs/firedrake/sowing.nix Normal file
View File

@@ -0,0 +1,23 @@
{ stdenv, fetchFromBitbucket, ghostscript }:
stdenv.mkDerivation rec {
version = "1.1.25-p1";
name = "sowing-${version}";
src = fetchFromBitbucket {
owner = "petsc";
repo = "pkg-sowing";
rev = "v${version}";
sha256 = "0mpvq9jdavps5ljd2l1qngsyr96g2mp4ic21zf2bf80qvfjyanyw";
};
buildInputs = [
ghostscript
];
meta = with stdenv.lib; {
homepage = "https://bitbucket.org/petsc/pkg-sowing";
description = "Tools that are part of the petsc program development and maintenance environment.";
};
}

30
pkgs/firedrake/tsfc.nix Normal file
View File

@@ -0,0 +1,30 @@
{ lib, callPackage, fetchFromGitHub, pythonPackages
, coffee, ufl, fiat, finat }:
pythonPackages.buildPythonPackage rec {
version = "ee5670ab1ad90aaf8f550de01255c6752583255d";
name = "firedrake-tsfc-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "tsfc";
rev = "${version}";
sha256 = "07v5v1nhcywn2rpdr0380ck120ppzlvpfknmjh1rss6xkzf2s9lf";
};
propagatedBuildInputs = [
pythonPackages.numpy
pythonPackages.singledispatch
pythonPackages.six
coffee
ufl
fiat
finat
];
meta = with lib; {
homepage = "https://github.com/firedrakeproject/tsfc";
description = "Form compiler for the Firedrake project.";
license = licenses.gpl3;
};
}

24
pkgs/firedrake/ufl.nix Normal file
View File

@@ -0,0 +1,24 @@
{ lib, fetchFromGitHub, pythonPackages }:
pythonPackages.buildPythonPackage rec {
version = "8c17257d325f5f040ad1cb74b866956ad42427ca";
name = "firedrake-ufl-${version}";
src = fetchFromGitHub {
owner = "firedrakeproject";
repo = "ufl";
rev = "${version}";
sha256 = "1ryjq5sknaw92z3zrrnfqcvkga3g071bgjf8j42acsh4iw4g6yg1";
};
propagatedBuildInputs = [
pythonPackages.numpy
pythonPackages.six
];
meta = with lib; {
homepage = "https://github.com/firedrakeproject/ufl";
description = "Copy of upstream UFL for use with Firedrake.";
license = licenses.lgpl3;
};
}