Skip to content
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

Add info on threading #75

Merged
merged 1 commit into from
Dec 31, 2024
Merged

Conversation

danielwe
Copy link
Contributor

@danielwe danielwe commented Dec 30, 2024

Thought it was worth putting this information in the readme. Perhaps @staticfloat can confirm that the wording is correct?

I can't find any official documentation on the VECLIB_MAXIMUM_THREADS variable (this search comes up dry: https://developer.apple.com/search/?q=VECLIB_MAXIMUM_THREADS&type=Documentation), but it's all over the forums, and I can confirm that it works.

Btw. is there a technical reason why BLAS.{set,get}_num_threads isn't hooked up to Accelerate's API for this? (See https://developer.apple.com/documentation/accelerate/blas?language=objc#4434515) (EDIT: I mean apart from the fact that you can only select single vs multiple threads rather than set an exact number)

Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.84%. Comparing base (fc7bfa5) to head (72e5050).
Report is 2 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (fc7bfa5) and HEAD (72e5050). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (fc7bfa5) HEAD (72e5050)
4 2
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #75       +/-   ##
==========================================
- Coverage   73.22%   0.84%   -72.39%     
==========================================
  Files           4       4               
  Lines         239     238        -1     
==========================================
- Hits          175       2      -173     
- Misses         64     236      +172     

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

@staticfloat
Copy link
Member

is there a technical reason why BLAS.{set,get}_num_threads isn't hooked up to Accelerate's API for this?

The reason is that back when I wrote this code, those functions didn't exist. :) Those are only available from macOS 15.0+ , which is quite recent. That being said, I totally think we should use it if possible, since it's the only hope for dynamic thread control. I'm thinking we expose it as something like, if BLAS.set_num_threads(1) is called, we can try setting it to single-threaded, and if any other value is used, set it to multithreading. It's a little confusing, but better than what we have right now, IMO.

@staticfloat
Copy link
Member

To be more clear about that last suggestion, that would be a PR to libblastrampoline, adding another special case at the end of set_num_threads().

@danielwe
Copy link
Contributor Author

Yeah I think everything about this PR is really implemented (or not) in LBT, which is why I specifically pinged you to verify that my additions weren't nonsense 👍

@staticfloat staticfloat merged commit 9874fe4 into JuliaLinearAlgebra:master Dec 31, 2024
3 of 6 checks passed
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