-
-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ARPACK #551
Comments
The software from the paper:
|
I'll take a look at the LOPSI code. I doubt that it is a good idea to include it, though. I don't know what it does and it is not maintained. |
LOPSI has a bug when multiple eigenvalues/vectors are requested, according to "An Evaluation of Software for Computing Eigenvalues of Sparse Nonsymmetric Matrices". The SRRIT code is also available, actually, and they say it is good for multiple/clustered eigenvalues, but it is very slow. So maybe we could just use LOPSI as a default if a single eigenvalue/vector is needed, with optional support for SRRIT. |
Btw, there are problems even with the symmetric ARPACK solver: #589. |
The ARPACK Fortran code in rARPACK seems to work better, so it is worth just trying to take their ARPACK version. |
Also, http://www.math.uri.edu/~jbaglama/ has some Matlab code irlba is based on, so it is better to rewrite the original Matlab code into C. They also have a non-symmetric solver. The code is fairly involved, though. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
FEAST now supports non-symmetric problems, and seems like a realistic alternative. http://www.feast-solver.org/ |
The one I linked to appears to be BSD-licensed and presumably portable Fortran code. |
It seems promising, but FEAST does not seem to work on macOS (Apple M1) yet; I tried this in the $ make ARCH=x64 F90=gfortran MKL=no feast
gfortran -O3 -fopenmp -ffree-line-length-none -ffixed-line-length-none -cpp -c /Users/tamas/Downloads/FEAST/4.0/src/kernel/dzfeast.f90 -o /Users/tamas/Downloads/FEAST/4.0/src/kernel/dzfeast.o
/Users/tamas/Downloads/FEAST/4.0/src/kernel/dzfeast.f90:917:82:
650 | call DGEMM('T','N',fpm(23),fpm(23),N,-DONE,work,N,q,N,DZERO,Aq,M0) ! projection
| 2
......
917 | call DGEMM('N','N',N,fpm(25),fpm(23),DONE,work(1,1),N,Aq(1,fpm(24)),M0,DZERO,workc(1,fpm(24)),N)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(8)/REAL(8)).
/Users/tamas/Downloads/FEAST/4.0/src/kernel/dzfeast.f90:944:87:
839 | call DLACPY( 'F', fpm(23), fpm(23),Bq, M0, Bqo, fpm(23) )
| 2
......
944 | if ((fpm(5)==1).and.(loop==0)) call DLACPY( 'F', N, fpm(25),work(1,fpm(24)) , N, workc(1,fpm(24)), N )
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(8)/REAL(8)).
make: *** [/Users/tamas/Downloads/FEAST/4.0/src/kernel/dzfeast.o] Error 1 The default |
I did wonder about compatibility with arm64, precisely because of the association with Intel, so I checked if MacPorts has arm64 binaries, and it does: https://ports.macports.org/port/feast/details/ They don't seem to use any obvious patches either: https://github.com/macports/macports-ports/blob/master/math/feast/Portfile I can try to take a look at how it works another day, but not now. |
@ntamas MacPorts uses the gfortran option |
Here's a recent paper comparing various eigensolvers: https://n.ethz.ch/~gtzounas/pap/eigmethods.pdf Summary of features: Based on this table, we should investigate SLEPc and z-PARES. We absolutely need:
|
SLEPc appears to be designed for massively parallel use, with MPI. It's unclear if it's also realistic for solving smaller problems without parallelization, and whether it can be compiled with MPI. If not, that would be a dealbreaker. Looking at how this is packaged in MacPorts, SLEPc depends on PETSc, which depends on MPI and BLAS/LAPACK, so there are not a lot of dependencies (apart from MPI), but it may still be a heavyweight, too large to vendor. It seems that this might be buildable without Fortran, but it's not completely clear. Refs:
License is BSD. Last release in 2023, it's actively developed. Update: From https://petsc.org/release/install/install/#external-packages :
Presumably the same applies to SLEPc. Still, it looks like a heavyweight. The question is if it can be made small enough when we only need the eigensolver. |
z-PARES is also focused on parallelization with MPI, but it is stated on their homepage that serial operation is also supported. It is written in Fortran 90/95, so it cannot be f2c'd. First and last release both in 2014, which is not encouraging. |
It seems like adopting FEAST would basically mean committing ourselves to requiring a Fortran compiler at build time; FEAST does not seem to be packaged in Debian/Ubuntu yet and it has no formula in Homebrew either (but it's at least in MacPorts). SLEPc has Ubuntu packages, but it depends on ARPACK so I wonder whether we would gain anything by switching to SLEPc if the ultimate goal is to get rid of ARPACK. I'd dismiss z-PARES as well due to lack of development activity. |
It seems to me that all ARPACK alternatives come with significant drawbacks, and none are realistically vendorable. Replacement doesn't seem to make sense in the short term. But it may be a good to think about paving the way, i.e. making the interface such that multiple eigensolver back-ends could be supported. For now I'd just consider how such an interface would look like, but I wouldn't put too much time into it. I consider it an important feature of igraph that it can be compiled without external dependencies, i.e. that all critical dependencies are vendored. We need to keep a close relationship to our true userbase, which is researchers, not software developers. |
There is also https://spectralib.org/ Spectra claims to re-implement the algorithms of ARPACK as a header-only C++ library. It depends only on Eigen. It seems to support the operations we need. Reasons against using it:
|
There are more features that ARPACK provides that we rely on, and should be available in any replacement library. For example, ARPACK allows for finding the eigenvalue with the largest real part, instead of the largest magnitude. We rely on this for PageRank to find the eigenvector corresponding to the eigenvalue Having a common interface to multiple solvers may be problematic, as selecting the desired eigenvalue would be achieved in a different manner with each. It is more realistic to look for libraries that implement the same algorithm as ARPACK, or related algorithms, and are preferably written in C without heavy dependencies. Spectra would be a candidate if it didn't have the Eigen dependency. |
Another candidate is ANASAZI, see https://github.com/trilinos/Trilinos/tree/master/packages/anasazi and https://trilinos.github.io/anasazi.html It seems like it provides most features we need: symmetric and non-symmetric problems, the same kind of eigenvalue selection as ARPACK, written in C++. It's not entirely clear if it can be made dependency-free, but it looks promising. It should be possible to operate with the graph data structure directly (like ARPACK's reverse communication interface):
However, it may be more trouble to set it up:
These quotes are from the paper, https://doi.org/10.1145/1527286.1527287 More info: https://docs.trilinos.org/dev/packages/anasazi/doc/html/index.html It appears to continue to be maintained, though at a minimal level. |
CRAN is now coming after us because ARPACK doesn't pass the new Mainly this is due to the usage of "old-style character vectors":
Link: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-gcc/igraph-00install.html . I'm trying to push the current release despite the warning, let's see. We do need a solution at some point, though. I've found https://bitbucket.org/chaoyang2013/arpack/src/master/, but no commits in the last two years. Do we patch in-place, or try to upstream? |
This is an R/igraph-specific issue (and ARPACK won't be replaced anytime soon, if ever), so continuing here: igraph/rigraph#1533 |
Possible solutions to look at:
Cons:
The text was updated successfully, but these errors were encountered: