-
Notifications
You must be signed in to change notification settings - Fork 116
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
Make BLAS flags check lazy and more actionable #1165
Conversation
Love it. I suggest also mentioning that you can set the mode argument in |
Maybe update and link to https://pytensor.readthedocs.io/en/latest/troubleshooting.html#test-blas ? |
89af81b
to
1fd792c
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1165 +/- ##
==========================================
- Coverage 82.27% 82.27% -0.01%
==========================================
Files 186 186
Lines 48023 48004 -19
Branches 8630 8623 -7
==========================================
- Hits 39513 39495 -18
- Misses 6347 6351 +4
+ Partials 2163 2158 -5
|
1fd792c
to
0aa045b
Compare
0aa045b
to
c3c0b2c
Compare
directly). | ||
this, set the value of ``blas__ldflags`` as the empty string. | ||
Depending on the kind of matrix operations your PyTensor code performs, | ||
this might slow some things down (vs. linking with BLAS directly). | ||
|
||
2) You can install the default (reference) version of BLAS if the NumPy version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want points (2) and (3) in here anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it's the most hardcore version to get it up and running, why not mention it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough!
1a71f28
to
032fe15
Compare
032fe15
to
c8c4660
Compare
It replaces the old warning that does not actually apply by a more informative and actionable one. This warning was for Ops that might use the alternative blas_headers, which rely on the Numpy C-API. However, regular PyTensor user has not used this for a while. The only Op that would use C-code with this alternative headers is the GEMM Op which is not included in current rewrites. Instead Dot22 or Dot22Scalar are introduced, which refuse to generate C-code altogether if the blas flags are missing.
c8c4660
to
b9cc961
Compare
This is awesome!!! Note to self: I'll need to rework the conda-forge tests since that assumes eager BLAS |
Doesn't it explicitly check the |
I run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this makes a lot of sense as other backends get developed.
It replaces the old eager warning that does not actually apply by a lazy yet more informative and actionable warning.
This however means users won't notice something is wrong with their installation until PyTensor actually accesses the
config.blas__ldflags
to decide on some behavior.These flags are accessed to either not trigger the introduction of more efficient COps (CGEMv, sparse Usmm, ...), or to use the Python or C implementation for Ops that have both (Dot22, BatchedDot, ...).
The new warning will happen only when a function is compiled that triggers those code-paths.
Technically the old warning was wrong:
The specific warning message was about Ops that might use the alternative blas_headers, which rely on the Numpy C-API.
However, regular PyTensor user has not used this for a while. The only Op that would use C-code with this alternative headers is the GEMM Op which is not included in current rewrites. Instead Dot22 or Dot22Scalar are introduced, which refuse to generate C-code altogether if the BLAS flags are missing.
This complements #1161 and makes PyTensor a breeze to import compared to before.
Closes #1160 (although we could still try to speed the check up)