-
Notifications
You must be signed in to change notification settings - Fork 411
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
Have homebrew use system jemalloc and hwloc #23366
Conversation
--- Signed-off-by: Andy Stone <stonea@users.noreply.github.com>
--- Signed-off-by: Andy Stone <stonea@users.noreply.github.com>
@@ -22,6 +22,7 @@ class Chapel < Formula | |||
depends_on "llvm@14" | |||
depends_on "python@3.10" | |||
depends_on "cmake" | |||
depends_on "hwloc" | |||
|
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.
Need depends_on
jemalloc too?
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.
It seems like we should add it (it does depend on it after all).
For whatever reason things build fine without it but don't build fine if it's missing hwloc
.
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 guess that's just since jemalloc happens to be installed on our test machine already.
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.
Nah, it would error out even with hwloc
installed, here:
chapel/util/chplenv/chpl_hwloc.py
Lines 49 to 53 in 113ce16
exists, retcode, my_out, my_err = try_run_command( | |
['pkg-config', '--atleast-version=2.1', 'hwloc']) | |
if exists and retcode != 0: | |
err = "CHPL_HWLOC=system requires hwloc >= 2.1" | |
error(err, ValueError) |
That pkg-config
command would work from the root shell but not whatever environment homebrew puts itself in during the install.
@@ -56,6 +57,11 @@ def install | |||
(libexec/"chplconfig").write <<~EOS | |||
CHPL_RE2=bundled | |||
CHPL_GMP=system | |||
CHPL_MEM=jemalloc | |||
CHPL_HOST_MEM=jemalloc |
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 CHPL_HOST_MEM
defaults to cstdlib on mac. Not sure we need/want to set it here.
Also don't see any reason to explicitly set CHPL_MEM=jemalloc
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 added the CHPL_HOST_MEM
line because without it I was running into this (confusing) error message:
Error: CHPL_JEMALLOC must be 'none' when CHPL_MEM is not jemalloc
Confusing because this is despite the fact that I explicitly did set CHPL_MEM
to jemalloc
.
Taking a look at chpl_jemalloc.get
:
chapel/util/chplenv/chpl_jemalloc.py
Line 11 in dbf58e6
def get(flag='target'): |
it can be called with its flag
parameter as either host
or target
. If it's host
then the mem_val
on this line is really referring to CHPL_HOST_MEM
and jemalloc_val
is really referring to CHPL_HOST_JEMALLOC
:
chapel/util/chplenv/chpl_jemalloc.py
Lines 57 to 58 in dbf58e6
if mem_val != 'jemalloc' and jemalloc_val != 'none': | |
error("CHPL_JEMALLOC must be 'none' when CHPL_MEM is not jemalloc") |
Maybe we should have the error print CHPL_HOST_JEMALLOC
/CHPL_TARGET_JEMALLOC
and CHPL_HOST_MEM
/CHPL_TARGET_MEM
mem as appropriate. Though that might be confusing if the user really did set CHPL_MEM
directly and this line in our doc makes me thing maybe it's going to be a moot point in a release or two anyway:
CHPL_TARGET_MEM will be replacing CHPL_MEM in the future. CHPL_TARGET_MEM takes precedence over CHPL_MEM.
In terms of what to do for this homebrew formula: now that I write this out, it seems like a better fix than setting CHPL_HOST_MEM=jemalloc
would be to remove the CHPL_HOST_JEMALLOC=system
line (in which case I think it defaults to none?). Trying it out this seems to build fine.
Also don't see any reason to explicitly set CHPL_MEM=jemalloc
Yep, looks like that one's not needed.
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.
In terms of what to do for this homebrew formula: now that I write this out, it seems like a better fix than setting
CHPL_HOST_MEM=jemalloc
would be to remove theCHPL_HOST_JEMALLOC=system
line (in which case I think it defaults to none?). Trying it out this seems to build fine.
👍
Since we now require jemalloc to be system installed for mac homebrew --- Signed-off-by: Andy Stone <stonea@users.noreply.github.com>
--- Signed-off-by: Andy Stone <stonea@users.noreply.github.com>
In #23366, I updated the Homebrew formula to use system versions of jemalloc and hwloc. Unfortunately, this change runs into issues. Some of which may be fixed later by this PR (#23409 (comment)). There's also this issue about the bundled jemalloc makefile being run and failing despite the fact that we're supposed to be using the system one #23409 (comment)). Given all this, and how close we are to the release, we decided to have the formula use cstdlib for memory management instead. [Reviewed by @ronawho]
Our nightly testing is encountering an issue we're linking to a system version of jemalloc despite configuring Chapel to use a bundled version (ultimately resulting in unsightly linker errors):
I believe this is the same issue as: #18955
In order to get nightly testing back on track I think we should use the system version of jemalloc (and hwloc, which I think would run into a similar issue).