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
13 changes: 11 additions & 2 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
level_zero_provider: ['ON']
install_tbb: ['ON']
disable_hwloc: ['OFF']
link_hwloc_statically: ['OFF']
include:
- os: 'ubuntu-20.04'
build_type: Release
Expand Down Expand Up @@ -71,12 +72,19 @@ jobs:
level_zero_provider: 'ON'
install_tbb: 'OFF'
- os: 'ubuntu-22.04'
build_type: Release
build_type: Debug
compiler: {c: gcc, cxx: g++}
shared_library: 'ON'
level_zero_provider: 'ON'
install_tbb: 'ON'
disable_hwloc: 'ON'
- os: 'ubuntu-22.04'
build_type: Release
compiler: {c: gcc, cxx: g++}
shared_library: 'ON'
level_zero_provider: 'ON'
install_tbb: 'ON'
link_hwloc_statically: 'ON'
runs-on: ${{matrix.os}}

steps:
Expand Down Expand Up @@ -131,6 +139,7 @@ jobs:
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_DISABLE_HWLOC=${{matrix.disable_hwloc}}
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.link_hwloc_statically}}

- name: Build UMF
run: cmake --build ${{env.BUILD_DIR}} -j $(nproc)
Expand All @@ -153,7 +162,7 @@ jobs:
--build-type ${{matrix.build_type}}
--disjoint-pool
--jemalloc-pool
${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && '--proxy' || '' }}
${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.link_hwloc_statically != 'ON' && '--proxy' || '' }}
--umf-version ${{env.UMF_VERSION}}
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}

Expand Down
81 changes: 73 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
option(UMF_LINK_HWLOC_STATICALLY
"Link UMF with HWLOC library statically (Windows+Release only)" OFF)
option(
UMF_LINK_HWLOC_STATICALLY
"Link UMF with HWLOC library statically (supported for Linux, MacOS and Release build on Windows)"
OFF)
option(UMF_FORMAT_CODE_STYLE
"Add clang, cmake, and black -format-check and -format-apply targets"
OFF)
Expand Down Expand Up @@ -98,6 +100,14 @@ else()
message(FATAL_ERROR "Unknown OS type")
endif()

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

if(NOT UMF_LINK_HWLOC_STATICALLY)
if(NOT UMF_DISABLE_HWLOC)
pkg_check_modules(LIBHWLOC hwloc>=2.3.0)
Expand All @@ -110,18 +120,22 @@ if(NOT UMF_LINK_HWLOC_STATICALLY)
"${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS}/../bin"
)
endif()
else()
if(NOT WINDOWS)
message(FATAL_ERROR "hwloc can be statically linked only on Windows")
endif()
# add PATH to DLL on Windows
set(DLL_PATH_LIST
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this seems like a redundant code...?

"${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS}/../bin"
)
elseif(WINDOWS)
include(FetchContent)
set(HWLOC_ENABLE_TESTING OFF)
set(HWLOC_SKIP_LSTOPO ON)
set(HWLOC_SKIP_TOOLS ON)

message(STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO}")

FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY "https://github.com/open-mpi/hwloc.git"
GIT_TAG hwloc-2.10.0
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG}
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)

FetchContent_GetProperties(hwloc_targ)
Expand All @@ -134,6 +148,57 @@ else()
set(LIBHWLOC_LIBRARY_DIRS
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)

message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}")
message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}")
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
else()
include(FetchContent)
message(STATUS "Will fetch hwloc from ${UMF_HWLOC_REPO}")

FetchContent_Declare(
hwloc_targ
GIT_REPOSITORY ${UMF_HWLOC_REPO}
GIT_TAG ${UMF_HWLOC_TAG})

FetchContent_GetProperties(hwloc_targ)
if(NOT hwloc_targ_POPULATED)
FetchContent_MakeAvailable(hwloc_targ)
endif()

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-levelzero
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)

message(STATUS " LIBHWLOC_LIBRARIES = ${LIBHWLOC_LIBRARIES}")
message(STATUS " LIBHWLOC_INCLUDE_DIRS = ${LIBHWLOC_INCLUDE_DIRS}")
message(STATUS " LIBHWLOC_LIBRARY_DIRS = ${LIBHWLOC_LIBRARY_DIRS}")
Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ add_umf_test(
# tests for the proxy library
if(UMF_PROXY_LIB_ENABLED
AND UMF_BUILD_SHARED_LIBRARY
AND NOT UMF_DISABLE_HWLOC)
AND NOT UMF_DISABLE_HWLOC
AND NOT UMF_LINK_HWLOC_STATICALLY)
add_umf_test(
NAME proxy_lib_basic
SRCS ${BA_SOURCES_FOR_TEST} test_proxy_lib.cpp
Expand Down
Loading