Unverified Commit 31fe2eb2 authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

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

parents d53a0ca3 2bbc507c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
      bzip2
      lz4
      c-blosc2
      hdf5-mpi
      (hdf5-mpi.override { inherit mpi; })
      libfabric
      libpng
      libsodium
+114 −0
Original line number Diff line number Diff line
{
  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 ];
  };
})
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ let
  petscPackages = lib.makeScope newScope (self: {
    inherit
      mpi
      python3
      python3Packages
      # global override options
      mpiSupport
      fortranSupport
+81 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
+157 −0
Original line number Diff line number Diff line
{
  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 ];
  };
}
Loading