slepc: init at 3.22.2 (#389678)

This commit is contained in:
Doron Behar
2025-03-18 15:23:50 +02:00
committed by GitHub
5 changed files with 196 additions and 22 deletions
+43 -20
View File
@@ -2,7 +2,6 @@
lib,
stdenv,
fetchzip,
cctools,
gfortran,
replaceVars,
python3,
@@ -12,21 +11,24 @@
zlib, # propagated by p4est but required by petsc
mpi, # generic mpi dependency
mpiCheckPhaseHook,
bash,
# Build options
petsc-optimized ? true,
petsc-scalar-type ? "real",
petsc-precision ? "double",
mpiSupport ? true,
withPetsc4py ? false, # petsc python binding
pythonSupport ? false, # petsc python binding
withExamples ? false,
withFullDeps ? false, # full External libraries support
withCommonDeps ? true, # common External libraries support
# External libraries options
withHdf5 ? true,
withMetis ? withFullDeps,
withParmetis ? false, # parmetis is unfree and should be enabled manualy
withPtscotch ? withFullDeps,
withHdf5 ? withCommonDeps,
withMetis ? withCommonDeps,
withScalapack ? withFullDeps,
withParmetis ? withFullDeps, # parmetis is unfree
withPtscotch ? withFullDeps,
withMumps ? withFullDeps,
withP4est ? withFullDeps,
@@ -40,6 +42,7 @@
pkg-config,
p4est,
}:
assert withFullDeps -> withCommonDeps;
# This version of PETSc does not support a non-MPI p4est build
assert withP4est -> (p4est.mpiSupport && mpiSupport);
@@ -69,7 +72,7 @@ stdenv.mkDerivation rec {
pkg-config
]
++ lib.optional mpiSupport mpi
++ lib.optionals withPetsc4py [
++ lib.optionals pythonSupport [
python3Packages.setuptools
python3Packages.cython
];
@@ -87,7 +90,7 @@ stdenv.mkDerivation rec {
++ lib.optional withScalapack scalapack
++ lib.optional withMumps mumps_par;
propagatedBuildInputs = lib.optional withPetsc4py python3Packages.numpy;
propagatedBuildInputs = lib.optional pythonSupport python3Packages.numpy;
patches = [
(replaceVars ./fix-petsc4py-install-prefix.patch {
@@ -95,14 +98,12 @@ stdenv.mkDerivation rec {
})
];
postPatch =
''
patchShebangs ./lib/petsc/bin
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace config/install.py \
--replace /usr/bin/install_name_tool ${cctools}/bin/install_name_tool
'';
postPatch = ''
patchShebangs ./lib/petsc/bin
substituteInPlace config/example_template.py \
--replace-fail "/usr/bin/env bash" "${bash}/bin/bash"
'';
configureFlags =
[
@@ -112,7 +113,7 @@ stdenv.mkDerivation rec {
"--with-precision=${petsc-precision}"
"--with-mpi=${if mpiSupport then "1" else "0"}"
]
++ lib.optional withPetsc4py "--with-petsc4py=1"
++ lib.optional pythonSupport "--with-petsc4py=1"
++ lib.optionals mpiSupport [
"--CC=mpicc"
"--with-cxx=mpicxx"
@@ -163,7 +164,7 @@ stdenv.mkDerivation rec {
"fortify3"
];
configureScript = "python ./configure";
installTargets = [ (if withExamples then "install" else "install-lib") ];
enableParallelBuilding = true;
@@ -173,10 +174,31 @@ stdenv.mkDerivation rec {
# the library is installed and available.
doInstallCheck = true;
installCheckTarget = "check_install";
nativeInstallCheckInputs = [ mpiCheckPhaseHook ];
# The PETSC4PY=no flag disables the ex100 test,
# which compiles C code to load Python modules for solving a math problem.
# This test fails on the Darwin platform but is rarely a common use case for petsc4py.
installCheckFlags = lib.optional stdenv.hostPlatform.isDarwin "PETSC4PY=no";
nativeInstallCheckInputs =
[
mpiCheckPhaseHook
]
++ lib.optionals pythonSupport [
python3Packages.pythonImportsCheckHook
python3Packages.unittestCheckHook
];
unittestFlagsArray = [
"-s"
"src/binding/petsc4py/test"
"-v"
];
pythonImportsCheck = [ "petsc4py" ];
passthru = {
inherit mpiSupport;
inherit mpiSupport pythonSupport;
};
setupHook = ./setup-hook.sh;
@@ -185,6 +207,7 @@ stdenv.mkDerivation rec {
description = "Portable Extensible Toolkit for Scientific computation";
homepage = "https://petsc.org/release/";
license = licenses.bsd2;
platforms = lib.platforms.unix;
maintainers = with maintainers; [
cburstedde
qbisi
+119
View File
@@ -0,0 +1,119 @@
{
lib,
stdenv,
fetchFromGitLab,
sowing,
python3,
python3Packages,
arpack-mpi,
petsc,
mpi,
mpiCheckPhaseHook,
pythonSupport ? false,
withExamples ? false,
withArpack ? stdenv.hostPlatform.isLinux,
}:
assert petsc.mpiSupport;
assert pythonSupport -> petsc.pythonSupport;
stdenv.mkDerivation (finalAttrs: {
pname = "slepc";
version = "3.22.2";
src = fetchFromGitLab {
owner = "slepc";
repo = "slepc";
tag = "v${finalAttrs.version}";
hash = "sha256-a5DmsA7NAlhrEaS43TYPk7vtDfhXLEP+5sftu2A9Yt4=";
};
postPatch = ''
# Fix slepc4py install prefix
substituteInPlace config/packages/slepc4py.py \
--replace-fail "slepc.prefixdir,'lib'" \
"slepc.prefixdir,'${python3.sitePackages}'"
patchShebangs lib/slepc/bin
# Use system bfort
substituteInPlace config/packages/sowing.py \
--replace-fail "bfort = os.path.join(archdir,'bin','bfort')" \
"bfort = '${sowing}/bin/bfort'"
'';
# Usually this project is being built as part of a `petsc` build or as part of
# other projects, e.g when `petsc` is `./configure`d with
# `--download-slepc=1`. This instructs the slepc to be built as a standalone
# project.
preConfigure = ''
export SLEPC_DIR=$PWD
'';
nativeBuildInputs =
[
python3
]
++ lib.optionals pythonSupport [
python3Packages.setuptools
python3Packages.cython
];
configureFlags =
lib.optionals withArpack [
"--with-arpack=1"
]
++ lib.optionals pythonSupport [
"--with-slepc4py=1"
];
buildInputs =
[
mpi
]
++ lib.optionals withArpack [
arpack-mpi
];
propagatedBuildInputs = [
petsc
];
enableParallelBuilding = true;
installTargets = [ (if withExamples then "install" else "install-lib") ];
nativeInstallCheckInputs =
[
mpiCheckPhaseHook
]
++ lib.optionals pythonSupport [
python3Packages.pythonImportsCheckHook
python3Packages.unittestCheckHook
];
doInstallCheck = true;
installCheckTarget = [ "check_install" ];
unittestFlagsArray = [
"-s"
"src/binding/slepc4py/test"
"-v"
];
pythonImportsCheck = [ "slepc4py" ];
shellHook = ./setup-hook.sh;
meta = {
description = "Scalable Library for Eigenvalue Problem Computations";
homepage = "https://slepc.upv.es";
changelog = "https://gitlab.com/slepc/slepc/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = with lib.licenses; [
bsd2
];
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ qbisi ];
# Possible error running Fortran src/eps/tests/test7f with 1 MPI process
broken = stdenv.hostPlatform.isDarwin && withArpack;
};
})
+1
View File
@@ -0,0 +1 @@
export SLEPC_DIR=@out@
+25
View File
@@ -0,0 +1,25 @@
{
lib,
stdenv,
fetchFromBitbucket,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sowing";
version = "1.1.26.12";
src = fetchFromBitbucket {
owner = "petsc";
repo = "pkg-sowing";
rev = "v${finalAttrs.version}";
hash = "sha256-ol0xNAnL7ULU1CiGCFZrV37IAV4z1bcWa0f+tuMhQC8=";
};
meta = {
description = "Tools for documenting and improving portability";
homepage = "https://wgropp.cs.illinois.edu/projects/software/sowing/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ qbisi ];
platforms = lib.platforms.unix;
};
})
+8 -2
View File
@@ -10504,8 +10504,7 @@ self: super: with self; {
petsc4py = toPythonModule (pkgs.petsc.override {
python3 = python;
python3Packages = self;
withPetsc4py = true;
withFullDeps = true;
pythonSupport = true;
});
pex = callPackage ../development/python-modules/pex { };
@@ -15351,6 +15350,13 @@ self: super: with self; {
sleepyq = callPackage ../development/python-modules/sleepyq { };
slepc4py = toPythonModule (pkgs.slepc.override {
pythonSupport = true;
python3 = self.python;
python3Packages = self;
petsc = petsc4py;
});
sleqp = toPythonModule (pkgs.sleqp.override { pythonSupport = true; python3Packages = self; });
slicedimage = callPackage ../development/python-modules/slicedimage { };