Skip to content

Commit 3ce2d6f

Browse files
authored
Merge pull request #348 from igchor/os_provider_always_build
Enable OS memory provider building for all systems and remove the option to disable it
2 parents e493cbb + 8313be7 commit 3ce2d6f

File tree

16 files changed

+61
-207
lines changed

16 files changed

+61
-207
lines changed

.github/workflows/basic.yml

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
compiler: [{c: icx, cxx: icpx}]
1717
pool_tracking: ['ON', 'OFF']
1818
shared_library: ['OFF']
19-
os_provider: ['ON']
2019
env:
2120
BUILD_DIR : "${{github.workspace}}/build/"
2221
INSTL_DIR : "${{github.workspace}}/../install-dir"
@@ -46,8 +45,7 @@ jobs:
4645
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
4746
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
4847
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
49-
-DUMF_BUILD_OS_MEMORY_PROVIDER=${{matrix.os_provider}}
50-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
48+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
5149
-DUMF_ENABLE_POOL_TRACKING=${{matrix.pool_tracking}}
5250
-DUMF_FORMAT_CODE_STYLE=OFF
5351
-DUMF_DEVELOPER_MODE=ON
@@ -65,7 +63,7 @@ jobs:
6563

6664
- name: Test UMF installation and uninstallation
6765
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
68-
# OS provider, pool tracking and scalable pool (always ON in this job) has to be enabled for the basic example to be built
66+
# pool tracking and scalable pool (always ON in this job) has to be enabled for the basic example to be built
6967
# The '--examples' parameter is added to the installation test when examples are built
7068
run: >
7169
python3 ${{github.workspace}}/test/test_installation.py
@@ -76,7 +74,7 @@ jobs:
7674
--jemalloc-pool
7775
--scalable-pool
7876
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
79-
${{ (matrix.os_provider == 'ON' && matrix.pool_tracking == 'ON') && '--examples' || '' }}
77+
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
8078
8179
ubuntu-build:
8280
name: Ubuntu
@@ -87,59 +85,37 @@ jobs:
8785
compiler: [{c: gcc, cxx: g++}]
8886
pool_tracking: ['ON', 'OFF']
8987
shared_library: ['OFF']
90-
os_provider: ['ON']
9188
level_zero_provider: ['ON']
9289
include:
9390
- os: 'ubuntu-20.04'
9491
build_type: Release
9592
compiler: {c: gcc-7, cxx: g++-7}
9693
shared_library: 'OFF'
97-
os_provider: 'ON'
9894
pool_tracking: 'ON'
9995
level_zero_provider: 'ON'
10096
- os: 'ubuntu-22.04'
10197
build_type: Release
10298
compiler: {c: clang, cxx: clang++}
10399
shared_library: 'OFF'
104-
os_provider: 'ON'
105100
pool_tracking: 'ON'
106101
level_zero_provider: 'ON'
107102
- os: 'ubuntu-22.04'
108103
build_type: Release
109104
compiler: {c: gcc, cxx: g++}
110105
shared_library: 'ON'
111-
os_provider: 'ON'
112106
pool_tracking: 'ON'
113107
level_zero_provider: 'ON'
114108
- os: 'ubuntu-22.04'
115109
build_type: Debug
116110
compiler: {c: gcc, cxx: g++}
117111
shared_library: 'ON'
118-
os_provider: 'ON'
119-
pool_tracking: 'ON'
120-
level_zero_provider: 'ON'
121-
# test os_provider='OFF' with shared_library='ON'
122-
- os: 'ubuntu-22.04'
123-
build_type: Release
124-
compiler: {c: gcc, cxx: g++}
125-
shared_library: 'ON'
126-
os_provider: 'OFF'
127-
pool_tracking: 'ON'
128-
level_zero_provider: 'ON'
129-
# test os_provider='OFF' with shared_library='OFF'
130-
- os: 'ubuntu-22.04'
131-
build_type: Release
132-
compiler: {c: gcc, cxx: g++}
133-
shared_library: 'OFF'
134-
os_provider: 'OFF'
135112
pool_tracking: 'ON'
136113
level_zero_provider: 'ON'
137114
# test level_zero_provider='OFF'
138115
- os: 'ubuntu-22.04'
139116
build_type: Release
140117
compiler: {c: gcc, cxx: g++}
141118
shared_library: 'OFF'
142-
os_provider: 'ON'
143119
pool_tracking: 'ON'
144120
level_zero_provider: 'OFF'
145121
env:
@@ -169,7 +145,6 @@ jobs:
169145
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
170146
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
171147
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
172-
-DUMF_BUILD_OS_MEMORY_PROVIDER=${{matrix.os_provider}}
173148
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${{matrix.level_zero_provider}}
174149
-DUMF_ENABLE_POOL_TRACKING=${{matrix.pool_tracking}}
175150
-DUMF_FORMAT_CODE_STYLE=OFF
@@ -198,7 +173,7 @@ jobs:
198173
--jemalloc-pool
199174
--scalable-pool
200175
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}
201-
${{ (matrix.os_provider == 'ON' && matrix.pool_tracking == 'ON') && '--examples' || '' }}
176+
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
202177
203178
windows-build:
204179
name: Windows
@@ -213,36 +188,25 @@ jobs:
213188
compiler: [{c: cl, cxx: cl}]
214189
pool_tracking: ['ON', 'OFF']
215190
shared_library: ['OFF']
216-
os_provider: ['ON']
217191
level_zero_provider: ['ON']
218192
include:
219193
- os: 'windows-2022'
220194
build_type: Release
221195
compiler: {c: clang-cl, cxx: clang-cl}
222196
pool_tracking: 'ON'
223-
os_provider: 'ON'
224197
level_zero_provider: 'ON'
225198
toolset: "-T ClangCL"
226199
- os: 'windows-2022'
227200
build_type: Release
228201
compiler: {c: cl, cxx: cl}
229202
pool_tracking: 'ON'
230203
shared_library: 'ON'
231-
os_provider: 'ON'
232-
level_zero_provider: 'ON'
233-
- os: 'windows-2022'
234-
build_type: Release
235-
compiler: {c: cl, cxx: cl}
236-
pool_tracking: 'ON'
237-
shared_library: 'ON'
238-
os_provider: 'OFF'
239204
level_zero_provider: 'ON'
240205
- os: 'windows-2022'
241206
build_type: Release
242207
compiler: {c: cl, cxx: cl}
243208
pool_tracking: 'ON'
244209
shared_library: 'ON'
245-
os_provider: 'ON'
246210
level_zero_provider: 'OFF'
247211

248212
runs-on: ${{matrix.os}}
@@ -277,7 +241,6 @@ jobs:
277241
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
278242
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
279243
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
280-
-DUMF_BUILD_OS_MEMORY_PROVIDER=${{matrix.os_provider}}
281244
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${{matrix.level_zero_provider}}
282245
283246
- name: Build UMF
@@ -300,7 +263,7 @@ jobs:
300263
--jemalloc-pool
301264
--scalable-pool
302265
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
303-
${{ (matrix.os_provider == 'ON' && matrix.pool_tracking == 'ON') && '--examples' || '' }}
266+
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
304267
305268
macos-build:
306269
name: MacOS
@@ -320,6 +283,9 @@ jobs:
320283
- name: Install Python requirements
321284
run: python3 -m pip install -r third_party/requirements.txt
322285

286+
- name: Install hwloc
287+
run: brew install hwloc
288+
323289
- name: Configure build
324290
run: >
325291
cmake
@@ -329,7 +295,6 @@ jobs:
329295
-DUMF_DEVELOPER_MODE=ON
330296
-DUMF_ENABLE_POOL_TRACKING=ON
331297
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
332-
-DUMF_BUILD_OS_MEMORY_PROVIDER=OFF
333298
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=OFF
334299
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
335300
-DUMF_BUILD_SHARED_LIBRARY=ON

.github/workflows/benchmarks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
-DUMF_FORMAT_CODE_STYLE=OFF
5454
-DUMF_DEVELOPER_MODE=OFF
5555
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
56-
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
5756
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
5857
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
5958
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON

.github/workflows/pr_push.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,13 @@ jobs:
9494
- name: Install apt packages
9595
run: |
9696
sudo apt-get update
97-
sudo apt-get install -y cmake clang-format-15
97+
sudo apt-get install -y cmake clang-format-15 libhwloc-dev
9898
9999
- name: Configure CMake
100100
run: >
101101
cmake
102102
-B ${{github.workspace}}/build
103103
-DUMF_FORMAT_CODE_STYLE=ON
104-
-DUMF_BUILD_OS_MEMORY_PROVIDER=OFF
105104
-DUMF_BUILD_TESTS=OFF
106105
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
107106
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=OFF

.github/workflows/sanitizers.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
-DUMF_BUILD_SHARED_LIBRARY=OFF
4747
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
4848
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
49-
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
5049
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
5150
-DUMF_ENABLE_POOL_TRACKING=ON
5251
-DUMF_FORMAT_CODE_STYLE=OFF
@@ -96,7 +95,6 @@ jobs:
9695
-DUMF_BUILD_SHARED_LIBRARY=OFF
9796
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
9897
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
99-
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
10098
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
10199
-DUMF_ENABLE_POOL_TRACKING=ON
102100
-DUMF_FORMAT_CODE_STYLE=OFF
@@ -168,7 +166,6 @@ jobs:
168166
-DUMF_DEVELOPER_MODE=ON
169167
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
170168
-DUSE_ASAN=${{matrix.sanitizers.asan}}
171-
-DUMF_BUILD_OS_MEMORY_PROVIDER=ON
172169
-DUMF_BUILD_EXAMPLES=ON
173170
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
174171

CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ project(unified-memory-framework VERSION 0.1.0 LANGUAGES C)
77

88
# Build Options
99
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
10-
option(UMF_BUILD_OS_MEMORY_PROVIDER "Build OS memory provider" ON)
1110
option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON)
1211
option(UMF_BUILD_LIBUMF_POOL_DISJOINT "Build the libumf_pool_disjoint static library" OFF)
1312
option(UMF_BUILD_LIBUMF_POOL_JEMALLOC "Build the libumf_pool_jemalloc static library" OFF)
@@ -120,14 +119,12 @@ if(WINDOWS)
120119
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
121120
endif()
122121

123-
if(UMF_BUILD_OS_MEMORY_PROVIDER AND (LINUX OR WINDOWS))
124-
pkg_check_modules(LIBHWLOC hwloc)
125-
if(NOT LIBHWLOC_FOUND)
126-
find_package(LIBHWLOC REQUIRED hwloc)
127-
endif()
128-
# add PATH to DLL on Windows
129-
set(DLL_PATH_LIST "${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS}/../bin")
122+
pkg_check_modules(LIBHWLOC hwloc)
123+
if(NOT LIBHWLOC_FOUND)
124+
find_package(LIBHWLOC REQUIRED hwloc)
130125
endif()
126+
# add PATH to DLL on Windows
127+
set(DLL_PATH_LIST "${DLL_PATH_LIST};PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS}/../bin")
131128

132129
if(UMF_BUILD_LIBUMF_POOL_SCALABLE AND (LINUX OR WINDOWS))
133130
pkg_check_modules(TBB tbb)

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ which includes the code of the basic [example](https://github.com/oneapi-src/uni
2424
### Requirements
2525

2626
Required packages:
27+
- libhwloc-dev (Linux) / hwloc (Windows)
2728
- C compiler
2829
- [CMake](https://cmake.org/) >= 3.14.0
2930

@@ -89,7 +90,6 @@ List of options provided by CMake:
8990
| Name | Description | Values | Default |
9091
| - | - | - | - |
9192
| UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
92-
| UMF_BUILD_OS_MEMORY_PROVIDER | Build OS memory provider | ON/OFF | ON |
9393
| UMF_BUILD_LEVEL_ZERO_PROVIDER | Build Level Zero memory provider | ON/OFF | ON |
9494
| UMF_BUILD_LIBUMF_POOL_DISJOINT | Build the libumf_pool_disjoint static library | ON/OFF | OFF |
9595
| UMF_BUILD_LIBUMF_POOL_JEMALLOC | Build the libumf_pool_jemalloc static library | ON/OFF | OFF |
@@ -125,10 +125,7 @@ A memory provider that provides memory from an operating system.
125125

126126
##### Requirements
127127

128-
1) The `UMF_BUILD_OS_MEMORY_PROVIDER` option turned `ON` (by default)
129-
2) Required packages:
130-
- libhwloc-dev (Linux) / hwloc (Windows)
131-
3) Required packages for tests (Linux-only yet):
128+
Required packages for tests (Linux-only yet):
132129
- libnuma-dev
133130

134131
#### Level Zero memory provider (Linux-only yet)

benchmark/CMakeLists.txt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ function(add_umf_benchmark)
4747
set_property(TEST ${BENCH_NAME} PROPERTY ENVIRONMENT_MODIFICATION "${DLL_PATH_LIST}")
4848
endif()
4949

50-
if (UMF_BUILD_OS_MEMORY_PROVIDER)
51-
target_compile_definitions(${BENCH_NAME} PRIVATE UMF_BUILD_OS_MEMORY_PROVIDER=1)
52-
endif()
5350
if (UMF_BUILD_LIBUMF_POOL_DISJOINT)
5451
target_compile_definitions(${BENCH_NAME} PRIVATE UMF_BUILD_LIBUMF_POOL_DISJOINT=1)
5552
endif()
@@ -61,37 +58,35 @@ function(add_umf_benchmark)
6158
endif()
6259
endfunction()
6360

61+
set(LIB_DIRS ${LIBHWLOC_LIBRARY_DIRS})
62+
6463
# optional libraries
6564
if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
6665
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} disjoint_pool)
6766
endif()
6867
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
6968
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} jemalloc_pool ${JEMALLOC_LIBRARIES})
70-
set(LIB_DIRS_OPTIONAL ${LIB_DIRS_OPTIONAL} ${JEMALLOC_LIBRARY_DIRS})
69+
set(LIB_DIRS ${LIB_DIRS} ${JEMALLOC_LIBRARY_DIRS})
7170
endif()
7271
if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
7372
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} scalable_pool)
7473
endif()
7574
if(LINUX)
7675
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} m)
7776
endif()
78-
if(UMF_BUILD_OS_MEMORY_PROVIDER)
79-
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} ${LIBHWLOC_LIBRARIES})
80-
set(LIB_DIRS_OPTIONAL ${LIB_DIRS_OPTIONAL} ${LIBHWLOC_LIBRARY_DIRS})
81-
endif()
8277

8378
# BENCHMARKS
8479

8580
add_umf_benchmark(
8681
NAME ubench
8782
SRCS ubench.c
8883
LIBS ${LIBS_OPTIONAL}
89-
LIBDIRS ${LIB_DIRS_OPTIONAL})
84+
LIBDIRS ${LIB_DIRS})
9085

9186
if (UMF_BUILD_BENCHMARKS_MT)
9287
add_umf_benchmark(
9388
NAME multithreaded
9489
SRCS multithread.cpp
9590
LIBS ${LIBS_OPTIONAL} ${CMAKE_THREAD_LIBS_INIT}
96-
LIBDIRS ${LIB_DIRS_OPTIONAL})
91+
LIBDIRS ${LIB_DIRS})
9792
endif()

benchmark/multithread.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,9 @@ static void mt_alloc_free(poolCreateExtParams params,
9191
}
9292

9393
int main() {
94-
#if defined(UMF_BUILD_OS_MEMORY_PROVIDER)
9594
auto osParams = umfOsMemoryProviderParamsDefault();
96-
#endif
9795

98-
#if defined(UMF_BUILD_OS_MEMORY_PROVIDER) && \
99-
defined(UMF_BUILD_LIBUMF_POOL_SCALABLE)
96+
#if defined(UMF_BUILD_LIBUMF_POOL_SCALABLE)
10097

10198
// Increase iterations for scalable pool since it runs much faster than the remaining
10299
// ones.
@@ -111,17 +108,15 @@ int main() {
111108
std::cout << "skipping scalable_pool mt_alloc_free" << std::endl;
112109
#endif
113110

114-
#if defined(UMF_BUILD_OS_MEMORY_PROVIDER) && \
115-
defined(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
111+
#if defined(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
116112
std::cout << "jemalloc_pool mt_alloc_free: ";
117113
mt_alloc_free(poolCreateExtParams{umfJemallocPoolOps(), nullptr,
118114
umfOsMemoryProviderOps(), &osParams});
119115
#else
120116
std::cout << "skipping jemalloc_pool mt_alloc_free" << std::endl;
121117
#endif
122118

123-
#if defined(UMF_BUILD_OS_MEMORY_PROVIDER) && \
124-
defined(UMF_BUILD_LIBUMF_POOL_DISJOINT)
119+
#if defined(UMF_BUILD_LIBUMF_POOL_DISJOINT)
125120
auto disjointParams = umfDisjointPoolParamsDefault();
126121

127122
std::cout << "disjoint_pool mt_alloc_free: ";

0 commit comments

Comments
 (0)