-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
gromacs: don't force build with gcc #129648
Conversation
libomp dep in itself won't be enough |
Have you tested the changes locally? And checked that they produce the correct linking? That does not seem likely. |
@@ -25,7 +25,10 @@ class Gromacs < Formula | |||
depends_on "gcc" # for OpenMP | |||
depends_on "openblas" |
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.
Note that OpenBLAS uses libgomp
, so you'll be mixing OpenMP implementations here.
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.
Hmm, not sure what do about this....
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.
Note that OpenBLAS uses libgomp, so you'll be mixing OpenMP implementations here.
So is it appropriate to just replace libomp
with libgomp
below?
Or is it reasonable to entirely leave out the depends_on "libomp"
entirely to just get transitive installation dependency or does it provide necessary build-time details?
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.
I simply don't think we can build that with libomp
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.
To be clearer: I think the issue is in the (proposed) votca formula and should be fixed there. We don't want to introduce this mixed-OpenMP linkage.
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.
I simply don't think we can build that with libomp
What is the actual problem with that? I have seen openblas being built with clang using spack.io before.
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.
To be clearer: I think the issue is in the (proposed) votca formula and should be fixed there. We don't want to introduce this mixed-OpenMP linkage.
Again I am not sure about this either, we build VOTCA on large variety different compiler and library combination without problems. And I of course tried to restrict votca to gcc as well, which led to this error: #129512 (comment)
because boost was build with clang.
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.
I simply don't think we can build that with libomp
What is the actual problem with that? I have seen openblas being built with clang using spack.io before.
If I believe:
https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/openblas/package.py#L205-L209
clang+openmp should works for openblas>0.2.19.
We had a user reporting the linking issue in #129512 and once they build gromacs outside homebrew, it worked. Adding votca to homebrew just seems like the better thing to do for future users. |
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.
I repeat my question:
Have you tested the changes locally? And checked that they produce the correct linking? That does not seem likely.
I am 99% certain that this PR disables OpenMP completely in gromacs.
Again I have no idea, where the build logs are, but we could run "gmx -version" as a test and would tell us. |
@carlocab can you point out to me where the logs are? |
They are in the CI details below, but unless something fails they won't have much detail. These verifications that people are asking for does not seem like something you can do with CI though, it should be done locally. |
I do think CMake (w/ Makefile) is able to automatically handle linking Homebrew's Would still be good to get someone to locally install Logs do show detection, e.g.
And bottle lib has linkage: ❯ otool -L gromacs/2023.1/lib/libgromacs.8.0.0.dylib
gromacs/2023.1/lib/libgromacs.8.0.0.dylib:
@@HOMEBREW_PREFIX@@/opt/gromacs/lib/libgromacs.8.dylib (compatibility version 8.0.0, current version 8.0.0)
@@HOMEBREW_PREFIX@@/opt/fftw/lib/libfftw3f.3.dylib (compatibility version 10.0.0, current version 10.10.0)
@@HOMEBREW_PREFIX@@/opt/openblas/lib/libopenblas.0.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
@@HOMEBREW_PREFIX@@/opt/libomp/lib/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
@rpath/libmuparser.2.dylib (compatibility version 2.0.0, current version 2.3.4)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0) We should also discuss more on situation of mixing GCC vs LLVM implementations of libraries here and in #129100 |
I can take a look later in the week. Multiple competing openmp implementations sounds problematic. Also, it doesn't seem like the title/description of this PR is accurate. As I understand, the PR removes the prohibition against Again, I apologize for my complete ignorance of the |
I built locally and ran a few simulation steps without crashing. I used 2 OpenMP threads and 4 tMPI threads. Contrary to the issue title, gromacs is built with gcc 13 Both gromacs and libopenblas link to libgomp. |
Hmm in @cho-m build it uses clang though, so you are right the PR title is misleading, I think this PR is mainly about not forcing gcc. |
inreplace "src/gromacs/gromacs-hints.in.cmake" do |s| | ||
s.gsub! "@CMAKE_LINKER@", "/usr/bin/ld" | ||
s.gsub! "@CMAKE_C_COMPILER@", cc | ||
s.gsub! "@CMAKE_CXX_COMPILER@", cxx | ||
s.gsub! "@CMAKE_C_COMPILER@", ENV.cc |
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.
Where does ENV
come from?
@@ -25,7 +25,10 @@ class Gromacs < Formula | |||
depends_on "gcc" # for OpenMP |
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 need depends_on "gcc" # for OpenMP
or is it even the appropriate way to ensure an omp
facility if we always depend on openblas
? I mean, is the omp
dependence of openblas
sufficiently transitive?
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.
We prefer dependencies to be explicit than transitive, when there is a direct dependency.
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.
We prefer dependencies to be explicit than transitive, when there is a direct dependency.
Sounds good. In order to be both explicit and correct, how would gromacs.rb
reference the (brew) package dependency to get appropriate CMake hints? (I think the only available CMake input variable is OpenMP_CXX_INCLUDE_DIR
, since the details are normally so compiler-specific.)
It seems like we might need the choice of libomp
vs. libgomp
to be coupled to the choice of clang
vs. gcc
?
Or is there a way to inspect the openblas
dependency and just use whatever it used?
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.
There is no choice to be had: formulas don't really have options, and binaries shipped are built on our CI machines.
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.
I think you are saying
- the gromacs formula declares a dependency on
openblas
, so it can and should encode decisions needed to build compatibly, per the openblas formula - gromacs should therefore declare a dependency on
libgomp
- the formula encodes its toolchain, which in this case must be gcc based
Are all three of those points correct?
I'm particularly unclear on that last one, since it would seem to invalidate the whole premise of this pull request (which has not yet been outright rejected). It seems like any one of those points, though, would invalidate much of this change.
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.
Yes (except there is no libgomp
, it is a part of gcc
). I have not outright closed the PR because I wanted to see if any other maintainer felt differently about it, but it seems not, so I'll close it now.
@@ -25,7 +25,10 @@ class Gromacs < Formula | |||
depends_on "gcc" # for OpenMP | |||
depends_on "openblas" | |||
|
|||
fails_with :clang | |||
on_macos do | |||
depends_on "libomp" |
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.
This change may have succeeded in establishing a package dependency, but without additional CMake arguments, the build system configuration is still free to find libgomp
if it is available and finds it preferable. I assume that is what happened in my test.
@@ -25,7 +25,10 @@ class Gromacs < Formula | |||
depends_on "gcc" # for OpenMP | |||
depends_on "openblas" | |||
|
|||
fails_with :clang |
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.
I would be happy to test again, compiling with clang. It seems like it would be nice to remove this broad clang-avoidance. But what is the mechanism for choosing compiler toolchain for either brew install -s gromacs
or for the built-package repositories?
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.
update:
- I tried
brew install --cc llvm_clang -s gromacs
, but I don't seem to be set up for that. - I tried
brew install --cc clang -s gromacs
but brew still invoked CMake withcmake -S . -B build -DGROMACS_CXX_COMPILER=/usr/local/opt/gcc/bin/g++-13 -DGMX_VERSION_STRING_OF_FORK=Homebrew -DGMX_INSTALL_LEGACY_API=ON
This would bring mixed OpenMP runtime linkage, which is not suitable. Closing as per discussion. |
I actually thought let’s build one blas with clang as this seems to work as well, but anyhow. @fxcoudert can you help me on the votca formula then? I have no idea how the fox the boost linking issue, now the toolchain mixing issue bubbles up one layer more down. |
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 doingbrew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?For #129512