# Distributed eigensolvers for computing eigenpairs of large sparse matrices

**URL:** <https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648>\
**Category:** Numerics\
**Tags:** question, package, parallel, distributed, eigenvalues\
**Created:** [March 29, 2022, 2:46am UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648 "2022-03-29T02:46:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://discourse.julialang.org/u/Neo)\
**Post date:** [March 29, 2022, 2:46am UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/1 "2022-03-29T02:46:32Z")

</div>

Hi folks,

I implemented a distributed method in Julia for computing smallest eigenvalues and the corresponding eigenvectors of large sparse (symmetric) matrices. I wanted to compare my implementation with a baseline eigensolver in Julia. However, I failed to find an eigensolver in Julia community for computing eigenpairs of large and sparse matrices. I found many packages like:

LinearAlgebra,  
Arpack,  
KrylovKit,  
IterativeSolver,  
Elemental.

But none of them has the eigensolver I want. Some eigensolvers in Elemental.jl could would for distributed arrays/matrices, e.g., eigHermitian, but it seems they do not work for distributed sparse matrices.

Could anyone tell me if there is such an eigensolver in Julia community? Which package? It’d be better with some examples.

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 29, 2022, 6:53am UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/2 "2022-03-29T06:53:39Z")

</div>

Hi,

This is very nice! How did you define the sparse distributed matrix?

I have never done it but in principle, you could use KrylovKit on a linear mapping (e.g. a function) which accepts a distributed vector.

> But none of them has the eigensolver I want.

which is?

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [March 29, 2022, 8:28am UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/3 "2022-03-29T08:28:06Z")

</div>

If your matrices do not find on the memory of one node, I think your best option is to use SLEPc. There is [SlepcWrap.jl](https://github.com/bmxam/SlepcWrap.jl) to provide some interface from Julia, but you’ll need to compile PETSc and SLEPc on the cluster you’re using yourself. It doesn’t have great usability, but I think it’s the most complete option when it comes to large, distributed memory, and sparse eigen solvers. Maybe in the future there will be something more convenient written in Julia…

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://discourse.julialang.org/u/Neo)\
**Post date:** [March 29, 2022, 7:14pm UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/4 "2022-03-29T19:14:59Z")

</div>

Hi,

A sparse distributed matrix here means a large sparse matrix stored in distributed memory. For example, you could divide all the rows into several blocks and store each row block separately. KrylovKit accepts a distributed vector but I don’t know if it could still work is each part of the distributed vector is sparse. But thanks for you advice, I will give it a try.

---

<div class="post-metadata">

**Author:** ![Neo](https://avatars.discourse-cdn.com/v4/letter/n/9fc348/32.png) [@Neo](https://discourse.julialang.org/u/Neo)\
**Post date:** [March 29, 2022, 7:34pm UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/5 "2022-03-29T19:34:02Z")

</div>

Thanks for your advice. SlepcWrap.jl looks like a potential solution to my problem. I’ll give it a shot.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 29, 2022, 8:24pm UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/6 "2022-03-29T20:24:40Z")

</div>

> [@Neo](#):
>
> KrylovKit accepts a distributed vector but I don’t know if it could still work is each part of the distributed vector is sparse.

I think KrylovKit (and several of the others) should work for any distributed-vector type as long as it defines the requisite linear-algebra (basically just ±, scaling, `dot`, and `norm`)?

(Implementing a distributed matrix–vector product is up to you; one package for this is [PartitionedArrays.jl](https://github.com/fverdugo/PartitionedArrays.jl).)

---

<div class="post-metadata">

**Author:** ![Lightup1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lightup1/32/35410_2.png) [@Lightup1](https://discourse.julialang.org/u/Lightup1)\
**Post date:** [September 28, 2022, 11:36am UTC](https://discourse.julialang.org/t/distributed-eigensolvers-for-computing-eigenpairs-of-large-sparse-matrices/78648/7 "2022-09-28T11:36:55Z")

</div>

How about a dense matrix? Is there a similar package for a dense matrix?
