Skip to content

Arpack on M1 #134

@kosiakk

Description

@kosiakk

Hi
I'm experimenting with Julia on MacBook Air M1 using nightly builds: Version 1.7.0-beta3 (2021-07-07)

Everything works well in stable version, which is cross-compiled on the fly using Apple's Rosetta tool.
But the native build, it seems, requires native build of Arpack library:

julia> using Arpack

julia> eigs(rand(10,10))
ERROR: UndefVarError: libarpack not defined
Stacktrace:
 [1] naupd(ido::Base.RefValue{Int64}, bmat::String, n::Int64, evtype::String, nev::Int64, TOL::Base.RefValue{Float64}, resid::Vector{Float64}, ncv::Int64, v::Matrix{Float64}, ldv::Int64, iparam::Vector{Int64}, ipntr::Vector{Int64}, workd::Vector{Float64}, workl::Vector{Float64}, lworkl::Int64, info::Base.RefValue{Int64})
   @ Arpack ~/.julia/packages/Arpack/pLziT/src/libarpack.jl:297
 [2] aupd_wrapper(T::Type, matvecA!::Arpack.var"#18#28"{Matrix{Float64}}, matvecB::Arpack.var"#19#29", solveSI::Arpack.var"#20#30", n::Int64, sym::Bool, cmplx::Bool, bmat::String, nev::Int64, ncv::Int64, which::String, tol::Float64, maxiter::Int64, mode::Int64, v0::Vector{Float64}, check::Int64)
   @ Arpack ~/.julia/packages/Arpack/pLziT/src/libarpack.jl:134
 [3] _eigs(A::Matrix{Float64}, B::LinearAlgebra.UniformScaling{Bool}; nev::Int64, ncv::Int64, which::Symbol, tol::Float64, maxiter::Int64, sigma::Nothing, v0::Vector{Float64}, ritzvec::Bool, explicittransform::Symbol, check::Int64)
   @ Arpack ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:243
 [4] _eigs
   @ ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:79 [inlined]
 [5] #eigs#10
   @ ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:51 [inlined]
 [6] eigs
   @ ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:51 [inlined]
 [7] #eigs#9
   @ ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:50 [inlined]
 [8] eigs(A::Matrix{Float64})
   @ Arpack ~/.julia/packages/Arpack/pLziT/src/Arpack.jl:50
 [9] top-level scope
   @ REPL[6]:1

arpak itself seems to be supported on MacOS and even uses Apple own compilation of BLAS/LAPACK (included in Accelerate) which should be able to use private matrix CPU instructions on M1.

It seems I was able to follow arpack-ng instructions and build it on my machine:

-- Install configuration: "Release"
-- Installing: /usr/local/lib/libarpack.2.1.0.dylib
-- Installing: /usr/local/lib/libarpack.2.dylib
-- Installing: /usr/local/lib/libarpack.dylib
-- Installing: /usr/local/lib/pkgconfig/arpack.pc
-- Installing: /usr/local/lib/libparpack.2.1.0.dylib
-- Installing: /usr/local/lib/libparpack.2.dylib
-- Installing: /usr/local/lib/libparpack.dylib
-- Installing: /usr/local/lib/pkgconfig/parpack.pc
-- Installing: /usr/local/include/arpack/debug.h
-- Installing: /usr/local/include/arpack/stat.h
-- Installing: /usr/local/include/arpack/arpackdef.h
-- Installing: /usr/local/include/arpack/arpackicb.h
-- Installing: /usr/local/lib/cmake/arpack-ng/arpack-ng-config.cmake
-- Installing: /usr/local/lib/cmake/arpack-ng/arpack-ng-config-version.cmake

but this library is still not seen by the Julia package. What should I try next?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions