I am trying to wrap the calls for Apple’s Accelerate Sparse Solver and it is my first try at wrapping apple routines.
I am following some of the code structure in Accelerate.jl and LinearSolvers.jl but I keep failing at wrapping the SparseMatrixStructure object from Accelerate in Julia.
I am following this docs Creating sparse matrices | Apple Developer Documentation
I am trying this so far
using LinearAlgebra
using Libdl
using SparseArrays
# For now, only use BLAS from Accelerate (that is to say, vecLib)
const global libacc = "/System/Library/Frameworks/Accelerate.framework/Accelerate"
libacc_hdl = Libdl.dlopen_e(libacc)
mat = sprand(10, 10, 0.4)
rowIndices = mat.nzind .- 1
values = mat.nzval
column_starts = mat.colptr .- 1
structure_acc = ccall((:SparseMatrixStructure, libacc), Ptr{Cvoid},
(Cint, Cint, Ptr{Cint}, Ptr{Cint}, Ptr{Cvoid}, Cint),
10, 10, column_starts, rowIndices, Ptr{Cvoid}(), 1)
I am following the header located at
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers/Sparse/Solve.h
But ccall
isn’t able to find the symbol. I am not sure if I am calling the correct method or loading the correct library.
Any pointers on how to proceed will be appreciated.