-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
openblas: use cmake
and depend on libomp
#219339
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
base: main
Are you sure you want to change the base?
Conversation
a509697
to
ff2aa4d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
ff2aa4d
to
017f197
Compare
af08516
to
8cb793b
Compare
6450d0c
to
7d01829
Compare
The failures on macOS 15-arm64 can be reproduced on my Sequoia macbook with the current
|
7d01829
to
3fb931b
Compare
d5ace47
to
23b371f
Compare
d8e8d7a
to
5d8ee9a
Compare
Should switching to |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Keep the PR open for now. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
e86a5fc
to
18ffbc1
Compare
Just a word of caution: the |
A Makefile workaround could be: # Workaround to use OpenMP with Apple Clang
if ENV.compiler == :clang
inreplace "Makefile.system", "+= -fopenmp", "+= -Xpreprocessor -fopenmp"
inreplace "Makefile.install" do |s|
s.gsub! ":= -fopenmp", ":= -Xpreprocessor -fopenmp"
s.gsub! "+= -lgomp", "+= -L#{Formula["libomp"].opt_lib} -lomp"
end
end Can't comment if this functionally behaves as expected. But at least no mixed linkage ❯ brew linkage openblas
System libraries:
/usr/lib/libSystem.B.dylib
Homebrew libraries:
/opt/homebrew/opt/gcc/lib/gcc/current/libgfortran.5.dylib (gcc)
/opt/homebrew/opt/gcc/lib/gcc/current/libquadmath.0.dylib (gcc)
/opt/homebrew/opt/libomp/lib/libomp.dylib (libomp) ❯ PKG_CONFIG_PATH=/opt/homebrew/opt/openblas/lib/pkgconfig pkgconf --cflags openblas
-I/opt/homebrew/Cellar/openblas/0.3.30/include -Xpreprocessor -fopenmp
❯ PKG_CONFIG_PATH=/opt/homebrew/opt/openblas/lib/pkgconfig pkgconf --libs openblas
-L/opt/homebrew/Cellar/openblas/0.3.30/lib -lopenblas
❯ PKG_CONFIG_PATH=/opt/homebrew/opt/openblas/lib/pkgconfig pkgconf --libs --static openblas
-L/opt/homebrew/Cellar/openblas/0.3.30/lib -lopenblas -lpthread -lgfortran -lpthread -lgfortran -L/opt/homebrew/opt/libomp/lib -lomp |
Experimenting with Makefile alternative in |
I am trying to keep the upstream BTW, does the |
Also noting that I will be updating openblas test in separate PR to run |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
is it still being worked on? |
18ffbc1
to
aa8cd82
Compare
system ENV.cc, "test.c", "-o", "test", *flags | ||
system "./test" | ||
|
||
flags += %W[-I#{Formula["libomp"].opt_include} -L#{Formula["libomp"].opt_lib} -lomp] if OS.mac? |
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.
Will note that one problem with change is pkg-config file is it in an odd half-way state
Libs: -L${libdir} -l${libnameprefix}openblas${libnamesuffix}${libsuffix}
Cflags: -I${includedir} -Xclang -fopenmp
This won't work as is with libomp unless user provides the missing arguments like the above line whereas GCC worked with just the pkg-config output.
Similarly, installed CMake config file may not behave as expected (as OpenMP_Fortran will link libgomp without some extra hacks):
set_target_properties(OpenBLAS::OpenBLAS PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/openblas"
INTERFACE_LINK_LIBRARIES "m;OpenMP::OpenMP_C;OpenMP::OpenMP_Fortran"
)
However, users are more likely to use FindBLAS and FindOpenMP so may not see issue with OpenBLASConfig.cmake
We first need confirmation that upstream won't revert CMake changes. Afterward will need to decide if the odd quirks this can introduce are worth the change. |
aa8cd82
to
cb70ea0
Compare
cb70ea0
to
ca9a5b9
Compare
|
||
keg_only :shadowed_by_macos, "macOS provides BLAS in Accelerate.framework" | ||
|
||
depends_on "cmake" => :build |
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.
Adding comment here to make more obvious that this PR is stalled until upstream decision:
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?Related to #209091, #129648, #129100. Upstream has added support for buiding with
libomp
through OpenMathLib/OpenBLAS#5180, where one can also find multiple issues linked from downstream repositories that are caused by Homebrew's handling ofOpenMP
forOpenBLAS
.This change requires dependents of
OpenBLAS
also switched tolibomp
. Forgromacs
,cp2k
andfftw
, the switch seems relatively straightforward. However, I am not sure how to go aboutdynare
. Currently,dynare
is directly linked tolibgomp
and it also pulls inlibomp
throughsuite-sparse
.