Skip to content

Remove UMF_DISABLE_HWLOC option #1228

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
26 changes: 3 additions & 23 deletions .github/workflows/reusable_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
level_zero_provider: ['ON']
cuda_provider: ['ON']
install_tbb: ['ON']
disable_hwloc: ['OFF']
link_hwloc_statically: ['OFF']
include:
- os: 'ubuntu-22.04'
Expand All @@ -34,7 +33,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
- os: 'ubuntu-22.04'
build_type: Release
Expand All @@ -43,7 +41,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
- os: 'ubuntu-24.04'
build_type: Debug
Expand All @@ -52,7 +49,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
# test level_zero_provider='OFF' and cuda_provider='OFF'
- os: 'ubuntu-22.04'
Expand All @@ -62,7 +58,6 @@ jobs:
level_zero_provider: 'OFF'
cuda_provider: 'OFF'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
# test icx compiler
- os: 'ubuntu-22.04'
Expand All @@ -72,7 +67,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
# test lld linker
- os: 'ubuntu-24.04'
Expand All @@ -82,7 +76,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
llvm_linker: '-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld"'
# test without installing TBB
Expand All @@ -93,16 +86,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'OFF'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
- os: 'ubuntu-22.04'
build_type: Debug
compiler: {c: gcc, cxx: g++}
shared_library: 'ON'
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'ON'
link_hwloc_statically: 'OFF'
- os: 'ubuntu-22.04'
build_type: Release
Expand All @@ -111,7 +94,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'ON'
runs-on: ${{matrix.os}}

Expand All @@ -127,7 +109,6 @@ jobs:
sudo apt-get install -y clang cmake libnuma-dev lcov

- name: Install hwloc
if: matrix.disable_hwloc == 'OFF'
run: |
sudo apt-get install -y libhwloc-dev

Expand Down Expand Up @@ -170,7 +151,6 @@ jobs:
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_DISABLE_HWLOC=${{matrix.disable_hwloc}}
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.link_hwloc_statically}}
${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' && '-DUMF_USE_COVERAGE=ON' || '' }}
${{ matrix.llvm_linker || '' }}
Expand All @@ -190,7 +170,7 @@ jobs:
if: ${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' }}
working-directory: ${{env.BUILD_DIR}}
run: |
export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}}
export COVERAGE_FILE_NAME=${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}
echo "COVERAGE_FILE_NAME: $COVERAGE_FILE_NAME"
../scripts/coverage/coverage_capture.sh $COVERAGE_FILE_NAME
mkdir -p ${{env.COVERAGE_DIR}}
Expand All @@ -199,7 +179,7 @@ jobs:
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' }}
with:
name: ${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}-no_hwloc-${{matrix.disable_hwloc}}
name: ${{env.COVERAGE_NAME}}-${{matrix.os}}-shared-${{matrix.shared_library}}
path: ${{env.COVERAGE_DIR}}

- name: Remove the installation directory
Expand All @@ -212,7 +192,7 @@ jobs:
--build-dir ${{env.BUILD_DIR}}
--install-dir ${{env.INSTL_DIR}}
--build-type ${{matrix.build_type}}
${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }}
${{ matrix.install_tbb == 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }}
--umf-version ${{env.UMF_VERSION}}
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/reusable_docs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ jobs:
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF \
-DUMF_BUILD_CUDA_PROVIDER=OFF \
-DUMF_BUILD_TESTS=OFF \
-DUMF_BUILD_EXAMPLES=OFF \
-DUMF_DISABLE_HWLOC=ON
-DUMF_BUILD_EXAMPLES=OFF
cmake --build build --target docs

#
Expand Down
189 changes: 84 additions & 105 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF)
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
umf_option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
umf_option(
UMF_DISABLE_HWLOC
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
OFF)
umf_option(
UMF_LINK_HWLOC_STATICALLY
"Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build)"
Expand Down Expand Up @@ -249,7 +245,7 @@ else()
)
endif()

if(NOT UMF_DISABLE_HWLOC AND (NOT UMF_LINK_HWLOC_STATICALLY))
if(NOT UMF_LINK_HWLOC_STATICALLY)
pkg_check_modules(LIBHWLOC hwloc>=2.3.0)
if(NOT LIBHWLOC_FOUND)
find_package(LIBHWLOC 2.3.0 COMPONENTS hwloc)
Expand All @@ -267,108 +263,93 @@ if(NOT UMF_DISABLE_HWLOC AND (NOT UMF_LINK_HWLOC_STATICALLY))
endif()
endif()

if(UMF_LINK_HWLOC_STATICALLY AND LINUX)
find_program(AUTORECONF_EXECUTABLE autoreconf)
if(NOT AUTORECONF_EXECUTABLE)
message(WARNING "autoreconf is not installed. Disabling hwloc.")
set(UMF_DISABLE_HWLOC ON)
set(UMF_LINK_HWLOC_STATICALLY OFF)
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.10.0)
endif()
endif()

if(UMF_DISABLE_HWLOC)
message(STATUS "hwloc is disabled, hence OS provider, memtargets, "
"topology discovery, examples won't be available!")
else()
if(UMF_LINK_HWLOC_STATICALLY)
if(NOT DEFINED UMF_HWLOC_REPO)
set(UMF_HWLOC_REPO "https://github.com/open-mpi/hwloc.git")
endif()
message(
STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG})"
)

if(NOT DEFINED UMF_HWLOC_TAG)
set(UMF_HWLOC_TAG hwloc-2.10.0)
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_MakeAvailable(hwloc_targ)

set(HWLOC_LIB_PATH "")
if(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
set(HWLOC_LIB_PATH "${hwloc_targ_BINARY_DIR}/hwloc.lib")
else()
set(HWLOC_LIB_PATH "${hwloc_targ_BINARY_DIR}/lib/hwloc.lib")
endif()
message(
STATUS
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG})"
)

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_MakeAvailable(hwloc_targ)

set(HWLOC_LIB_PATH "")
if(CMAKE_GENERATOR STREQUAL "NMake Makefiles")
set(HWLOC_LIB_PATH "${hwloc_targ_BINARY_DIR}/hwloc.lib")
else()
set(HWLOC_LIB_PATH "${hwloc_targ_BINARY_DIR}/lib/hwloc.lib")
endif()

get_filename_component(LIBHWLOC_LIBRARY_DIRS ${HWLOC_LIB_PATH}
DIRECTORY)
set(LIBHWLOC_LIBRARIES ${HWLOC_LIB_PATH})
set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include)
else() # not Windows
FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG})
FetchContent_MakeAvailable(hwloc_targ)

add_custom_command(
COMMAND ./autogen.sh
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/configure)
add_custom_command(
COMMAND
./configure --prefix=${hwloc_targ_BINARY_DIR}
--enable-static=yes --enable-shared=no --disable-libxml2
--disable-pci --disable-levelzero --disable-opencl
--disable-cuda --disable-nvml --disable-libudev
--disable-rsmi CFLAGS=-fPIC CXXFLAGS=-fPIC
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/Makefile
DEPENDS ${hwloc_targ_SOURCE_DIR}/configure)
add_custom_command(
COMMAND make
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/lib/libhwloc.la
DEPENDS ${hwloc_targ_SOURCE_DIR}/Makefile)
add_custom_command(
COMMAND make install
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a
DEPENDS ${hwloc_targ_SOURCE_DIR}/lib/libhwloc.la)

add_custom_target(hwloc_prod
DEPENDS ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
add_library(hwloc INTERFACE)
target_link_libraries(
hwloc INTERFACE ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
add_dependencies(hwloc hwloc_prod)

set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/lib)
set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include)
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
endif()
endif() # UMF_LINK_HWLOC_STATICALLY
get_filename_component(LIBHWLOC_LIBRARY_DIRS ${HWLOC_LIB_PATH}
DIRECTORY)
set(LIBHWLOC_LIBRARIES ${HWLOC_LIB_PATH})
set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include)
else() # not Windows
FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG})
FetchContent_MakeAvailable(hwloc_targ)

message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}")
message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}")
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
message(STATUS " LIBHWLOC_API_VERSION = ${LIBHWLOC_API_VERSION}")
if(WINDOWS)
message(STATUS " LIBHWLOC_DLL_DIRS = ${LIBHWLOC_DLL_DIRS}")
add_custom_command(
COMMAND ./autogen.sh
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/configure)
add_custom_command(
COMMAND
./configure --prefix=${hwloc_targ_BINARY_DIR}
--enable-static=yes --enable-shared=no --disable-libxml2
--disable-pci --disable-levelzero --disable-opencl
--disable-cuda --disable-nvml --disable-libudev --disable-rsmi
CFLAGS=-fPIC CXXFLAGS=-fPIC
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/Makefile
DEPENDS ${hwloc_targ_SOURCE_DIR}/configure)
add_custom_command(
COMMAND make
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_SOURCE_DIR}/lib/libhwloc.la
DEPENDS ${hwloc_targ_SOURCE_DIR}/Makefile)
add_custom_command(
COMMAND make install
WORKING_DIRECTORY ${hwloc_targ_SOURCE_DIR}
OUTPUT ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a
DEPENDS ${hwloc_targ_SOURCE_DIR}/lib/libhwloc.la)

add_custom_target(hwloc_prod
DEPENDS ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
add_library(hwloc INTERFACE)
target_link_libraries(hwloc
INTERFACE ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
add_dependencies(hwloc hwloc_prod)

set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/lib)
set(LIBHWLOC_INCLUDE_DIRS ${hwloc_targ_BINARY_DIR}/include)
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/lib/libhwloc.a)
endif()
endif() # UMF_LINK_HWLOC_STATICALLY

message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}")
message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}")
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
message(STATUS " LIBHWLOC_API_VERSION = ${LIBHWLOC_API_VERSION}")
if(WINDOWS)
message(STATUS " LIBHWLOC_DLL_DIRS = ${LIBHWLOC_DLL_DIRS}")
endif()

if(hwloc_targ_SOURCE_DIR)
Expand Down Expand Up @@ -463,7 +444,7 @@ if(WINDOWS AND UMF_USE_DEBUG_POSTFIX)
-DUMF_BUILD_TESTS=OFF -DUMF_BUILD_GPU_TESTS=OFF
-DUMF_BUILD_BENCHMARKS=OFF -DUMF_BUILD_BENCHMARKS_MT=OFF
-DUMF_BUILD_EXAMPLES=OFF -DUMF_BUILD_GPU_EXAMPLES=OFF
-DUMF_BUILD_FUZZTESTS=OFF -DUMF_DISABLE_HWLOC=${UMF_DISABLE_HWLOC}
-DUMF_BUILD_FUZZTESTS=OFF
-DUMF_LINK_HWLOC_STATICALLY=${UMF_LINK_HWLOC_STATICALLY}
-DUMF_HWLOC_NAME=${UMF_HWLOC_NAME}
-DUMF_INSTALL_RPATH=${UMF_INSTALL_RPATH} -DUMF_DEVELOPER_MODE=OFF
Expand Down Expand Up @@ -648,9 +629,7 @@ if(WINDOWS)
endif()

# set UMF_PROXY_LIB_ENABLED
if(UMF_DISABLE_HWLOC)
message(STATUS "Disabling the proxy library, because HWLOC is disabled")
elseif(NOT UMF_BUILD_SHARED_LIBRARY)
if(NOT UMF_BUILD_SHARED_LIBRARY)
# TODO enable this scenario
message(
STATUS
Expand Down Expand Up @@ -707,7 +686,7 @@ if(UMF_BUILD_BENCHMARKS)
add_subdirectory(benchmark)
endif()

if(UMF_BUILD_EXAMPLES AND NOT UMF_DISABLE_HWLOC)
if(UMF_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ 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_DISABLE_HWLOC | Disable features that requires hwloc (OS provider, memory targets, topology discovery) | ON/OFF | OFF |

## Architecture: memory pools and providers

Expand Down
Loading