Skip to content

Add CMake options to build static hwloc from local sources or a local git mirror - #1610

Merged
ldorau merged 2 commits into
oneapi-src:mainfrom
bratpiorka:rrudnick_hwloc_source_dir
Oct 6, 2026
Merged

ldorau merged 2 commits into
oneapi-src:mainfrom
bratpiorka:rrudnick_hwloc_source_dir

Conversation

@bratpiorka

@bratpiorka bratpiorka commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

UMF currently always clones hwloc from GitHub. This PR adds two ways to avoid that, which is useful for offline builds:

  • UMF_HWLOC_SOURCE_DIR - path to a local hwloc working tree., which is copied into the build directory (the original tree is unmodified)
  • UMF_HWLOC_REPO - a URL or a local mirror path (default is https://github.com/open-mpi/hwloc.git)

If UMF_HWLOC_SOURCE_DIR is set, it takes precedence over UMF_HWLOC_REPO and UMF_HWLOC_TAG.

Examples:

# local working tree
cmake -B build -DUMF_LINK_HWLOC_STATICALLY=ON -DUMF_HWLOC_SOURCE_DIR=/path/to/hwloc

# local git mirror (e.g. created with: git clone --mirror https://github.com/open-mpi/hwloc.git)
cmake -B build -DUMF_LINK_HWLOC_STATICALLY=ON -DUMF_HWLOC_REPO=/path/to/hwloc.git


- name: Clone hwloc sources
if: matrix.local_hwloc == 'ON'
run: git clone --depth 1 -b hwloc-2.3.0 https://github.com/open-mpi/hwloc.git ${{env.HWLOC_SRC_DIR}}
Comment thread .github/workflows/reusable_basic.yml Fixed
@bratpiorka
bratpiorka force-pushed the rrudnick_hwloc_source_dir branch 2 times, most recently from 26b779f to fbd7fd6 Compare October 1, 2026 07:33
@bratpiorka
bratpiorka requested a balanced review from Copilot October 1, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The Windows companion Debug build does not receive the local hwloc path and can unexpectedly fetch a different source.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds support for building statically linked hwloc from a local source directory.

Changes:

  • Adds and documents UMF_HWLOC_SOURCE_DIR.
  • Supports local sources on Windows and Unix builds.
  • Adds CI coverage using hwloc 2.3.0 and fixes test compatibility.
File Description
CMakeLists.txt Configures local hwloc source handling.
README.md Documents the new option.
.github/​workflows/​reusable_basic.yml Tests a local hwloc checkout.
test/​memspaces/​memspace_highest_bandwidth.cpp Supports the older hwloc enum scope.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread CMakeLists.txt

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The distinct Windows local-source build path lacks CI coverage.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread .github/workflows/reusable_basic.yml
@bratpiorka
bratpiorka force-pushed the rrudnick_hwloc_source_dir branch from 77af354 to 274a17f Compare October 1, 2026 09:17
Comment thread .github/workflows/reusable_basic.yml Fixed
Comment thread .github/workflows/reusable_basic.yml Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The local-source flow is validated across supported platforms and no blocking correctness issues were found.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@bratpiorka
bratpiorka marked this pull request as ready for review October 1, 2026 09:33
@bratpiorka
bratpiorka requested a review from a team as a code owner October 1, 2026 09:33
@bratpiorka bratpiorka assigned ldorau and unassigned ldorau Oct 1, 2026
@bratpiorka
bratpiorka requested a review from ldorau October 1, 2026 09:33

@lukaszstolarczuk lukaszstolarczuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread CMakeLists.txt
if(UMF_HWLOC_SOURCE_DIR)
# Drop build artifacts copied over from an already built local tree
set(UMF_HWLOC_PATCH_CMD
"(test ! -f Makefile || make distclean) && (${UMF_HWLOC_PATCH_CMD})"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question, why we have to run this patch cmd here and right in the next step (ExternalProject_Add)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't run anything here, we only add make distclean to the front of the single PATCH_COMMAND so that build artifacts copied from an already built local tree aren't reused and linked

@bratpiorka
bratpiorka marked this pull request as draft October 1, 2026 16:24
@bratpiorka

Copy link
Copy Markdown
Contributor Author

NOTE: This needs to be set as a draft, as I need to add a separate option to use a mirrored HWLOC repository path.
E.g.

cmake -B build -DUMF_LINK_HWLOC_STATICALLY=ON -DUMF_HWLOC_REPO=/home/user/hwloc.git
# CMake
git clone -b hwloc-2.13.0 /home/user/hwloc.git /home/user/hwloc-src

Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
Comment thread README.md
@bratpiorka
bratpiorka force-pushed the rrudnick_hwloc_source_dir branch from 274a17f to 6188113 Compare October 5, 2026 12:22

- name: Create hwloc git mirror
if: matrix.local_hwloc == 'mirror'
run: git clone --mirror https://github.com/open-mpi/hwloc.git ${{env.HWLOC_MIRROR_DIR}}
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.link_hwloc_statically}}
${{ matrix.local_hwloc == 'source' && format('-DUMF_HWLOC_SOURCE_DIR={0}', env.HWLOC_SRC_DIR) || '' }}
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.link_hwloc_statically}}
${{ matrix.local_hwloc == 'source' && format('-DUMF_HWLOC_SOURCE_DIR={0}', env.HWLOC_SRC_DIR) || '' }}
${{ matrix.local_hwloc == 'mirror' && format('-DUMF_HWLOC_REPO={0}', env.HWLOC_MIRROR_DIR) || '' }}
@bratpiorka bratpiorka changed the title Add CMake opt to get HWLOC sources from path instead of github Add CMake options to build static hwloc from local sources or a local git mirror Oct 5, 2026
@bratpiorka
bratpiorka force-pushed the rrudnick_hwloc_source_dir branch from 6188113 to f2c5035 Compare October 5, 2026 12:39
@bratpiorka
bratpiorka marked this pull request as ready for review October 5, 2026 15:04
@bratpiorka
bratpiorka requested review from ldorau and a balanced review from Copilot October 5, 2026 15:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation is consistent, documented, and covered by targeted CI configurations.

Review effort: Balanced
Findings: None

@ldorau ldorau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ldorau
ldorau merged commit 841fcb3 into oneapi-src:main Oct 6, 2026
79 checks passed
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.

5 participants