Skip to content

Commit d280a67

Browse files
committed
a
1 parent 0c44ef6 commit d280a67

File tree

7 files changed

+147
-92
lines changed

7 files changed

+147
-92
lines changed

.github/workflows/reusable_basic.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
install_tbb: ['ON']
2727
disable_hwloc: ['OFF']
2828
link_hwloc_statically: ['OFF']
29+
cmake_ver: ['latest']
2930
include:
3031
- os: 'ubuntu-22.04'
3132
build_type: Release
@@ -36,6 +37,8 @@ jobs:
3637
install_tbb: 'ON'
3738
disable_hwloc: 'OFF'
3839
link_hwloc_statically: 'OFF'
40+
# check minimum supported cmake version
41+
cmake_ver: '3.14.0'
3942
- os: 'ubuntu-22.04'
4043
build_type: Release
4144
compiler: {c: gcc, cxx: g++}
@@ -45,6 +48,7 @@ jobs:
4548
install_tbb: 'ON'
4649
disable_hwloc: 'OFF'
4750
link_hwloc_statically: 'OFF'
51+
cmake_ver: 'latest'
4852
- os: 'ubuntu-24.04'
4953
build_type: Debug
5054
compiler: {c: gcc, cxx: g++}
@@ -54,6 +58,7 @@ jobs:
5458
install_tbb: 'ON'
5559
disable_hwloc: 'OFF'
5660
link_hwloc_statically: 'OFF'
61+
cmake_ver: 'latest'
5762
# test level_zero_provider='OFF' and cuda_provider='OFF'
5863
- os: 'ubuntu-22.04'
5964
build_type: Release
@@ -64,6 +69,7 @@ jobs:
6469
install_tbb: 'ON'
6570
disable_hwloc: 'OFF'
6671
link_hwloc_statically: 'OFF'
72+
cmake_ver: 'latest'
6773
# test icx compiler
6874
- os: 'ubuntu-22.04'
6975
build_type: Release
@@ -74,6 +80,7 @@ jobs:
7480
install_tbb: 'ON'
7581
disable_hwloc: 'OFF'
7682
link_hwloc_statically: 'OFF'
83+
cmake_ver: 'latest'
7784
# test lld linker
7885
- os: 'ubuntu-24.04'
7986
build_type: Release
@@ -85,7 +92,8 @@ jobs:
8592
disable_hwloc: 'OFF'
8693
link_hwloc_statically: 'OFF'
8794
llvm_linker: '-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld"'
88-
# test without installing TBB
95+
cmake_ver: 'latest'
96+
# test without installing TBB
8997
- os: 'ubuntu-22.04'
9098
build_type: Release
9199
compiler: {c: gcc, cxx: g++}
@@ -95,6 +103,7 @@ jobs:
95103
install_tbb: 'OFF'
96104
disable_hwloc: 'OFF'
97105
link_hwloc_statically: 'OFF'
106+
cmake_ver: 'latest'
98107
- os: 'ubuntu-22.04'
99108
build_type: Debug
100109
compiler: {c: gcc, cxx: g++}
@@ -104,6 +113,7 @@ jobs:
104113
install_tbb: 'ON'
105114
disable_hwloc: 'ON'
106115
link_hwloc_statically: 'OFF'
116+
cmake_ver: 'latest'
107117
- os: 'ubuntu-22.04'
108118
build_type: Release
109119
compiler: {c: gcc, cxx: g++}
@@ -113,6 +123,7 @@ jobs:
113123
install_tbb: 'ON'
114124
disable_hwloc: 'OFF'
115125
link_hwloc_statically: 'ON'
126+
cmake_ver: 'latest'
116127
runs-on: ${{matrix.os}}
117128

118129
steps:
@@ -124,7 +135,19 @@ jobs:
124135
- name: Install apt packages
125136
run: |
126137
sudo apt-get update
127-
sudo apt-get install -y clang cmake libnuma-dev lcov
138+
sudo apt-get install -y clang libnuma-dev lcov
139+
140+
- name: Install cmake (latest)
141+
if: matrix.cmake_ver == 'latest'
142+
run: |
143+
sudo apt-get install -y cmake
144+
145+
- name: Install cmake (minimum supported version)
146+
if: matrix.cmake_ver != 'latest'
147+
run: |
148+
wget https://github.com/Kitware/CMake/releases/download/v${{matrix.cmake_ver}}/cmake-${{matrix.cmake_ver}}-Linux-x86_64.sh
149+
chmod +x cmake-${{matrix.cmake_ver}}-Linux-x86_64.sh
150+
sudo ./cmake-${{matrix.cmake_ver}}-Linux-x86_64.sh --skip-license --prefix=/usr/local
128151
129152
- name: Install hwloc
130153
if: matrix.disable_hwloc == 'OFF'

CMakeLists.txt

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
message(STATUS "CMake version: ${CMAKE_VERSION}")
56
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
7+
68
# needed when UMF is used as an external project
79
set(UMF_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
810

@@ -404,16 +406,17 @@ if(UMF_BUILD_LEVEL_ZERO_PROVIDER AND (NOT UMF_LEVEL_ZERO_INCLUDE_DIR))
404406
GIT_REPOSITORY ${LEVEL_ZERO_LOADER_REPO}
405407
GIT_TAG ${LEVEL_ZERO_LOADER_TAG}
406408
EXCLUDE_FROM_ALL)
407-
FetchContent_MakeAvailable(level-zero-loader)
409+
# Only populate the repo - we don't need to build it
410+
FetchContent_Populate(level-zero-loader)
408411

409412
set(LEVEL_ZERO_INCLUDE_DIRS
410413
${level-zero-loader_SOURCE_DIR}/include
411-
CACHE PATH "Path to Level Zero Headers")
412-
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
414+
CACHE PATH "Path to Level Zero headers")
415+
message(STATUS "LEVEL_ZERO_INCLUDE_DIRS = ${LEVEL_ZERO_INCLUDE_DIRS}")
413416
elseif(UMF_BUILD_LEVEL_ZERO_PROVIDER)
414417
# Only header is needed to build UMF
415418
set(LEVEL_ZERO_INCLUDE_DIRS ${UMF_LEVEL_ZERO_INCLUDE_DIR})
416-
message(STATUS "Level Zero include directory: ${LEVEL_ZERO_INCLUDE_DIRS}")
419+
message(STATUS "LEVEL_ZERO_INCLUDE_DIRS = ${LEVEL_ZERO_INCLUDE_DIRS}")
417420
endif()
418421

419422
# Fetch CUDA only if needed i.e.: if building CUDA provider is ON and CUDA
@@ -423,14 +426,15 @@ if(UMF_BUILD_CUDA_PROVIDER AND (NOT UMF_CUDA_INCLUDE_DIR))
423426
"https://gitlab.com/nvidia/headers/cuda-individual/cudart.git")
424427
set(CUDA_TAG cuda-12.5.1)
425428

426-
message(STATUS "Fetching CUDA ${CUDA_TAG} from ${CUDA_REPO} ...")
429+
message(STATUS "Fetching CUDA (${CUDA_TAG}) from ${CUDA_REPO} ...")
427430

428431
FetchContent_Declare(
429432
cuda-headers
430433
GIT_REPOSITORY ${CUDA_REPO}
431434
GIT_TAG ${CUDA_TAG}
432435
EXCLUDE_FROM_ALL)
433-
FetchContent_MakeAvailable(cuda-headers)
436+
# Only populate the repo - we don't need to build it
437+
FetchContent_Populate(cuda-headers)
434438

435439
set(CUDA_INCLUDE_DIRS
436440
${cuda-headers_SOURCE_DIR}
@@ -707,16 +711,31 @@ else()
707711
)
708712
endif()
709713

710-
if((UMF_BUILD_GPU_TESTS OR UMF_BUILD_GPU_EXAMPLES) AND UMF_BUILD_CUDA_PROVIDER)
711-
find_package(CUDA REQUIRED cuda)
712-
if(CUDA_LIBRARIES)
713-
set(UMF_CUDA_ENABLED TRUE)
714-
else()
715-
message(
716-
STATUS "Disabling tests and examples that use the CUDA provider "
717-
"because the CUDA libraries they require were not found.")
714+
if(UMF_BUILD_GPU_TESTS OR UMF_BUILD_GPU_EXAMPLES)
715+
if(UMF_BUILD_CUDA_PROVIDER)
716+
find_package(CUDA REQUIRED cuda)
717+
if(CUDA_LIBRARIES)
718+
set(UMF_CUDA_ENABLED TRUE)
719+
else()
720+
message(
721+
STATUS
722+
"Disabling tests and examples that use the CUDA Provider "
723+
"because the CUDA libraries they require were not found.")
724+
endif()
725+
endif()
726+
727+
if(UMF_BUILD_LEVEL_ZERO_PROVIDER)
728+
find_package(ZE_LOADER REQUIRED ze_loader)
729+
if(ZE_LOADER_LIBRARIES)
730+
set(UMF_LEVEL_ZERO_ENABLED TRUE)
731+
else()
732+
message(
733+
STATUS
734+
"Disabling tests and examples that use the Level Zero Provider "
735+
"because the Level Zero libraries they require were not found."
736+
)
737+
endif()
718738
endif()
719-
# TODO do the same for ze_loader
720739
endif()
721740

722741
add_subdirectory(src)

benchmark/CMakeLists.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,6 @@ function(add_umf_benchmark)
8787
set_property(TEST ${BENCH_NAME} PROPERTY ENVIRONMENT_MODIFICATION
8888
"${DLL_PATH_LIST}")
8989
endif()
90-
if(LINUX)
91-
# prepend LD_LIBRARY_PATH with ${CMAKE_BINARY_DIR}/lib it is required
92-
# because ${CMAKE_BINARY_DIR}/lib contains libze_loader.so and tests
93-
# should use it instead of system one.
94-
set_property(
95-
TEST ${BENCH_NAME}
96-
PROPERTY ENVIRONMENT_MODIFICATION
97-
"LD_LIBRARY_PATH=path_list_prepend:${CMAKE_BINARY_DIR}/lib"
98-
)
99-
endif()
10090

10191
if(UMF_POOL_JEMALLOC_ENABLED)
10292
target_compile_definitions(${BENCH_NAME}
@@ -106,14 +96,14 @@ function(add_umf_benchmark)
10696
target_compile_definitions(${BENCH_NAME}
10797
PRIVATE UMF_POOL_SCALABLE_ENABLED=1)
10898
endif()
109-
if(UMF_BUILD_LEVEL_ZERO_PROVIDER)
99+
if(UMF_LEVEL_ZERO_ENABLED)
110100
target_compile_definitions(${BENCH_NAME}
111101
PRIVATE UMF_PROVIDER_LEVEL_ZERO_ENABLED=1)
112102
target_include_directories(
113103
${BENCH_NAME} PRIVATE ${UMF_CMAKE_SOURCE_DIR}/test/common
114104
${LEVEL_ZERO_INCLUDE_DIRS})
115105
endif()
116-
if(UMF_BUILD_CUDA_PROVIDER)
106+
if(UMF_CUDA_ENABLED)
117107
target_compile_definitions(${BENCH_NAME}
118108
PRIVATE UMF_BUILD_CUDA_PROVIDER=1)
119109
target_include_directories(
@@ -131,8 +121,10 @@ set(LIB_DIRS ${LIBHWLOC_LIBRARY_DIRS})
131121
if(LINUX)
132122
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} m)
133123
endif()
134-
if(UMF_BUILD_GPU_TESTS AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
124+
if(UMF_BUILD_GPU_TESTS
125+
AND UMF_LEVEL_ZERO_ENABLED)
135126
set(SRCS_OPTIONAL ${SRCS_OPTIONAL} ../src/utils/utils_level_zero.cpp)
127+
set(LIB_DIRS ${LIB_DIRS} ${ZE_LOADER_LIBRARY_DIRS})
136128
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} ze_loader)
137129
# TODO add CUDA
138130
endif()

cmake/FindZE_LOADER.cmake

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
message(STATUS "Checking for module 'ze_loader' using find_library()")
6+
7+
find_library(ZE_LOADER_LIBRARY NAMES libze_loader ze_loader)
8+
set(ZE_LOADER_LIBRARIES ${ZE_LOADER_LIBRARY})
9+
10+
get_filename_component(ZE_LOADER_LIB_DIR ${ZE_LOADER_LIBRARIES} DIRECTORY)
11+
set(ZE_LOADER_LIBRARY_DIRS ${ZE_LOADER_LIB_DIR})
12+
13+
if(WINDOWS)
14+
find_file(ZE_LOADER_DLL NAMES "ze_loader.dll")
15+
get_filename_component(ZE_LOADER_DLL_DIR ${ZE_LOADER_DLL} DIRECTORY)
16+
set(ZE_LOADER_DLL_DIRS ${ZE_LOADER_DLL_DIR})
17+
endif()
18+
19+
if(ZE_LOADER_LIBRARY)
20+
message(STATUS " Found ZE_LOADER using find_library()")
21+
message(STATUS " ZE_LOADER_LIBRARIES = ${ZE_LOADER_LIBRARIES}")
22+
message(STATUS " ZE_LOADER_INCLUDE_DIRS = ${ZE_LOADER_INCLUDE_DIRS}")
23+
message(STATUS " ZE_LOADER_LIBRARY_DIRS = ${ZE_LOADER_LIBRARY_DIRS}")
24+
if(WINDOWS)
25+
message(STATUS " ZE_LOADER_DLL_DIRS = ${ZE_LOADER_DLL_DIRS}")
26+
endif()
27+
else()
28+
set(MSG_NOT_FOUND "ZE_LOADER NOT found (set CMAKE_PREFIX_PATH to point the "
29+
"location)")
30+
if(ZE_LOADER_FIND_REQUIRED)
31+
message(FATAL_ERROR ${MSG_NOT_FOUND})
32+
else()
33+
message(WARNING ${MSG_NOT_FOUND})
34+
endif()
35+
endif()

examples/CMakeLists.txt

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ if(UMF_POOL_SCALABLE_ENABLED)
4141
endif()
4242
endif()
4343

44-
if(UMF_BUILD_GPU_EXAMPLES AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
44+
if(UMF_BUILD_GPU_EXAMPLES
45+
AND UMF_LEVEL_ZERO_ENABLED)
4546
set(EXAMPLE_NAME umf_example_level_zero_shared_memory)
4647

4748
add_umf_executable(
@@ -56,7 +57,7 @@ if(UMF_BUILD_GPU_EXAMPLES AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
5657
${UMF_CMAKE_SOURCE_DIR}/include
5758
${UMF_CMAKE_SOURCE_DIR}/examples/common)
5859

59-
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS})
60+
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS} ${ZE_LOADER_LIBRARY_DIRS})
6061

6162
add_test(
6263
NAME ${EXAMPLE_NAME}
@@ -70,24 +71,13 @@ if(UMF_BUILD_GPU_EXAMPLES AND UMF_BUILD_LEVEL_ZERO_PROVIDER)
7071
set_property(TEST ${EXAMPLE_NAME} PROPERTY ENVIRONMENT_MODIFICATION
7172
"${DLL_PATH_LIST}")
7273
endif()
73-
if(LINUX)
74-
# prepend LD_LIBRARY_PATH with ${CMAKE_BINARY_DIR}/lib it is required
75-
# because ${CMAKE_BINARY_DIR}/lib contains libze_loader.so and tests
76-
# should use it instead of system one.
77-
set_property(
78-
TEST ${EXAMPLE_NAME}
79-
PROPERTY ENVIRONMENT_MODIFICATION
80-
"LD_LIBRARY_PATH=path_list_prepend:${CMAKE_BINARY_DIR}/lib"
81-
)
82-
endif()
8374
else()
8475
message(STATUS "GPU Level Zero shared memory example requires "
8576
"UMF_BUILD_GPU_EXAMPLES and UMF_BUILD_LEVEL_ZERO_PROVIDER "
8677
"to be turned ON - skipping")
8778
endif()
8879

8980
if(UMF_BUILD_GPU_EXAMPLES
90-
AND UMF_BUILD_CUDA_PROVIDER
9181
AND UMF_CUDA_ENABLED)
9282
set(EXAMPLE_NAME umf_example_cuda_shared_memory)
9383

@@ -127,7 +117,7 @@ endif()
127117
# TODO: it looks like there is some problem with IPC implementation in Level
128118
# Zero on windows
129119
if(UMF_BUILD_GPU_EXAMPLES
130-
AND UMF_BUILD_LEVEL_ZERO_PROVIDER
120+
AND UMF_LEVEL_ZERO_ENABLED
131121
AND LINUX)
132122
set(EXAMPLE_NAME umf_example_ipc_level_zero)
133123

@@ -143,7 +133,7 @@ if(UMF_BUILD_GPU_EXAMPLES
143133
${UMF_CMAKE_SOURCE_DIR}/include
144134
${UMF_CMAKE_SOURCE_DIR}/examples/common)
145135

146-
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS})
136+
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS} ${ZE_LOADER_LIBRARY_DIRS})
147137

148138
add_test(
149139
NAME ${EXAMPLE_NAME}
@@ -157,16 +147,6 @@ if(UMF_BUILD_GPU_EXAMPLES
157147
set_property(TEST ${EXAMPLE_NAME} PROPERTY ENVIRONMENT_MODIFICATION
158148
"${DLL_PATH_LIST}")
159149
endif()
160-
if(LINUX)
161-
# prepend LD_LIBRARY_PATH with ${CMAKE_BINARY_DIR}/lib it is required
162-
# because ${CMAKE_BINARY_DIR}/lib contains libze_loader.so and tests
163-
# should use it instead of system one.
164-
set_property(
165-
TEST ${EXAMPLE_NAME}
166-
PROPERTY ENVIRONMENT_MODIFICATION
167-
"LD_LIBRARY_PATH=path_list_prepend:${CMAKE_BINARY_DIR}/lib"
168-
)
169-
endif()
170150
else()
171151
message(
172152
STATUS

0 commit comments

Comments
 (0)