Skip to content

Commit 3d8fe8d

Browse files
authored
Merge pull request #1430 from igchor/umf_dynamic_linking
Bump UMF version and switch to dynamic linking
2 parents e8c9f3d + 0a259f3 commit 3d8fe8d

26 files changed

+132
-58
lines changed

.github/docker/ubuntu-22.04.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ ARG BASE_DEPS="\
3232
ARG UR_DEPS="\
3333
doxygen \
3434
python3 \
35-
python3-pip"
35+
python3-pip \
36+
libhwloc-dev"
3637

3738
# Unified Runtime's dependencies (installed via pip)
3839
ARG UR_PYTHON_DEPS="\

.github/scripts/install_hwloc.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2024 Intel Corporation
4+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
5+
# See LICENSE.TXT
6+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
8+
# install_hwloc.sh - Script for building and installing HWLOC library from source code
9+
10+
set -e
11+
12+
git clone -b hwloc-2.3.0 https://github.com/open-mpi/hwloc.git
13+
pushd hwloc
14+
./autogen.sh
15+
./configure
16+
make -j$(nproc)
17+
sudo make install -j$(nproc)
18+
popd

.github/workflows/cmake.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
sudo apt-get update
4848
sudo apt-get install -y doxygen ${{matrix.compiler.c}}
4949
50+
- name: Install libhwloc
51+
run: .github/scripts/install_hwloc.sh
52+
5053
- name: Install g++-7
5154
if: matrix.compiler.cxx == 'g++-7'
5255
run: |
@@ -224,11 +227,17 @@ jobs:
224227
Expand-Archive -Path "$WorkingDir\doxygen.zip"
225228
Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen"
226229
230+
- name: Install hwloc
231+
run: vcpkg install hwloc:x64-windows
232+
227233
- name: Configure CMake
234+
env:
235+
VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows"
228236
run: >
229237
cmake
230238
-B${{github.workspace}}/build
231239
${{matrix.toolset}}
240+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
232241
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
233242
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
234243
-DCMAKE_POLICY_DEFAULT_CMP0094=NEW
@@ -267,6 +276,9 @@ jobs:
267276
- name: Install prerequisites
268277
run: python3 -m pip install -r third_party/requirements.txt
269278

279+
- name: Install hwloc
280+
run: brew install hwloc
281+
270282
- name: Configure CMake
271283
run: >
272284
cmake

.github/workflows/codeql.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
- name: Install pip packages
3232
run: pip install -r third_party/requirements.txt
3333

34+
- name: Install apt packages
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y libhwloc-dev
38+
3439
- name: Configure CMake
3540
run: cmake -B ${{github.workspace}}/build -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON
3641

@@ -61,8 +66,13 @@ jobs:
6166
- name: Install pip packages
6267
run: python3 -m pip install -r third_party/requirements.txt
6368

69+
- name: Install hwloc
70+
run: vcpkg install hwloc:x64-windows
71+
6472
- name: Configure CMake
65-
run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON
73+
env:
74+
VCPKG_PATH: "C:/vcpkg/packages/hwloc_x64-windows"
75+
run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON -DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
6676

6777
- name: Build
6878
run: cmake --build ${{github.workspace}}/build -j $(nproc) --config Release

.github/workflows/coverity.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
- name: Install pip packages
3939
run: pip install -r third_party/requirements.txt
4040

41+
- name: Install apt packages
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y libhwloc-dev
45+
4146
- name: Configure CMake
4247
run: >
4348
cmake

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ option(UR_USE_MSAN "enable MemorySanitizer" OFF)
3737
option(UR_USE_TSAN "enable ThreadSanitizer" OFF)
3838
option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF)
3939
option(UR_ENABLE_SANITIZER "enable device sanitizer" ON)
40-
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
40+
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" ON)
4141
option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON)
4242
option(UR_BUILD_ADAPTER_L0 "Build the Level-Zero adapter" OFF)
4343
option(UR_BUILD_ADAPTER_OPENCL "Build the OpenCL adapter" OFF)

source/adapters/cuda/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ endif()
114114
target_link_libraries(${TARGET_NAME} PRIVATE
115115
${PROJECT_NAME}::headers
116116
${PROJECT_NAME}::common
117+
${PROJECT_NAME}::umf
117118
Threads::Threads
118119
cudadrv
119120
${EXTRA_LIBS}

source/adapters/cuda/usm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
398398

399399
HostMemPool =
400400
umf::poolMakeUniqueFromOps(
401-
&UMF_DISJOINT_POOL_OPS, std::move(MemProvider),
401+
umfDisjointPoolOps(), std::move(MemProvider),
402402
&this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Host])
403403
.second;
404404

@@ -407,15 +407,15 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context,
407407
umf::memoryProviderMakeUnique<USMDeviceMemoryProvider>(Context, Device)
408408
.second;
409409
DeviceMemPool = umf::poolMakeUniqueFromOps(
410-
&UMF_DISJOINT_POOL_OPS, std::move(MemProvider),
410+
umfDisjointPoolOps(), std::move(MemProvider),
411411
&this->DisjointPoolConfigs
412412
.Configs[usm::DisjointPoolMemType::Device])
413413
.second;
414414
MemProvider =
415415
umf::memoryProviderMakeUnique<USMSharedMemoryProvider>(Context, Device)
416416
.second;
417417
SharedMemPool = umf::poolMakeUniqueFromOps(
418-
&UMF_DISJOINT_POOL_OPS, std::move(MemProvider),
418+
umfDisjointPoolOps(), std::move(MemProvider),
419419
&this->DisjointPoolConfigs
420420
.Configs[usm::DisjointPoolMemType::Shared])
421421
.second;

source/adapters/cuda/usm.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class USMMemoryProvider {
8181
umf_result_t purge_force(void *, size_t) {
8282
return UMF_RESULT_ERROR_NOT_SUPPORTED;
8383
};
84+
umf_result_t allocation_merge(void *, void *, size_t) {
85+
return UMF_RESULT_ERROR_UNKNOWN;
86+
}
87+
umf_result_t allocation_split(void *, size_t, size_t) {
88+
return UMF_RESULT_ERROR_UNKNOWN;
89+
}
8490
virtual const char *get_name() = 0;
8591

8692
virtual ~USMMemoryProvider() = default;

source/adapters/hip/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ if("${UR_HIP_PLATFORM}" STREQUAL "AMD")
140140
target_link_libraries(${TARGET_NAME} PRIVATE
141141
${PROJECT_NAME}::headers
142142
${PROJECT_NAME}::common
143+
${PROJECT_NAME}::umf
143144
rocmdrv
144145
)
145146

@@ -174,6 +175,7 @@ elseif("${UR_HIP_PLATFORM}" STREQUAL "NVIDIA")
174175
target_link_libraries(${TARGET_NAME} PRIVATE
175176
${PROJECT_NAME}::headers
176177
${PROJECT_NAME}::common
178+
${PROJECT_NAME}::umf
177179
Threads::Threads
178180
cudadrv
179181
cudart

0 commit comments

Comments
 (0)