python312Pacakges.fenics-dolfinx: init at 0.9.0.post1 (#404613)

This commit is contained in:
Nick Cao
2025-05-08 20:16:45 -04:00
committed by GitHub
7 changed files with 431 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
bzip2
lz4
c-blosc2
hdf5-mpi
(hdf5-mpi.override { inherit mpi; })
libfabric
libpng
libsodium

View File

@@ -0,0 +1,114 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
spdlog,
pugixml,
boost,
petsc,
slepc,
kahip,
adios2,
python3Packages,
catch2_3,
withParmetis ? false,
}:
let
dolfinxPackages = petsc.petscPackages.overrideScope (
final: prev: {
slepc = final.callPackage slepc.override { };
adios2 = final.callPackage adios2.override { };
kahip = final.callPackage kahip.override { };
}
);
in
stdenv.mkDerivation (finalAttrs: {
version = "0.9.0.post1";
pname = "dolfinx";
src = fetchFromGitHub {
owner = "fenics";
repo = "dolfinx";
tag = "v${finalAttrs.version}";
hash = "sha256-4IIx7vUZeDwOGVdyC2PBvfhVjrmGZeVQKAwgDYScbY0=";
};
preConfigure = ''
cd cpp
'';
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
dolfinxPackages.kahip
dolfinxPackages.scotch
] ++ lib.optional withParmetis dolfinxPackages.parmetis;
propagatedBuildInputs = [
spdlog
pugixml
boost
petsc
dolfinxPackages.hdf5
dolfinxPackages.slepc
dolfinxPackages.adios2
python3Packages.fenics-basix
python3Packages.fenics-ffcx
];
cmakeFlags = [
(lib.cmakeBool "DOLFINX_ENABLE_ADIOS2" true)
(lib.cmakeBool "DOLFINX_ENABLE_PETSC" true)
(lib.cmakeBool "DOLFIN_ENABLE_PARMETIS" withParmetis)
(lib.cmakeBool "DOLFINX_ENABLE_SCOTCH" true)
(lib.cmakeBool "DOLFINX_ENABLE_SLEPC" true)
(lib.cmakeBool "DOLFINX_ENABLE_KAHIP" true)
(lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
];
passthru.tests = {
unittests = stdenv.mkDerivation {
pname = "${finalAttrs.pname}-unittests";
inherit (finalAttrs) version src;
preConfigure = ''
cd cpp/test
'';
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [ finalAttrs.finalPackage ];
nativeCheckInputs = [ catch2_3 ];
doCheck = true;
installPhase = ''
touch $out
'';
};
};
meta = {
homepage = "https://fenicsproject.org";
downloadPage = "https://github.com/fenics/dolfinx";
description = "Computational environment of FEniCSx and implements the FEniCS Problem Solving Environment in C++ and Python";
changelog = "https://github.com/fenics/dolfinx/releases/tag/${finalAttrs.src.tag}";
license = with lib.licenses; [
bsd2
lgpl3Plus
];
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ qbisi ];
};
})

View File

@@ -78,6 +78,8 @@ let
petscPackages = lib.makeScope newScope (self: {
inherit
mpi
python3
python3Packages
# global override options
mpiSupport
fortranSupport

View File

@@ -0,0 +1,81 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
scikit-build-core,
nanobind,
cmake,
ninja,
pkg-config,
blas,
lapack,
numpy,
sympy,
scipy,
matplotlib,
fenics-ufl,
pytest-xdist,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "fenics-basix";
version = "0.9.0";
pyproject = true;
src = fetchFromGitHub {
owner = "fenics";
repo = "basix";
tag = "v${version}";
hash = "sha256-jLQMDt6zdl+oixd5Qevn4bvxBsXpTNcbH2Os6TC9sRQ=";
};
dontUseCmakeConfigure = true;
build-system = [
scikit-build-core
nanobind
];
nativeBuildInputs = [
cmake
ninja
pkg-config
];
dependencies = [
numpy
];
buildInputs = [
blas
lapack
];
# Prefer finding BLAS and LAPACK via pkg-config.
# Avoid using the Accelerate.framework from the Darwin SDK.
# Also, avoid mistaking BLAS for LAPACK.
env.CMAKE_ARGS = lib.cmakeBool "BLA_PREFER_PKGCONFIG" true;
pythonImportsCheck = [
"basix"
];
nativeCheckInputs = [
sympy
scipy
matplotlib
fenics-ufl
pytest-xdist
pytestCheckHook
];
meta = {
homepage = "https://fenicsproject.org";
downloadPage = "https://github.com/fenics/basix";
description = "Finite element definition and tabulation runtime library";
changelog = "https://github.com/fenics/basix/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ qbisi ];
};
}

View File

@@ -0,0 +1,157 @@
{
lib,
stdenv,
toPythonModule,
fetchFromGitHub,
buildPythonPackage,
# build-system
scikit-build-core,
nanobind,
# nativeBuildInputs
cmake,
ninja,
pkg-config,
# buildInputs
dolfinx,
# dependency
numpy,
cffi,
mpi4py,
petsc4py,
slepc4py,
adios2,
kahip,
fenics-ffcx,
fenics-basix,
fenics-ufl,
# nativeCheckInputs
scipy,
matplotlib,
pytest-xdist,
pytestCheckHook,
writableTmpDirAsHomeHook,
mpiCheckPhaseHook,
# custom options
withParmetis ? false,
# passthru.tests
fenics-dolfinx,
mpich,
}:
let
fenicsPackages = petsc4py.petscPackages.overrideScope (
final: prev: {
slepc = final.callPackage slepc4py.override { };
adios2 = final.callPackage adios2.override { };
kahip = final.callPackage kahip.override { };
dolfinx = final.callPackage dolfinx.override { inherit withParmetis; };
}
);
in
buildPythonPackage rec {
inherit (dolfinx)
version
src
;
pname = "fenics-dolfinx";
pyproject = true;
pythonRelaxDeps = [
"cffi"
"fenics-ufl"
];
preConfigure = ''
cd python
'';
dontUseCmakeConfigure = true;
build-system = [
scikit-build-core
nanobind
];
nativeBuildInputs = [
cmake
ninja
pkg-config
fenicsPackages.mpi
];
buildInputs = [
fenicsPackages.dolfinx
];
dependencies = [
numpy
cffi
fenics-basix
fenics-ffcx
fenics-ufl
petsc4py
fenicsPackages.slepc
fenicsPackages.adios2
fenicsPackages.kahip
(mpi4py.override { inherit (fenicsPackages) mpi; })
];
doCheck = true;
nativeCheckInputs = [
scipy
matplotlib
pytest-xdist
pytestCheckHook
writableTmpDirAsHomeHook
mpiCheckPhaseHook
];
preCheck = ''
rm -rf dolfinx
'';
pythonImportsCheck = [
"dolfinx"
];
disabledTests = [
# require cffi<1.17
"test_cffi_expression"
"test_hexahedron_mesh"
];
passthru = {
tests =
{
complex = fenics-dolfinx.override {
petsc4py = petsc4py.override { scalarType = "complex"; };
};
}
// lib.optionalAttrs stdenv.hostPlatform.isLinux {
mpich = fenics-dolfinx.override {
petsc4py = petsc4py.override { mpi = mpich; };
};
};
};
meta = {
homepage = "https://fenicsproject.org";
downloadPage = "https://github.com/fenics/dolfinx";
description = "Computational environment of FEniCSx and implements the FEniCS Problem Solving Environment in C++ and Python";
changelog = "https://github.com/fenics/dolfinx/releases/tag/${src.tag}";
license = with lib.licenses; [
bsd2
lgpl3Plus
];
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ qbisi ];
};
}

View File

@@ -0,0 +1,70 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
setuptools,
numpy,
cffi,
fenics-ufl,
fenics-basix,
sympy,
numba,
pytestCheckHook,
addBinToPathHook,
}:
buildPythonPackage rec {
pname = "fenics-ffcx";
version = "0.9.0";
pyproject = true;
src = fetchFromGitHub {
owner = "fenics";
repo = "ffcx";
tag = "v${version}";
hash = "sha256-eAV//RLbrxyhqgbZ2DiR7qML7xfgPn0/Seh+2no0x8w=";
};
pythonRelaxDeps = [
"fenics-ufl"
];
build-system = [
setuptools
];
dependencies = [
numpy
cffi
setuptools
fenics-ufl
fenics-basix
];
pythonImportsCheck = [
"ffcx"
];
nativeCheckInputs = [
sympy
numba
pytestCheckHook
addBinToPathHook
];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=unused-command-line-argument";
meta = {
homepage = "https://fenicsproject.org";
downloadPage = "https://github.com/fenics/ffcx";
description = "FEniCSx Form Compiler";
changelog = "https://github.com/fenics/ffcx/releases/tag/${src.tag}";
mainProgram = "ffcx";
license = with lib.licenses; [
unlicense
lgpl3Plus
];
maintainers = with lib.maintainers; [ qbisi ];
};
}

View File

@@ -4859,6 +4859,12 @@ self: super: with self; {
fenics = callPackage ../development/python-modules/fenics { hdf5 = pkgs.hdf5_1_10; };
fenics-basix = callPackage ../development/python-modules/fenics-basix { };
fenics-dolfinx = callPackage ../development/python-modules/fenics-dolfinx { };
fenics-ffcx = callPackage ../development/python-modules/fenics-ffcx { };
fenics-ufl = callPackage ../development/python-modules/fenics-ufl { };
ffcv = callPackage ../development/python-modules/ffcv { };