Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/reusable_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
INSTL_DIR : "${{github.workspace}}/install-dir"
COVERAGE_DIR : "${{github.workspace}}/coverage"
COVERAGE_NAME : "exports-coverage-basic"
HWLOC_SRC_DIR : "${{github.workspace}}/hwloc-src"
HWLOC_MIRROR_DIR : "${{github.workspace}}/hwloc-mirror.git"

jobs:
ubuntu-build:
Expand Down Expand Up @@ -111,7 +113,29 @@
install_tbb: 'ON'
link_hwloc_statically: 'ON'
cmake_ver: 'default'
name: Basic (${{matrix.os}}, build_type=${{matrix.build_type}}, compilers=${{matrix.compiler.c}}/${{matrix.compiler.cxx}}, shared_library=${{matrix.shared_library}}, level_zero_provider=${{matrix.level_zero_provider}}, cuda_provider=${{matrix.cuda_provider}}, install_tbb=${{matrix.install_tbb}}, link_hwloc_statically=${{matrix.link_hwloc_statically}}, cmake_ver=${{matrix.cmake_ver}})
# test static hwloc built from a local clone (UMF_HWLOC_SOURCE_DIR)
- os: ubuntu-24.04
Comment thread
Copilot marked this conversation as resolved.
build_type: Release
compiler: {c: gcc, cxx: g++}
shared_library: 'ON'
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
link_hwloc_statically: 'ON'
local_hwloc: 'source'
cmake_ver: 'default'
# test static hwloc cloned from a local git mirror (UMF_HWLOC_REPO)
- os: ubuntu-22.04
build_type: Release
compiler: {c: gcc, cxx: g++}
shared_library: 'ON'
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
link_hwloc_statically: 'ON'
local_hwloc: 'mirror'
cmake_ver: 'default'
name: Basic (${{matrix.os}}, build_type=${{matrix.build_type}}, compilers=${{matrix.compiler.c}}/${{matrix.compiler.cxx}}, shared_library=${{matrix.shared_library}}, level_zero_provider=${{matrix.level_zero_provider}}, cuda_provider=${{matrix.cuda_provider}}, install_tbb=${{matrix.install_tbb}}, link_hwloc_statically=${{matrix.link_hwloc_statically}}, cmake_ver=${{matrix.cmake_ver}}${{ matrix.local_hwloc && format(', local_hwloc={0}', matrix.local_hwloc) || '' }})

steps:
- name: Checkout
Expand Down Expand Up @@ -144,6 +168,14 @@
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+')
echo "UMF_VERSION=$VERSION" >> $GITHUB_ENV

- name: Clone hwloc sources
if: matrix.local_hwloc == 'source'
run: git clone --depth 1 -b hwloc-2.3.0 https://github.com/open-mpi/hwloc.git ${{env.HWLOC_SRC_DIR}}

- 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}}

- name: Configure build
run: >
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}}
Expand All @@ -161,6 +193,8 @@
-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) || '' }}
${{ matrix.local_hwloc == 'mirror' && format('-DUMF_HWLOC_REPO={0}', env.HWLOC_MIRROR_DIR) || '' }}
${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' && '-DUMF_USE_COVERAGE=ON' || '' }}
${{ matrix.llvm_linker || '' }}

Expand Down
78 changes: 61 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ set(UMF_HWLOC_NAME
"hwloc"
CACHE STRING "Custom name for hwloc library w/o extension")
list(APPEND UMF_OPTIONS_LIST UMF_HWLOC_NAME)
set(UMF_HWLOC_SOURCE_DIR
""
CACHE
PATH
"Path to local hwloc sources used instead of fetching them (with UMF_LINK_HWLOC_STATICALLY)"
Comment thread
Copilot marked this conversation as resolved.
)
list(APPEND UMF_OPTIONS_LIST UMF_HWLOC_SOURCE_DIR)

if(NOT DEFINED UMF_HWLOC_REPO)
set(UMF_HWLOC_REPO
"https://github.com/open-mpi/hwloc.git"
CACHE
STRING
"hwloc git repository URL or local mirror path (with UMF_LINK_HWLOC_STATICALLY)"
)
endif()

set(UMF_INSTALL_RPATH
""
CACHE
Expand Down Expand Up @@ -267,35 +284,53 @@ if(NOT UMF_LINK_HWLOC_STATICALLY)
# add PATH to DLL on Windows
set(DLL_PATH_LIST
"${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_DLL_DIRS}")
if(UMF_HWLOC_SOURCE_DIR)
message(
WARNING
"UMF_HWLOC_SOURCE_DIR is ignored, because UMF_LINK_HWLOC_STATICALLY is OFF and system hwloc was found"
)
endif()
else()
set(UMF_LINK_HWLOC_STATICALLY ON)
endif()
endif()

if(UMF_LINK_HWLOC_STATICALLY)
if(NOT DEFINED UMF_HWLOC_REPO)
set(UMF_HWLOC_REPO "https://github.com/open-mpi/hwloc.git")
endif()
if(NOT DEFINED UMF_HWLOC_TAG)
set(UMF_HWLOC_TAG hwloc-2.13.0)
endif()

message(
STATUS
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG}) and link it statically"
)
if(UMF_HWLOC_SOURCE_DIR)
if(NOT IS_DIRECTORY "${UMF_HWLOC_SOURCE_DIR}")
message(
FATAL_ERROR
"UMF_HWLOC_SOURCE_DIR (${UMF_HWLOC_SOURCE_DIR}) is not a directory"
)
endif()
Comment thread
ldorau marked this conversation as resolved.
# A directory URL is copied into the build tree, so the local clone is
# not patched or built in place.
set(UMF_HWLOC_SOURCE_ARGS URL ${UMF_HWLOC_SOURCE_DIR})
Comment thread
ldorau marked this conversation as resolved.
message(
STATUS
"Will use local hwloc sources from ${UMF_HWLOC_SOURCE_DIR} and link it statically"
)
else()
set(UMF_HWLOC_SOURCE_ARGS GIT_REPOSITORY ${UMF_HWLOC_REPO} GIT_TAG
${UMF_HWLOC_TAG})
message(
STATUS
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG}) and link it statically"
)
endif()

if(WINDOWS)
set(HWLOC_ENABLE_TESTING OFF)
set(HWLOC_SKIP_LSTOPO ON)
set(HWLOC_SKIP_TOOLS ON)
set(HWLOC_SKIP_INCLUDES ON)

FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG}
SOURCE_SUBDIR contrib/windows-cmake/)
FetchContent_Declare(hwloc_targ ${UMF_HWLOC_SOURCE_ARGS} SOURCE_SUBDIR
contrib/windows-cmake/)
FetchContent_MakeAvailable(hwloc_targ)

set(HWLOC_LIB_PATH "")
Expand Down Expand Up @@ -348,15 +383,22 @@ if(UMF_LINK_HWLOC_STATICALLY)
" --gcc-toolchain=${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
endif()

set(UMF_HWLOC_PATCH_CMD
"git apply --reverse --check ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch || git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch"
)
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

Comment thread
ldorau marked this conversation as resolved.
)
endif()

ExternalProject_Add(
hwloc_targ
PREFIX ${hwloc_targ_PREFIX}
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG}
${UMF_HWLOC_SOURCE_ARGS}
UPDATE_DISCONNECTED TRUE
PATCH_COMMAND
sh -c
"git apply --reverse --check ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch || git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch"
PATCH_COMMAND sh -c "${UMF_HWLOC_PATCH_CMD}"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env "CC=${UMF_HWLOC_CC}"
"CXX=${UMF_HWLOC_CXX}" <SOURCE_DIR>/autogen.sh
COMMAND
Expand Down Expand Up @@ -548,6 +590,8 @@ if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
-DUMF_BUILD_FUZZTESTS=OFF
-DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
-DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
-DUMF_HWLOC_SOURCE_DIR="${UMF_HWLOC_SOURCE_DIR}"
-DUMF_HWLOC_REPO="${UMF_HWLOC_REPO}"
-DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH} -DUMF_DEVELOPER_MODE=OFF
-DUMF_FORMAT_CODE_STYLE=OFF -DUMF_TESTS_FAIL_ON_SKIP=OFF
-DUMF_USE_ASAN=OFF -DUMF_USE_UBSAN=OFF -DUMF_USE_TSAN=OFF
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ List of options provided by CMake:
| UMF_USE_VALGRIND | Enable Valgrind instrumentation | ON/OFF | OFF |
| UMF_USE_COVERAGE | Build with coverage enabled (Linux only) | ON/OFF | OFF |
| UMF_LINK_HWLOC_STATICALLY | Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build) | ON/OFF | OFF |
| UMF_HWLOC_SOURCE_DIR | Path to local hwloc sources used instead of fetching them (with UMF_LINK_HWLOC_STATICALLY) | path | "" |
Comment thread
ldorau marked this conversation as resolved.
| UMF_HWLOC_REPO | hwloc git repository URL or local mirror path (with UMF_LINK_HWLOC_STATICALLY) | URL/path | https://github.com/open-mpi/hwloc.git |

## Architecture: memory pools and providers

Expand Down
5 changes: 3 additions & 2 deletions test/memspaces/memspace_highest_bandwidth.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2024-2025 Intel Corporation
// Copyright (C) 2024-2026 Intel Corporation
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Expand Down Expand Up @@ -96,7 +96,8 @@ TEST_F(numaNodesTest, PerCoreBandwidthPlacement) {
HWLOC_CPUBIND_THREAD | HWLOC_CPUBIND_STRICT),
0);
initiator.location.cpuset = here;
initiator.type = HWLOC_LOCATION_TYPE_CPUSET;
initiator.type =
hwloc_location_type_alias::HWLOC_LOCATION_TYPE_CPUSET;

hwloc_obj_t bestnode;
hwloc_memattr_get_best_target(topo, HWLOC_MEMATTR_ID_BANDWIDTH,
Expand Down
Loading