C++ API for Accelerate Framework (SparseSolve)

Hi, I am a Julia/C++ developper and a total novice with apple ecosystem.

I look for examples and documentation about the SparseSolve C++ API from the Accelerate framework.

So far, I have only found Swift and Objective C documentation.

Any hint form the community ?

Answered by in 704062022

The Accelerate “Objective C” API is actually usable from C/C++ - it doesn’t use any Obj-C only features.

Accepted Answer

The Accelerate “Objective C” API is actually usable from C/C++ - it doesn’t use any Obj-C only features.

Thank you very much for your answer !

I managed to use the accelerate SparseSolve "Objective C" API from a C++ program. Just in case it maybe useful for other readers, the header files (e.g. Sparse/Solve.h) contain a lot of detailed comments and documentation.

More examples would be nice though ;)

On my first test cases, the Sparse Cholesky solver is 3-4 times faster than UMFPACK used in Julia (in double) on my M1 Max machine : great !

It seems to be sequential (110 % of CPU and 0%GPU): is it possible to improve further the performance with multi-threading ?

Hi, I am a Julia/C++ developper and a total novice with apple ecosystem. I look for examples and documentation about the SparseSolve C++ API from the Accelerate framework.

I find myself in a very similar boat: I'm working on making an interface for libSparse in AppleAccelerate.jl I've managed to call SparseSolve and SparseFactor from Julia with @ccall, but I'm finding the performance puzzling. When it comes to solving Ax = b in-place (b is a vector) for large symmetric positive definite A, I find that KLU.jl's KLU.solve! (LU factorization) is 2x faster than Apple Accelerate's SparseSolve (Cholesky factorization). That's highly counter intuitive: you'd think that a hardware-specific implementation that exploits the positive-definite nature of the matrix would be faster. When I profile repeated calls to SparseSolve, I get the most called functions are _SparseConvertFromCoordinate_Double followed by BLASStateRelease. (The later ones are more reasonable, LAPACK/CBLAS stuff like dgemm, ssyrk.)

I may post a separate question with more detail, but this post is so close to my own question.

C++ API for Accelerate Framework (SparseSolve)
 
 
Q