Options for Sparse Distributed Linear Algebra

What is the current state of sparse distributed linear algebra in Julia?

I am interested in switching from C++ to Julia for finite element codes. In C PETSc seems to be the best option for sparse distributed linear algebra. I know PETSc is available as PETSc.jl, but I was curious if there is anything that uses native julia code.

I have found Julia has both Sparse and Darrays, could you have a DArray that is a distributed sparse array?

1 Like

GitHub - fverdugo/PartitionedArrays.jl: Vectors and sparse matrices partitioned into pieces for parallel distributed-memory computations. provides sparse distributed arrays compatible with native Julia iterative solvers, e.g. IterativeSolvers.jl.

(PETSc’s advantage is that it provides a lot of built-in preconditioners, and it is more mature in general, but is also a lot more constrained e.g. in the data types that it supports.)

3 Likes

The answer is yes

julia> DArray((10, 10)) do I
         sprandn(map(length, I)..., 0.2)
       end
10×10 DArray{Float64, 2, SparseMatrixCSC{Float64, Int64}}:
 -1.52489    0.0       -0.572173    0.0      0.0  0.0        0.0        0.0848087   0.0      0.0
  0.0        0.0        0.0         0.0      0.0  0.0        0.125291   0.0         0.0      0.0
  0.0        0.0        0.0         0.0      0.0  0.0        0.0       -0.663207    0.0      0.0
  0.0        0.0        0.0         0.0      0.0  0.0        0.0        0.0         0.0      0.0
  1.41673    0.0        0.0         0.0      0.0  0.202435   0.0        0.0         0.0      0.0
  0.0       -0.908404   0.0         0.0      0.0  0.0        0.0        0.0         1.28937  0.150807
  0.0        0.331869  -0.0888742   0.0      0.0  0.0        0.0        0.0         0.0      0.0
  0.0        0.0        0.0         0.0      0.0  0.0        0.0        0.0        -1.21831  0.0
 -2.76374    0.0        0.0         0.0      0.0  0.0       -0.419705   0.0         0.0      0.0
  0.344988   0.0       -0.451797   -1.21672  0.0  0.0        0.0        0.0         1.16045  0.0

but such a matrix will often end up hitting generic fallbacks which will be extremely slow so you’d probably be better off with the package that Steve links to.