Skip to content

solve falls with HYPRE #777

@yuiyuiui

Description

@yuiyuiui

Describe the bug 🐞

I want to use solve to solve a linear system with HYPREAlgorithm but saw error Attempting to use an MPI routine (internal_Comm_size) before initializing or after finalizing MPICH

Expected behavior

It's expected to return the solution of the linear system.

Minimal Reproducible Example 👇

In a temporary environment, run

import Pkg;
Pkg.add("HYPRE")
Pkg.add("LinearSolve")
Pkg.add("SciMLBase")
using HYPRE, LinearSolve, SciMLBase
using LinearAlgebra, Random, SparseArrays
Random.seed!(6)

function testf()
    n = 4
    T = Float64
    A = rand(T, n, n)
    b = rand(T, n)

    A_sparse = sparse(A)

    prob = SciMLBase.LinearProblem(A_sparse, b)
    alg = HYPREAlgorithm(HYPRE.PCG)
    prec = HYPRE.BoomerAMG
    return sol = solve(prob, alg; Pl=prec)
end

testf()

Environment (please complete the following information):

  [b5ffcf37] HYPRE v1.7.0
  [42fd0dbc] IterativeSolvers v0.9.4
  [7a12625a] LinearMaps v3.11.4
  [7ed4a6bd] LinearSolve v3.40.0
  [da04e1cc] MPI v0.20.23
  [0bca4576] SciMLBase v2.118.1
  [37e2e46d] LinearAlgebra v1.11.0
  [2f01184e] SparseArrays v1.11.0
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 14 × Apple M4 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 10 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions