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

Fix support for using a system hwloc and jemalloc #23409

Closed
wants to merge 1 commit into from

Conversation

ronawho
Copy link
Contributor

@ronawho ronawho commented Sep 15, 2023

Our chunk hooks (only used for some multi-locale configs) don't work with jemalloc 5.x (which switched to extent hooks) so don't try to enable them for 5.x. For system jemalloc and hwloc, provide compile/link args instead of assuming they are in a default search path. Lastly don't filter out include paths to jemalloc/hwloc in the qthreads makefile (qthreads users our allocator and hwloc so we need to provide it with paths to build.)

This is motivated by wanting to use system hwloc/jemalloc for our homebrew formulae. Homebrew hwloc/jemalloc aren't available in default compiler search paths, so we need to use pkg-config to find them and ensure qthreads (which uses our hwloc and jemalloc) can find them too.

@ronawho ronawho force-pushed the fix-system-jemalloc-hwloc branch 2 times, most recently from f45232c to b5ef8b3 Compare September 15, 2023 18:16
Our chunk hooks (only used for some multi-locale configs) don't work
with jemalloc 5.x (which switched to extent hooks) so don't try to
enable them for 5.x. For system jemalloc and hwloc, provide compile/link
args instead of assuming they are in a default search path. Lastly don't
filter out include paths to jemalloc/hwloc in the qthreads makefile
(qthreads users our allocator and hwloc so we need to provide it with
paths to build.)

This is motivated by wanting to use system hwloc/jemalloc for our
homebrew formulae. Homebrew hwloc/jemalloc aren't available in default
compiler search paths, so we need to use pkg-config to find them and
ensure qthreads (which uses our hwloc and jemalloc) can find them too.

Signed-off-by: Elliot Ronaghan <[email protected]>
@ronawho ronawho force-pushed the fix-system-jemalloc-hwloc branch from b5ef8b3 to 8801b17 Compare September 15, 2023 18:17
@ronawho
Copy link
Contributor Author

ronawho commented Sep 15, 2023

Hmm, with a clean build, this isn't working. It looks like we're getting into the jemalloc makefile when we shouldn't be and failing with:

cd jemalloc && /Library/Developer/CommandLineTools/usr/bin/make
make[4]: *** No rule to make target `system', needed by `all'.  Stop.

This is because ./util/chplenv/third-party-pkgs is returning jemalloc when it shouldn't be. I think that's probably fallout from #18627, which split CHPL_MEM into CHPL_HOST_MEM and CHPL_TARGET_MEM.

I think we'll need to update third-party-pkgs both to account for the chplenv names and to include that jemalloc can now be a compiler and non-compiler target.

stonea added a commit that referenced this pull request Sep 15, 2023
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]
jabraham17 added a commit to jabraham17/chapel that referenced this pull request Jun 3, 2024
jabraham17 added a commit that referenced this pull request Jun 3, 2024
This PR patches some of our build scripts to work with
`CHPL_HWLOC=system`. By default, we will still continue to default to
`CHPL_HWLOC=bundled` with qthreads, but users can opt in to using a
system install by explicitly setting `CHPL_HWLOC=system`

This is a step in the right direction to allow us to use the preferred
Chapel configuration for Macs in homebrew.

Testing:
- [x] `start_test test/release/examples` with `CHPL_HWLOC=system` on Mac


Notes:
- Partially unblocks #24931
and #24655
- Used #23409 as a starting
point

[Reviewed by @jhh67]
jabraham17 added a commit to jabraham17/chapel that referenced this pull request Jun 3, 2024
jabraham17 added a commit that referenced this pull request Jun 6, 2024
…#25158)

This PR patches some of our build configuration scripts to be able to
use `CHPL_TARGET_JEMALLOC=system`. This allows us to use our preferred
configuration for performance (`CHPL_MEM=jemalloc`) in situations where
we cannot build the bundled jemalloc (i.e. for packaging)

When using a system jemalloc 5.x, we have to turn off chunk hooks
(jemalloc 5.x does not support it)

Testing:
- [x] `start_test test/release/examples` with `CHPL_MEM=jemalloc` and
`CHPL_TARGET_JEMALLOC` on Mac

Notes:
- Builds on top of #25145
- Fully unblocks #24931 and
#24655, and enables homebrew
to use the preferred config
(#25148)
- Uses diffs from #23409

[Reviewed by @jhh67]
@bradcray
Copy link
Member

@jabraham17 : I stumbled across this PR looking for another one and am wondering whether the work you did recently supplants this effort such that this could/should be closed? I see above you mentioned it in your commits/PRs, but I admittedly didn't go to see what was said.

@jabraham17
Copy link
Member

Yes the work I did in #25158 and #25145 supplants (and was inspired by) this PR.

@bradcray
Copy link
Member

Great, thanks. @ronawho I'm going to close rather than asking you to, but shout if you think that's wrong.

@bradcray bradcray closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants