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

Both LinearAlgebra and LinearAlgebra.BLAS export dot #626

Closed
ararslan opened this issue Apr 25, 2019 · 5 comments · Fixed by JuliaLang/julia#31878
Closed

Both LinearAlgebra and LinearAlgebra.BLAS export dot #626

ararslan opened this issue Apr 25, 2019 · 5 comments · Fixed by JuliaLang/julia#31878
Labels
stdlib Julia's standard library

Comments

@ararslan
Copy link
Member

This is quite annoying:

julia> using LinearAlgebra

julia> using LinearAlgebra.BLAS

julia> dot
WARNING: both BLAS and LinearAlgebra export "dot"; uses of it in module Main must be qualified
ERROR: UndefVarError: dot not defined

It seems like BLAS should either extend dot from LinearAlgebra or not export its own dot.

@ararslan ararslan added the stdlib Julia's standard library label Apr 25, 2019
@andreasnoack
Copy link
Member

Should we consider not exporting anything from BLAS such that you always fully quality uses of BLAS functions?

@ararslan
Copy link
Member Author

ararslan commented Apr 26, 2019

I really like being able to do using LinearAlgebra.BLAS and having access to gemm, syrk, etc. unqualified. Removing all exports seems like throwing the baby out with the bath water given that the only name clash is one function.

@StefanKarpinski
Copy link
Member

Let's just unexport the controversial one instead of making this more of a decision.

ararslan referenced this issue in JuliaLang/julia Apr 29, 2019
LinearAlgebra exports the familiar `dot` function. The BLAS submodule
has its own `dot` function, which it also exports, leading to problems
if a user tries to access `dot` after `using` both LinearAlgebra and
BLAS.

Because this conflict currently exists, this change should be
non-breaking, as it's difficult to resolve `dot` unqualified from BLAS
before it's resolved from LinearAlgebra, so pretty much any consumer
must already calling `BLAS.dot` as such.

Fixes #31838.
@musm
Copy link
Contributor

musm commented Apr 30, 2019

Is it really necessary to make a change here? The BLAS library is a low level wrapper, which, presumably, mainly library writers are calling and if not, it seems like it would be better to just directly import the BLAS functions you want instead?

I do think either keeping the exports or unexporting them all makes the most sense, and is a consistent decision.

@ararslan
Copy link
Member Author

The way I see it is, if you're saying using LinearAlgebra.BLAS, you're explicitly asking for access to the BLAS names. Doing that in general is unlikely to be all that common, but when it is, it's immensely useful. I've run into that multiple times in the past couple of weeks. It quickly becomes really annoying to not be able to use dot. It doesn't make sense to me to say "you can't have exports because this is a low-level wrapper."

ararslan referenced this issue in JuliaLang/julia Apr 30, 2019
LinearAlgebra exports the familiar `dot` function. The BLAS submodule
has its own `dot` function, which it also exports, leading to problems
if a user tries to access `dot` after `using` both LinearAlgebra and
BLAS.

Because this conflict currently exists, this change should be
non-breaking, as it's difficult to resolve `dot` unqualified from BLAS
before it's resolved from LinearAlgebra, so pretty much any consumer
must already calling `BLAS.dot` as such.

Fixes #31838.
@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Julia's standard library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants