Code Monkey home page Code Monkey logo

mumps.jl's Introduction

A Julia Interface to MUMPS

docs-stable docs-dev build-gh build-cirrus codecov doi

MUMPS is a libray for the solution of sparse linear systems on multicore computers. MUMPS implements methods based on the LDL or LU factorization of the input matrix and is suited to solving square symmetric or unsymmetric linear systems. MUMPS supports real and complex, single and double precision arithmetic.

How to Cite

If you use MUMPS.jl in your work, please cite using the format given in CITATION.cff

mumps.jl's People

Contributors

abelsiqueira avatar amontoison avatar dpo avatar guiburon avatar juliatagbot avatar jwscook avatar lruthotto avatar monssaftoukal avatar sbdntsbs avatar tmigot avatar wrs28 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mumps.jl's Issues

Complex systems

I'm trying to solve a sparse matrix system for an electromagnetic field finite element model and would like to use MUMPS via Julia. However, I need to solve complex matrix systems, and so far I can't get it to work. I noticed that in a previous discussion you had with lruthotto (when your code only worked for real matrices) you mentioned that modifying the code to work for complex systems would be relatively trivial, but I'm not having any luck so far. Before I continue to try and solve this issue I wanted to check whether you did modify your code to work for complex systems? It works superbly for real matrices, but I don't want to waste my time trying to figure out the problem if it simply will not work for complex systems at the moment. Many thanks!

Pkg.build without admin rights on Linux

I'm trying to install MUMPS on a shared workstation on which I don't have admin rights. Installing MUMPS using linuxbrew was not a problem, but Pkg.build fails with the following message

Installing dependency libmumps-dev via `sudo apt-get install libmumps-dev`:
sudo: no tty present and no askpass program specified
================================[ ERROR: MUMPS ]================================

LoadError: failed process: Process(`sudo apt-get install libmumps-dev`, ProcessExited(1)) [1]
while loading /home/lruthot/.julia/v0.4/MUMPS/deps/build.jl, in expression starting on line 53

================================================================================

This suggests that libmumps-dev needs to be installed via apt-get. This might be a naive question, but shouldn't libmumps-dev be installed by linuxbrew for me?

Missing finalize in solve function leading to MPI error

Hello,

Running this code,

using MPI
using MUMPS
using LinearAlgebra
using SparseArrays

n = 1_000
A = sprand(n, n, 0.1) + I
b = rand(eltype(A), n)

MPI.Init()

x = solve(A, b)

MPI.Finalize()

leads to this MPI error after completion:

mpiexec detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:

  Process name: [[26313,1],3]
  Exit code:    1

Tested on Linux with Julia 1.9 & 1.10, with local OpenMPI, OpenMPI_jll and MPICH_jll.

The similar example in the documentation does not lead to this error because the matrix A is reused after the solve, leading to proper garbage collection I guess?

using MUMPS, MPI, SparseArrays
using LinearAlgebra   # missing in the doc for norm()
MPI.Init()
A = sprand(10, 10, 0.2) + I
rhs = rand(10)
x = solve(A, rhs)
norm(x - A \ rhs) / norm(x)
MPI.Finalize()

I link a pull request fixing this issue. No performance delta seen for n = 10_000 on 4 proc.

Thanks for this great package!

Trouble solving unsymmetric system in serial

I have some trouble solving a moderately large numerically unsymmetric, structurally system without mpirun on OS X. The solve is part of an iterative procedure which works fine most of the time but fails undeterministically (when exactly it fails depends on whether the compiled julia code changes). Before the problem occurs, I check whether A*b can be computed, in order to verify that the matrix is structurally sound. Then, after entering the MUMPS analysis step, MUMPS reports zero density and zero structural symmetry. On some computers it doesn't even get that far and segfaults immediately, on others it continues, reporting a MUMPS error with INFO(1) = 1, reporting the number of nonzeros correctly. According to the MUMPS manual, this implies that the I, J - indices are out of range. However, if the matrix were broken, I would assume A*b to fail. Here is my solver code:

import MUMPS
import MPI

comm = MPI.COMM_WORLD

function solve_mumps(A::SparseMatrixCSC{Float64, Int}, b::Vector{Float64})
	if !MPI.Initialized()
		MPI.Init()
	end
	A*b
	warn("Success: $(nnz(A))")
	MPI.Barrier(comm)
	mumps = MUMPS.Mumps{Float64}(MUMPS.mumps_unsymmetric, MUMPS.get_icntl(ooc=true, verbose=true), MUMPS.default_cntl64)
	MUMPS.associate_matrix!(mumps, A)
	MUMPS.associate_rhs!(mumps, b)
	MPI.Barrier(comm)
	MUMPS.factorize!(mumps)
	MPI.Barrier(comm)
	MUMPS.solve!(mumps)
	MPI.Barrier(comm)
	x = MUMPS.get_solution(mumps)
	MUMPS.finalize(mumps)
	MPI.Barrier(comm)
	return vec(x)
end

The segmentation fault looks like this:

Entering DMUMPS 5.2.1 from C interface with JOB, N, NNZ =   4      569480       62978289
      executing #MPI =      1, without OMP

 =================================================
 MUMPS compiled with option -Dparmetis
 This MUMPS version includes code for SAVE_RESTORE
 =================================================
L U Solver for unsymmetric matrices
Type of parallelism: Working host

 ****** ANALYSIS STEP ********


signal (11): Segmentation fault: 11
in expression starting at ***/refine.jl:225
dmumps_ana_gnew_ at /usr/local/Cellar/brewsci-mumps/5.2.1/lib/libdmumps.dylib (unknown line)

All those Barriers were inserted in an attempt to fix the problem. Any ideas? My next step would be to extract the matrix and rhs, save them to HDF5 and to do tests on this matrix outside the main code, perhaps producing an MWE. However, I thought the error might be obvious, and therefore decided to ask first.

Calling OpenMPI_jll where it shouldn't be

Hi All,

I am running MUMPS.jl on a powerpc cluster, and have set my MPIPreferences to use the MPI library provided on the cluster (MPIPreferences.use_system_binary()). With this, I initialize my library with:

import MPI
MPI.Init()
import MUMPS
...

It seems to 'work', however it is incredibly slow and tends to break at some seemingly random instances. Some examples of breaking include:

  1. the warning Warning: The call to compilecache failed to create a usable precompiled cache file for 'X MODULE' for all my dependencies
  2. Internal errors where everything just crashes
  3. Everything freezes until my job runs out of time

At the start of my script, when I import MUMPS, I get the warning:

┌ Warning: Error requiring `OpenMPI_jll` from `MPI`
│   exception =
│    OpenMPI_jll cannot be loaded: MPI.jl is configured to use the system MPI library
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
...
│     [27] _start()
│        @ Base ./client.jl:522
└ @ Requires /nobackup/users/ihammond/.julia/packages/Requires/Z8rfN/src/require.jl:51

I'm unsure why there is any call to OpenMPI_jll at all, considering I have configured my MPIPreferences to use the system MPI binaries and have verified they are being used (the warning itself also verifies this). Do I need to configure MUMPS as well to know which MPI binaries I am using to solve my problem? Or do I have to compile MUMPS myself for my MPI build. I was under the impression that MUMPS.jl uses MPI.jl to access the MPI api, so I wouldn't need to compile MUMPS for my MPI build, but this may be my mistake.

Thanks,
Ian

Error on Windows

(@v1.8) pkg> st
Status `C:\Users\viral\.julia\environments\v1.8\Project.toml`
  [7db386b5] DependencyWalker v0.1.2
  [55d2b088] MUMPS v1.3.0
  [ca64183c] MUMPS_jll v5.5.1+1
⌃ [d7ed1dd3] MUMPS_seq_jll v5.5.1+0

julia> using MUMPS
[ Info: Precompiling MUMPS [55d2b088-9f4e-11e9-26c0-150b02ea6a46]
ERROR: LoadError: UndefVarError: libsmumps not defined
Stacktrace:
 [1] top-level scope
   @ C:\Users\viral\.julia\packages\MUMPS\VTKeP\src\interface.jl:21
 [2] include(mod::Module, _path::String)
   @ Base .\Base.jl:419
 [3] include(x::String)
   @ MUMPS C:\Users\viral\.julia\packages\MUMPS\VTKeP\src\MUMPS.jl:30
 [4] top-level scope
   @ C:\Users\viral\.julia\packages\MUMPS\VTKeP\src\MUMPS.jl:50
 [5] include
   @ .\Base.jl:419 [inlined]
 [6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base .\loading.jl:1554
 [7] top-level scope
   @ stdin:1
in expression starting at C:\Users\viral\.julia\packages\MUMPS\VTKeP\src\interface.jl:21
in expression starting at C:\Users\viral\.julia\packages\MUMPS\VTKeP\src\MUMPS.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile MUMPS [55d2b088-9f4e-11e9-26c0-150b02ea6a46] to C:\Users\viral\.julia\compiled\v1.8\MUMPS\jl_DC58.tmp.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base .\loading.jl:1705
 [3] compilecache
   @ .\loading.jl:1649 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base .\loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base .\loading.jl:1200
 [6] macro expansion
   @ .\loading.jl:1180 [inlined]
 [7] macro expansion
   @ .\lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:1144

Since julia-1.10 / OpenBLAS32-0.3.22 the number of threads must be explicitly specified

Since julia-1.10 a simple program like this one is very slow because only one CPU is used

# On a 32-core computer, uncomment next line to have 3200% CPU workload if julia version is > 1.9
# ENV["OPENBLAS_NUM_THREADS"]="32"

using Random, MUMPS, MPI, SparseArrays, LinearAlgebra
N = 10000
Nc = 1
Random.seed!(3)
A = sprand(N, N, 0.1) + I
rhs = rand(N, Nc)
x = Matrix{Float64}(undef, N, Nc)
MPI.Init()
mumps = Mumps{Float64}(mumps_unsymmetric, default_icntl, default_cntl64)
associate_matrix!(mumps, A)
t = @elapsed factorize!(mumps)
associate_rhs!(mumps, rhs)
solve!(mumps)
MUMPS.get_sol!(x, mumps)
finalize(mumps)
MPI.Finalize()
println("maximum error = ", maximum(abs.(A*x - rhs)), ", factorise time (s) = ", t)

No such problem with pinning OpenBLAS32_jll to 0.3.21: Pkg.add(name="OpenBLAS32_jll", version="0.3.21")

One solution is to set the environment variable for the desired number of threads: export OPENBLAS_NUM_THREADS=32

This can be done inside Julia: ENV["OPENBLAS_NUM_THREADS"]="32"

Status of Linux support

Hi Dominique,

we're looking to use MUMPS.jl on Linux systems. I was just wondering how Linux support is coming along and when we may expect it to be functioning.

Best regards,
Robert

Support Int64 indices

@dpo I am using MUMPS to solve a linear systems and I get this error:

ERROR: LoadError: InexactError: trunc(Int32, 2147580541)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Any, ::Int64) at ./boot.jl:567
 [2] checked_trunc_sint at ./boot.jl:589 [inlined]
 [3] toInt32 at ./boot.jl:626 [inlined]
 [4] Type at ./boot.jl:716 [inlined]
 [5] convert at ./number.jl:7 [inlined]
 [6] setindex! at ./array.jl:769 [inlined]
 [7] copyto!(::IndexLinear, ::Array{Int32,1}, ::IndexLinear, ::Array{Int64,1}) at ./abstractarray.jl:731
 [8] Type at ./abstractarray.jl:723 [inlined]
 [9] convert at ./array.jl:489 [inlined]
 [10] Type at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SparseArrays/src/sparsematrix.jl:365 [inlined]
 [11] convert at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/SparseArrays/src/sparsematrix.jl:430 [inlined]
 [12] associate_matrix!(::Mumps{Float64}, ::Array{Float64,2}) at /home/ubuntu/MUMPS.jl/src/MUMPS_lib.jl:58
 [13] getBLUPs(::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}, ::Array{Float64,2}, ::Int64, ::Int64, ::Array{Float64,2}, ::Array{Float64,2}) at /home/scripts/getBLUPs.jl:33
 [14] top-level scope at none:0
 [15] include at ./boot.jl:317 [inlined]
 [16] include_relative(::Module, ::String) at ./loading.jl:1041
 [17] include(::Module, ::String) at ./sysimg.jl:29
 [18] exec_options(::Base.JLOptions) at ./client.jl:229
 [19] _start() at ./client.jl:421
in expression starting at /home/scripts/getGEBVs.jl:35

The core of the script was:

### using MUMPS solver out-of-core (OOC)
        MPI.Init();
        mumps = Mumps{Float64}(mumps_unsymmetric, get_icntl(;det=true, verbose=true, ooc=true, itref=0), default_cntl64)
        associate_matrix!(mumps, C)
        factorize!(mumps)
        associate_rhs!(mumps, RHS)
        solve!(mumps)
        theta = get_solution(mumps)
        finalize(mumps)
        MPI.Finalize()

Btw Julia's solver \ works for the same problem.
The exact place the script failed was here associate_matrix!(mumps, C).

Thanks.

Uche.

Segmentation Fault when solving for many rhs

I'm getting a segmentation fault, when solving

  1. a small linear system with many (few thousands) rhs
  2. a large linear system with moderate number of rhs

Below is the example. It would be interesting to see if this works for other people.

On a side note, on my machine, inverting the large identity matrix take a lot of time in test number 2.

BTW: I'm using a Mac OS Yosemite (10.10.5) and julia version 0.4.6-pre+30

using Base.Test
using MUMPS
using MPI

root = 0;

# Initialize MPI.
MPI.Init()
comm = MPI.COMM_WORLD

mumps = Mumps{Float64}(mumps_symmetric, default_icntl, default_cntl64);

## test 1) small matrix, large number of rhs -->  fails
 n = 1000; nrhs = 100000 
## test 2) large matrix, moderate number of rhs --> also fails
# n = 139425; nrhs = 130;

A = speye(n)
rhs = randn(n,nrhs)
if MPI.Comm_rank(comm) == root
  associate_matrix(mumps, A);
  associate_rhs(mumps, copy(rhs));
end

factorize(mumps, A);
solve(mumps)
MPI.Barrier(comm)

if MPI.Comm_rank(comm) == root
  x = get_solution(mumps)
end
finalize(mumps);
@test norm(x-A\rhs)/norm(x) < 1e-8
MPI.Finalize()

MUMPs seg faults

When I solve multiple linear systems with mumps I often get seg faults. However, I cannot seem to produce a minimal example.

The error occurs after I call solve.

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
dmumps_sol_x_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_solve_driver_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_f77_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
Allocations: 33963192 (Pool: 32887682; Big: 1075510); GC: 707
[DN0a22b403:03259] *** Process received signal ***
[DN0a22b403:03259] Signal: Segmentation fault: 11 (11)
[DN0a22b403:03259] Signal code: Address not mapped (1)
[DN0a22b403:03259] Failing at address: 0x7fd8ee45b048
[DN0a22b403:03259] [ 0] 0   libsystem_platform.dylib            0x00007fff85ce252a _sigtramp + 26
[DN0a22b403:03259] [ 1] 0   libdmumps.dylib                     0x00000003145a97cf dmumps_sol_c_ + 13665
[DN0a22b403:03259] *** End of error message ***

signal (11): Segmentation fault: 11
while loading no file, in expression starting on line 0
dmumps_sol_x_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_solve_driver_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
dmumps_f77_ at /usr/local/Cellar/mumps/5.0.1_1/lib/libdmumps.dylib (unknown line)
Allocations: 33963192 (Pool: 32887682; Big: 1075510); GC: 707

solve() fails on OS X 10.10.1

Dear MUMPS.jl developers,

I encountered a problem using MUMPS.jl on a fresh install of OS X 10.10.1 when trying the example in the README:

julia> using MUMPS
julia> ierr = mumps_initialize_mpi();
MPI initialized with 1 processes
julia> A = sprand(10, 10, .2) + speye(10);
julia> rhs = rand(10);
julia> x = solve(A, rhs);   
all kinds of MUMPS output...

 GLOBAL TIME FOR MATRIX DISTRIBUTION       =      0.0001
 ** Memory relaxation parameter ( ICNTL(14)  )            :        20
 ** Rank of processor needing largest memory in facto     :         0
 ** Space in MBYTES used by this processor for facto      :         1
 ** Avg. Space in MBYTES per working proc during facto    :         1
dyld: lazy symbol binding failed: Symbol not found: _idamax_
  Referenced from: /Volumes/rgates/.julia/v0.3/Homebrew/deps/usr/lib/libdmumps.dylib
  Expected in: flat namespace

dyld: Symbol not found: _idamax_
  Referenced from: /Volumes/rgates/.julia/v0.3/Homebrew/deps/usr/lib/libdmumps.dylib
  Expected in: flat namespace

Trace/BPT trap: 5

This used to work fine on OS X 10.9. MUMPS was built using

brew install mumps --with-mpi --with-scotch5 --with-openblas

Best regards,

Robert

Can't install MUMPS on openmpi in Linux server

Hi @dpo

I have tried for several days without success to install MUMPS with openmpi dependencies.

The MPI.jl package does not work with openmpi even after:
export CC=which mpicc
export FC=which mpif90

  Building MPI → `~/.julia/packages/MPI/U5ujD/deps/build.log`
┌ Error: Error building `MPI`: 
│ -- The Fortran compiler identification is GNU 5.5.0
│ -- The C compiler identification is GNU 7.4.0
│ -- Check for working Fortran compiler: /usr/bin/mpif90
│ -- Check for working Fortran compiler: /usr/bin/mpif90  -- works
│ -- Detecting Fortran compiler ABI info
│ -- Detecting Fortran compiler ABI info - done
│ -- Checking whether /usr/bin/mpif90 supports Fortran 90
│ -- Checking whether /usr/bin/mpif90 supports Fortran 90 -- yes
│ -- Check for working C compiler: /usr/bin/mpicc
│ -- Check for working C compiler: /usr/bin/mpicc -- works
│ -- Detecting C compiler ABI info
│ -- Detecting C compiler ABI info - done
│ -- Detecting C compile features
│ -- Detecting C compile features - done
│ -- Found Git: /usr/bin/git (found version "2.7.4") 
│ -- Found MPI_C: /usr/lib/openmpi/lib/libmpi.so  
│ -- Found MPI_Fortran: /usr/lib/openmpi/lib/libmpi_usempif08.so;/usr/lib/openmpi/lib/libmpi_usempi_ignore_tkr.so;/usr/lib/openmpi/lib/libmpi_mpifh.so;/usr/lib/openmpi/lib/libmpi.so  
│ -- Detecting Fortran/C Interface
│ -- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
│ -- Looking for MPI_Comm_c2f
│ -- Looking for MPI_Comm_c2f - found
│ -- Configuring done
│ -- Generating done
│ -- Build files have been written to: /home/ubuntu/.julia/packages/MPI/U5ujD/deps/build
│ Scanning dependencies of target gen_constants
│ [ 11%] Building Fortran object CMakeFiles/gen_constants.dir/gen_constants.f90.o
│ /home/ubuntu/.julia/packages/MPI/U5ujD/deps/gen_constants.f90:43:43:
│ 
│    call output("MPI_NO_OP       ", MPI_NO_OP)
│                                            1
│ Error: Symbol ‘mpi_no_op’ at (1) has no IMPLICIT type
│ CMakeFiles/gen_constants.dir/build.make:62: recipe for target 'CMakeFiles/gen_constants.dir/gen_constants.f90.o' failed
│ make[2]: *** [CMakeFiles/gen_constants.dir/gen_constants.f90.o] Error 1
│ CMakeFiles/Makefile2:241: recipe for target 'CMakeFiles/gen_constants.dir/all' failed
│ make[1]: *** [CMakeFiles/gen_constants.dir/all] Error 2
│ Makefile:149: recipe for target 'all' failed
│ make: *** [all] Error 2
│ [ Info: Attempting to create directory /home/ubuntu/.julia/packages/MPI/U5ujD/deps/build
│ [ Info: Changing directory to /home/ubuntu/.julia/packages/MPI/U5ujD/deps/build
│ ERROR: LoadError: failed process: Process(`make`, ProcessExited(2)) [2]
│ Stacktrace:
│  [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
│  [2] pipeline_error at ./process.jl:705 [inlined]
│  [3] #run#504(::Bool, ::Function, ::Cmd) at ./process.jl:663
│  [4] run(::Cmd) at ./process.jl:661
│  [5] macro expansion at ./logging.jl:308 [inlined]
│  [6] run(::BinDeps.SynchronousStepCollection) at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│  [7] macro expansion at ./logging.jl:308 [inlined]
│  [8] run(::BinDeps.SynchronousStepCollection) at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│  [9] macro expansion at ./logging.jl:308 [inlined]
│  [10] run(::BinDeps.SynchronousStepCollection) at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│  [11] satisfy!(::BinDeps.LibraryDependency, ::Array{DataType,1}) at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/dependencies.jl:944
│  [12] satisfy!(::BinDeps.LibraryDependency) at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/dependencies.jl:922
│  [13] top-level scope at /home/ubuntu/.julia/packages/BinDeps/ZEval/src/dependencies.jl:977
│  [14] include at ./boot.jl:317 [inlined]
│  [15] include_relative(::Module, ::String) at ./loading.jl:1041
│  [16] include(::Module, ::String) at ./sysimg.jl:29
│  [17] include(::String) at ./client.jl:388
│  [18] top-level scope at none:0
│ in expression starting at /home/ubuntu/.julia/packages/MPI/U5ujD/deps/build.jl:54
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1069

However, the MPI package works with mpich and installs without any issues.

But running MUMPS.jl complains which I found out (from googling) to be due to linking to multiple mpi packages.

julia> using MUMPS

julia> using MPI

julia> # Initialize MPI.
       MPI.Init()

julia> comm = MPI.COMM_WORLD
MPI.Comm(1140850688)

julia> A = rand(1000,1000);

julia> b = rand(1000);

julia> x = solve(A, b)
*** The MPI_Comm_f2c() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[ip-10-62-0-4:42218] Local abort before MPI_INIT completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!

Please how do I resolve this. I am building something that will depend heavily on MUMPS.

Thanks.

Cannot build MUMPs on Mac

I tried to update and build failed. Error was could not load library "libsmumps.dylib", because it could not load /usr/local/opt/gcc/lib/gcc/11/libquadmath.0.dylib (although I do have /12/libquadmath.0.dylib). Occasionally homebrew packages expect a different gcc than what one might have. (I know how to install gcc11, but I don't know where libquadmath comes from.)

So I tried to build from source with brew reinstall -s mpich-mumps hoping it would find and link to the right library. It does download https://github.com/dpo/mumps_simple/archive/v0.4.tar.gz, but then fails here

==> Downloading http://mumps.enseeiht.fr/MUMPS_5.4.1.tar.gz
curl: (56) Recv failure: Connection reset by peer
Error: Failed to download resource "mpich-mumps"
Download failed: http://mumps.enseeiht.fr/MUMPS_5.4.1.tar.gz`

It seems that there is no such server mumps.enseeiht.fr, although there is one at graal.ens-lyon.fr with a newer version 5.5.1. However, it appears that you need to request a license from https://graal.ens-lyon.fr/MUMPS/index.php?page=dwnld. I haven't requested a license, because I wanted to ask if there's are other solutions. For example, is it possible to install 11/libquadmath.0.dylib, or is there a way to get a newer libsmumps.dylib that links to 12/libquadmath?

cannot build MUMPS in linux

Pkg.build("MUMPS")
    Building MPI ──→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/0bd36605eea7a4d9c3ae0d7f21c10210dd54cb83/build.log`
    Building MUMPS → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/75577f47d7b430e00a6eadb7cbdd1e4d5772500e/build.log`
ERROR: Error building `MUMPS`: 
ERROR: LoadError: ArgumentError: Package Libdl not found in current path:
- Run `import Pkg; Pkg.add("Libdl")` to install the Libdl package.

Then I add Libdl

(@v1.6) pkg> add Libdl
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.6/Project.toml`
  No Changes to `~/.julia/environments/v1.6/Manifest.toml`

Then build MUMPS again

(@v1.6) pkg> build MUMPS
    Building MPI ──→ `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/0bd36605eea7a4d9c3ae0d7f21c10210dd54cb83/build.log`
    Building MUMPS → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/75577f47d7b430e00a6eadb7cbdd1e4d5772500e/build.log`
ERROR: Error building `MUMPS`: 
ERROR: LoadError: ArgumentError: Package Libdl not found in current path:
- Run `import Pkg; Pkg.add("Libdl")` to install the Libdl package.

Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:893
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [3] top-level scope
   @ none:5
in expression starting at /home/maize/.julia/packages/MUMPS/PeP4P/deps/build.jl:1

The same thing happend.

Dense Schur complement?

Hi there,

I am trying to calculate the product $B^{-1}A$ using the Schur complement (both matrices are sparse). I've not been able to find any example, but got something to work after copying some code directly from mumps_schur_complement(A::AbstractArray, x) (I could not use it directly as the line mumps = Mumps(A) seem to throw errors).

N = size(B,1)
A_mumps = [sparse(B) A; -I spzeros(N,N)]
schur_inds = sparse([zeros(Int64,N); ones(Int64,N)]) # indices of A_{2,2} block?
MPI.Init()
mumps = Mumps{Float64}(mumps_unsymmetric, default_icntl, default_cntl64)
associate_matrix!(mumps, A_mumps)
# BEGIN COPIED LINES
MUMPS.suppress_display!(mumps)
MUMPS.set_icntl!(mumps, 8, 0) # turn scaling off, not used with schur anyway (suppresses warning message with schur)
MUMPS.mumps_schur_complement!(mumps, schur_inds)
S = MUMPS.get_schur_complement(mumps)
MUMPS.finalize!(mumps)
# END COPIED LINES
MPI.Finalize()

My issue is now that the computed Schur complement (S) seem to be returned as a dense matrix even though it is extremely sparse. Is there some input variable that I am missing, or does it simply always return a dense matrix?

Cheers,
Mikkel

bug - solving for multiple right-hand-sides

When I solve for multiple right-hand-sides I get an incorrect result after the first solve. See the following MWE:

using MUMPS
using MPI
using LinearAlgebra
using SparseArrays

MPI.Init()

icntl = get_icntl(verbose=false)

A = sprand(10, 10, .2) +  sparse(I, 10, 10)
mumps = Mumps{Float64}(mumps_unsymmetric, icntl, default_cntl64)
associate_matrix!(mumps, A)
factorize!(mumps)

for _ = 1:10
  rhs = rand(10)
  associate_rhs!(mumps, rhs)
  solve!(mumps)
  x = get_solution(mumps)
  println(norm(x - A \ rhs) / norm(x))
end

finalize(mumps)
MPI.Finalize()

output:

julia> 

7.447297301440223e-17
0.4924343334935974
0.7160770210505035
0.6776858374598822
0.6331079647874924
0.6580384625500728
0.4572616048461576
0.545888578220492
0.7025421228833388
0.5773467516678198

julia> 

My julia version is 1.8.3 on Ubuntu.

MPI_Comm_f2c

Hi, I am facing an error, but I can not find info about it....

% _mpirun -np 4 julia MUMPS.jl_                                        
*** The MPI_Comm_f2c() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.

% mpirun --version
HYDRA build details:
Version: 4.0.2
Release Date: Thu Apr 7 12:34:45 CDT 2022
CC: clang
Configure options: '--disable-option-checking' '--prefix=/opt/homebrew/Cellar/mpich/4.0.2' '--disable-dependency-tracking' '--enable-fast=all,O3' '--enable-g=dbg' '--enable-romio' '--enable-shared' '--with-pm=hydra' 'FC=gfortran-11' 'FCFLAGS=-fallow-argument-mismatch ' 'F77=gfortran-11' '--disable-silent-rules' '--mandir=/opt/homebrew/Cellar/mpich/4.0.2/share/man' 'FFLAGS=-fallow-argument-mismatch ' 'CC=clang' 'CXX=clang++' '--cache-file=/dev/null' '--srcdir=.' 'CFLAGS= ' 'LDFLAGS=' 'LIBS=' 'CPPFLAGS= '
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available: hwloc
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Demux engines available: poll select

Any ideas?
R

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Error building MUMPS

Since brew upgrade, MUMPS no longer builds in Julia.

tl;dr: update to openblas0.3.6 in homebrew seems not to have propagated to brewsci-mumps formula, breaking the Pkg.build("MUMPS")

The error message from the build log is

ERROR: LoadError: unable to locate libmumps_common.dylib... please install MUMPS or set MUMPS_PREFIX
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/wrs/.julia/packages/MUMPS/6EV6j/deps/build.jl:29
 [3] include at ./boot.jl:326 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1038
 [5] include(::Module, ::String) at ./sysimg.jl:29
 [6] include(::String) at ./client.jl:403
 [7] top-level scope at none:0
in expression starting at /Users/wrs/.julia/packages/MUMPS/6EV6j/deps/build.jl:23

I investigated build.jl and identified where the error occurred, which is in loading libmumps_common.dylib.

If I directly try to load the library in the REPL using Libdl.dlopen I get

ERROR: could not load library "/usr/local/opt/brewsci-mumps/lib/libmumps_comon.dylib"
dlopen(/usr/local/opt/brewsci-mumps/lib/libmumps_comon.dylib, 1): image not found

which is not terribly informative.

On the other hand, trying to load any of the other dylibs, such as libdmumps.dylib or the crucial libmumps_simple.dylib I get the error message

ERROR: could not load library "/usr/local/opt/brewsci-mumps/lib/libdmumps.dylib"
dlopen(/usr/local/opt/brewsci-mumps/lib/libdmumps.dylib, 1): Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.3.5.dylib
  Referenced from: /usr/local/opt/brewsci-mumps/lib/libdmumps.dylib
  Reason: image not found

The current openblas version from brew is v0.3.6 (which was released about 10 days ago), while it seems libZmumps is looking for v0.3.5.

It seems that the source of the error is in the build from Homebrew, but I'm not sure where to report that or how to fix it, so I'm reporting it here instead.

Using custom MPI communicator

Hi!

I need to use my own MPI communicator for MUMPS. I studied the constructors in src/mumps_struc.jl and found out it is not that straightforward to do if you want to keep the convenient constructor that set the real and integer parameters.

I added the optional argument comm::Integer = DEFAULT_FORTRAN_COMMUNICATOR to the constructor. When using a custom MPI.Comm, I pass its .val field to the constructor and everything works fine with MPICH_jll with Julia 1.10 on Linux. I link a PR to illustrate.

It appears more logs are printed by MUMPS though with the error INFO(1) = -3 INFO(2) = -2 output by the non-root MPI procs of my custom communicator when I finalize the solver. It does not seem to be an error though because the solver is actually called with job = -2 to finalize, the results are accurate and the CPU usage is as expected. With the default communicator, only the root proc seems to be logging so maybe the same "errors" happen in the background?

I am out of my depth here because I don't even know how MUMPS.jl works with this mysterious DEFAULT_FORTRAN_COMMUNICATOR. Am I doing things correctly?

Thanks.

Guillaume

Compile MUMPS with BLACS

Mail from the MUMPS team:

Bonjour Alexis,

Concernant BLACS et ScaLAPACK, ils peuvent en effet être utiles pour la performance lors du
traitement du dernier complément de Schur, quand on utilise du parallélisme MPI. S'ils ne sont pas installés,
MUMPS essaiera de trouver un peu de parallélisme aussi, mais sans utiliser du 2D block cyclique
et cela peut être un peu moins efficace.

Bonne journée,
le groupe MUMPS

undefined function

From convenience.jl, I call the function mumps_solve!(x::AbstractArray, mumps::Mumps, rhs::AbstractArray). There is the error UndefVarError: provide_rhs! not defined.

provide_rhs! is never defined in the module.

There are also other functions which call provide_rhs! and they do not work.

LoadError: None of the selected providers can install dependency libmumps_common.

When building MUMPS, I get the following error:

`==========================================[ ERROR: MUMPS ]==========================================

LoadError: None of the selected providers can install dependency libmumps_common.
Use BinDeps.debug(package_name) to see available providers

while loading C:\Users\username\AppData\Local\JuliaPro-0.6.4.1\pkgs-0.6.4.1\v0.6\MUMPS\deps\build.jl, i
n expression starting on line 39

====================================================================================================

==========================================[ BUILD ERRORS ]==========================================

WARNING: MUMPS had build errors.

  • packages with build errors remain installed in C:\Users\username\AppData\Local\JuliaPro-0.6.4.1\pkgs
    -0.6.4.1\v0.6
  • build the package(s) and all dependencies with Pkg.build("MUMPS")
  • build a single package by running its deps/build.jl script

====================================================================================================`

Any idea what I can do to get MUMPS to install correctly?

Incorporating MUMPS3

Opening new thread here, because we seem to be opening new topic from the original of JuliaSparse/MUMPS #21.

@dpo I just made some edits to MUMPS3 per your comments. It now links directly to 'lib[sdcz]mumps.dylib', without reference to mumps_simple.

Re: doing away with gc_haven. It depends on what you mean by "do away with". From the Julia docs:

If a C API will store a reference to memory allocated by Julia, after the ccall returns, you must arrange that the object remains visible to the garbage collector. The suggested way to handle this is to make a global variable of type Array{Ref,1} to hold these values, until the C library notifies you that it is finished with them.

If you don't have something like gc_haven, the garbage collection wreaks havoc (causing unreproducible behavior and seg faults) when you try to dereference any of the pointers that MUMPS uses. So the solution phase will work fine without this, but Julia might seg fault when you try to access the solution. That said, we can certainly do better than the previous implementation of gc_haven, which was very clunky.

The updates I just pushed take the suggestion of the Julia docs more literally, and greatly simplify handling the garbage collection from what it was. Now there is just a single Mumps structure with all the MUMPS fields, plus two more. One, called _finalized, is a boolean flag to keep track of whether the instance has been previously finalized, the other, _gc_haven, is an Array{Ref,1}. Because it is just an array of refs it wastes essentially no space, and because it is not a structure with its own fixed fields, the _gc_haven code will not need to be updated between versions of MUMPS. All told I think this is a big improvement.

Re: merging improvements with JSO/MUMPS: I'm all in, though I think ultimately there should only be one point of contact with MUMPS: it should be all mumps_simple or all native MUMPS C-API. Otherwise it will be hard to debug/maintain in the future, since some features will link to one custom dylib, and other features to a different set. It's just a lot of moving pieces. Thoughts? Obviously I'm partial to using the native MUMPS C-API.

Here's a sketch for merging:

  • decide how we want to interface with MUMPS
    • if mumps_simple, need to expand its capability before we can include new features, which doesn't seem ideal
  • merge capabilities that JSO/MUMPS does not yet have. This would be things like sparse rhs, Schur complement, select entries of the inverse. Since they do not have a predecessor in JSO/MUMPS, they should not conflict with anything, and should be easy to merge.
  • merge capabilities that JSO/MUMPS already has
    • identify which methods conflict between the two APIs. Upon examining both, decide which method name is more appropriate, giving priority to the previously existing one. In cases where the MUMPS3 method name/signature (or an entirely new one) is preferred, mark the old signature as deprecated so current users have time to adjust.
    • modify the underlying code to be consistent with either mumps_simple or C-API. The goal is to transition without the user even noticing that something has changed.
    • identify which methods do not conflict between the two APIs. I advocate including all such methods at first, since some of my current code in other projects depends on MUMPS3 :). Temporarily there might be two methods that achieve essentially the same thing. Since that doesn't actually break anyone's existing code, I advocate we leave the "trimming" for later.
    • trimming: if two methods do the same thing, decide which name/signature we want to keep, and transition the underlying code.

ERROR: UndefVarError: sym not defined

On both Julia 0.5 and 0.6, this bit of code from README.md results in an error:

julia> using MUMPS
julia> using MPI
julia> MPI.Init()
julia> A = sprand(10, 10, .2) + speye(10); rhs = rand(10);
julia> x = solve(A, rhs);
ERROR: UndefVarError: sym not defined
Stacktrace:
 [1] MUMPS.Mumps{Float64}(::Int64, ::Array{Int32,1}, ::Array{Float64,1}) at /Users/mpf/.julia/v0.6/MUMPS/src/MUMPS.jl:21
 [2] #solve#8(::Int64, ::Function, ::SparseMatrixCSC{Float64,Int64}, ::Array{Float64,1}) at /Users/mpf/.julia/v0.6/MUMPS/src/MUMPS_lib.jl:226
 [3] solve(::SparseMatrixCSC{Float64,Int64}, ::Array{Float64,1}) at /Users/mpf/.julia/v0.6/MUMPS/src/MUMPS_lib.jl:225

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.