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
34 changes: 4 additions & 30 deletions .github/workflows/reusable_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
level_zero_provider: ['ON']
cuda_provider: ['ON']
install_tbb: ['ON']
disable_hwloc: ['OFF']
link_hwloc_statically: ['OFF']
cmake_ver: ['default']
include:
Expand All @@ -41,7 +40,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
# check minimum supported cmake version
cmake_ver: '3.14.0'
Expand All @@ -52,7 +50,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
cmake_ver: '3.28.0'
- os: ubuntu-24.04
Expand All @@ -62,7 +59,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
cmake_ver: 'default'
# test level_zero_provider='OFF' and cuda_provider='OFF'
Expand All @@ -73,7 +69,6 @@ jobs:
level_zero_provider: 'OFF'
cuda_provider: 'OFF'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
cmake_ver: 'default'
# test icx compiler
Expand All @@ -84,7 +79,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
cmake_ver: 'default'
# test lld linker
Expand All @@ -95,7 +89,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"'
cmake_ver: 'default'
Expand All @@ -107,17 +100,6 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'OFF'
disable_hwloc: 'OFF'
link_hwloc_statically: 'OFF'
cmake_ver: 'default'
- 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'
cmake_ver: 'default'
- os: ubuntu-22.04
Expand All @@ -127,10 +109,9 @@ jobs:
level_zero_provider: 'ON'
cuda_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'OFF'
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}}, disable_hwloc=${{matrix.disable_hwloc}}, link_hwloc_statically=${{matrix.link_hwloc_statically}}, cmake_ver=${{matrix.cmake_ver}})
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}})

steps:
- name: Checkout
Expand All @@ -146,12 +127,6 @@ jobs:
chmod +x cmake-${{matrix.cmake_ver}}-Linux-x86_64.sh
echo ${USERPASS} | sudo -Sk ./cmake-${{matrix.cmake_ver}}-Linux-x86_64.sh --skip-license --prefix=/usr/local

- name: Uninstall hwloc
if: matrix.disable_hwloc == 'ON'
run: |
echo ${USERPASS} | sudo -Sk apt-get remove --purge -y '*hwloc*'
echo ${USERPASS} | sudo -Sk apt-get autoremove -y

- name: Uninstall TBB apt package
if: matrix.install_tbb == 'OFF'
run: |
Expand Down Expand Up @@ -185,7 +160,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 @@ -205,7 +179,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 @@ -214,7 +188,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 @@ -226,7 +200,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
200 changes: 86 additions & 114 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ 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 (supported only on Linux with Clang)" 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 @@ -119,13 +115,6 @@ set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS})
list(APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)

if(UMF_DISABLE_HWLOC)
message(
WARNING
"UMF_DISABLE_HWLOC option is now deprecated and will be removed in v0.12.0 UMF release!"
)
endif()

# --------------------------------------------------------------------------- #
# Setup required variables, definitions; fetch dependencies; include
# sub_directories based on build options; set flags; etc.
Expand Down Expand Up @@ -260,7 +249,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 @@ -275,110 +264,95 @@ 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)
set(LIBHWLOC_FOUND TRUE)
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)
set(LIBHWLOC_FOUND TRUE)
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)
set(LIBHWLOC_FOUND TRUE)
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)
set(LIBHWLOC_FOUND TRUE)
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 @@ -533,7 +507,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 @@ -756,9 +730,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 @@ -803,7 +775,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
Loading
Loading