Skip to content

Add low-level wrappers for BLAS and LAPACK #1403

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

amontoison
Copy link
Collaborator

Superseed #1386
cc @ViralBShah @langou

@ViralBShah
Copy link
Member

The @ccall macro is bit annoying. I suppose this would have been simpler to do with just ccall. @amontoison Did you auto-generate these from some spec file?

@amontoison
Copy link
Collaborator Author

Hello @ViralBShah, I autogenerated them from a custom Julia script that directly parse the Fortran files in Reference-LAPACK.
I will regenerate them with only ccalldirectly.

Note that that I will visit @langou next month during ten days and we plan to work on that.

@ViralBShah
Copy link
Member

ViralBShah commented Aug 24, 2025

There are a few lapack calls with one argument that need fixing too. Perhaps the generator script can be updated? It would be nice to have a gen directory where the generator scripts could be checked in.

In theory, we can use Clang.jl to automatically generate the entire API for CBLAS.

@amontoison
Copy link
Collaborator Author

amontoison commented Aug 24, 2025

@ViralBShah I can upload my Fortran parser of F77 but I need to clean it a little bit.
We could the wrappers for CBLAS but we don't use any routine of it in Julia so it will just add more functions in LinearAlgebra.

What would be great to have the "buffer" version of the LAPACK routines with LAPACKE.
But it means a quite big revamp of LinearAlgebra and I am scared that a few people complain.

@ViralBShah
Copy link
Member

The reason to do cblas would be then to wrap that into the low level Julia interface and have Linear Algebra use that and delete the fortran bindings altogether.

The LAPACKE style overhaul can easily be done in a new external package.

Copy link

codecov bot commented Aug 24, 2025

Codecov Report

❌ Patch coverage is 65.65097% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.19%. Comparing base (ed53855) to head (bc9f2f9).

Files with missing lines Patch % Lines
src/libblas.jl 61.72% 124 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1403       +/-   ##
===========================================
- Coverage   93.88%   78.19%   -15.70%     
===========================================
  Files          34       36        +2     
  Lines       15891    20215     +4324     
===========================================
+ Hits        14920    15807      +887     
- Misses        971     4408     +3437     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ViralBShah
Copy link
Member

We'll also need to see the impact this has on system image size.

@amontoison
Copy link
Collaborator Author

amontoison commented Aug 24, 2025

All wrappers are removed in blas.jl and liblapack.jl so it is more modular now if we want to rely on CBLAS / LAPACKE.
Yes, the system image size could be an issue.

@ViralBShah
Copy link
Member

ViralBShah commented Aug 24, 2025

The tests are all passing now. I will check the system size impact. Hopefully it isn’t much.

Given that it is all working now, perhaps not much incentive to change to cblas now, but this puts us in a really good position to do it whenever we need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants