Skip to content

Commit 96695df

Browse files
authored
Merge branch 'main' into licenseNew
2 parents 007a4cd + 9d98b90 commit 96695df

File tree

13 files changed

+463
-421
lines changed

13 files changed

+463
-421
lines changed

.github/workflows/reusable_basic.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ permissions:
77
contents: read
88

99
env:
10-
# for installation testing - it should match with version set in git
11-
UMF_VERSION: 0.11.0
1210
BUILD_DIR : "${{github.workspace}}/build"
1311
INSTL_DIR : "${{github.workspace}}/../install-dir"
1412
COVERAGE_DIR : "${{github.workspace}}/coverage"
@@ -76,15 +74,15 @@ jobs:
7674
disable_hwloc: 'OFF'
7775
link_hwloc_statically: 'OFF'
7876
# test icx compiler
79-
# - os: 'ubuntu-22.04'
80-
# build_type: Release
81-
# compiler: {c: icx, cxx: icpx}
82-
# shared_library: 'ON'
83-
# level_zero_provider: 'ON'
84-
# cuda_provider: 'ON'
85-
# install_tbb: 'ON'
86-
# disable_hwloc: 'OFF'
87-
# link_hwloc_statically: 'OFF'
77+
- os: 'ubuntu-22.04'
78+
build_type: Release
79+
compiler: {c: icx, cxx: icpx}
80+
shared_library: 'ON'
81+
level_zero_provider: 'ON'
82+
cuda_provider: 'ON'
83+
install_tbb: 'ON'
84+
disable_hwloc: 'OFF'
85+
link_hwloc_statically: 'OFF'
8886
# test without installing TBB
8987
- os: 'ubuntu-22.04'
9088
build_type: Release
@@ -150,6 +148,11 @@ jobs:
150148
- name: Set ptrace value for IPC test
151149
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
152150

151+
- name: Get UMF version
152+
run: |
153+
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+')
154+
echo "UMF_VERSION=$VERSION" >> $GITHUB_ENV
155+
153156
- name: Configure build
154157
run: >
155158
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}}
@@ -179,8 +182,7 @@ jobs:
179182
- name: Run tests
180183
working-directory: ${{env.BUILD_DIR}}
181184
run: |
182-
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh' || true }}
183-
ctest --output-on-failure # run all tests for better coverage
185+
LD_LIBRARY_PATH=${{env.BUILD_DIR}}/lib/ ctest --output-on-failure # run all tests for better coverage
184186
185187
- name: Check coverage
186188
if: ${{ matrix.build_type == 'Debug' && matrix.compiler.c == 'gcc' }}
@@ -266,6 +268,12 @@ jobs:
266268
run: vcpkg install
267269
shell: pwsh # Specifies PowerShell as the shell for running the script.
268270

271+
- name: Get UMF version
272+
run: |
273+
$version = (git describe --tags --abbrev=0 | Select-String -Pattern '\d+\.\d+\.\d+').Matches.Value
274+
echo "UMF_VERSION=$version" >> $env:GITHUB_ENV
275+
shell: pwsh
276+
269277
- name: Configure build
270278
run: >
271279
cmake
@@ -469,6 +477,11 @@ jobs:
469477
- name: Install hwloc
470478
run: brew install hwloc tbb automake
471479

480+
- name: Get UMF version
481+
run: |
482+
VERSION=$(git describe --tags --abbrev=0 | grep -Eo '\d+\.\d+\.\d+')
483+
echo "UMF_VERSION=$VERSION" >> $GITHUB_ENV
484+
472485
- name: Configure build
473486
run: >
474487
cmake

.github/workflows/reusable_sanitizers.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ jobs:
7777
ASAN_OPTIONS: allocator_may_return_null=1
7878
TSAN_OPTIONS: allocator_may_return_null=1
7979
run: |
80-
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh' || true }}
8180
ctest --output-on-failure
8281
8382
windows-build:

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ if(Python3_FOUND)
766766
add_custom_target(
767767
docs
768768
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
769-
COMMAND ${Python3_EXECUTABLE}
769+
COMMAND UMF_VERSION=${UMF_CMAKE_VERSION} ${Python3_EXECUTABLE}
770770
${UMF_CMAKE_SOURCE_DIR}/docs/generate_docs.py
771771
COMMENT "Generate HTML documentation using Doxygen")
772772
endif()

RELEASE_STEPS.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ Do changes for a release:
3939
- For major/minor release start from the `main` branch
4040
- Add an entry to ChangeLog, remember to change the day of the week in the release date
4141
- For major releases mention API and ABI compatibility with the previous release
42-
- Update project's version in a few places:
43-
- For major and minor releases: `UMF_VERSION_CURRENT` in `include/umf/base.h` (the API version)
44-
- `release` variable in `docs/config/conf.py` (for docs)
45-
- `UMF_VERSION` variable in `.github/workflows/reusable_basic.yml` (for installation test)
42+
- For major and minor releases, update `UMF_VERSION_CURRENT` in `include/umf/base.h` (the API version)
4643
- For major releases update ABI version in `.map` and `.def` files
4744
- These files are defined for all public libraries (`libumf` and `proxy_lib`, at the moment)
4845
- Commit these changes and tag the release:

benchmark/benchmark.cpp

Lines changed: 15 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -6,161 +6,29 @@
66
*
77
*/
88

9-
#include <benchmark/benchmark.h>
10-
#include <umf/pools/pool_proxy.h>
11-
#ifdef UMF_POOL_SCALABLE_ENABLED
12-
#include <umf/pools/pool_scalable.h>
13-
#endif
14-
#include <umf/providers/provider_os_memory.h>
15-
16-
#ifdef UMF_POOL_DISJOINT_ENABLED
17-
#include <umf/pools/pool_disjoint.h>
18-
#endif
19-
20-
#ifdef UMF_POOL_JEMALLOC_ENABLED
21-
#include <umf/pools/pool_jemalloc.h>
22-
#endif
23-
249
#include "benchmark.hpp"
2510

26-
struct glibc_malloc : public allocator_interface {
27-
unsigned SetUp([[maybe_unused]] ::benchmark::State &state,
28-
unsigned argPos) override {
29-
return argPos;
30-
}
31-
void TearDown([[maybe_unused]] ::benchmark::State &state) override{};
32-
void *benchAlloc(size_t size) override { return malloc(size); }
33-
void benchFree(void *ptr, [[maybe_unused]] size_t size) override {
34-
free(ptr);
11+
#define UMF_BENCHMARK_TEMPLATE_DEFINE(BaseClass, Method, ...) \
12+
BENCHMARK_TEMPLATE_DEFINE_F(BaseClass, Method, __VA_ARGS__) \
13+
(benchmark::State & state) { \
14+
for (auto _ : state) { \
15+
bench(state); \
16+
} \
3517
}
36-
static std::string name() { return "glibc"; }
37-
};
38-
39-
struct os_provider : public provider_interface {
40-
provider_interface::params_ptr
41-
getParams(::benchmark::State &state) override {
42-
umf_os_memory_provider_params_handle_t raw_params = nullptr;
43-
umfOsMemoryProviderParamsCreate(&raw_params);
44-
if (!raw_params) {
45-
state.SkipWithError("Failed to create os provider params");
46-
return {nullptr, [](void *) {}};
47-
}
48-
49-
// Use a lambda as the custom deleter
50-
auto deleter = [](void *p) {
51-
auto handle =
52-
static_cast<umf_os_memory_provider_params_handle_t>(p);
53-
umfOsMemoryProviderParamsDestroy(handle);
54-
};
55-
56-
return {static_cast<void *>(raw_params), deleter};
57-
}
58-
59-
umf_memory_provider_ops_t *
60-
getOps([[maybe_unused]] ::benchmark::State &state) override {
61-
return umfOsMemoryProviderOps();
62-
}
63-
static std::string name() { return "os_provider"; }
64-
};
65-
66-
template <typename Provider>
67-
struct proxy_pool : public pool_interface<Provider> {
68-
umf_memory_pool_ops_t *
69-
getOps([[maybe_unused]] ::benchmark::State &state) override {
70-
return umfProxyPoolOps();
71-
}
72-
73-
static std::string name() { return "proxy_pool<" + Provider::name() + ">"; }
74-
};
7518

76-
#ifdef UMF_POOL_DISJOINT_ENABLED
77-
template <typename Provider>
78-
struct disjoint_pool : public pool_interface<Provider> {
79-
umf_memory_pool_ops_t *
80-
getOps([[maybe_unused]] ::benchmark::State &state) override {
81-
return umfDisjointPoolOps();
82-
}
83-
84-
typename pool_interface<Provider>::params_ptr
85-
getParams(::benchmark::State &state) override {
86-
umf_disjoint_pool_params_handle_t raw_params = nullptr;
87-
auto ret = umfDisjointPoolParamsCreate(&raw_params);
88-
if (ret != UMF_RESULT_SUCCESS) {
89-
state.SkipWithError("Failed to create disjoint pool params");
90-
return {nullptr, [](void *) {}};
91-
}
92-
93-
typename pool_interface<Provider>::params_ptr params(
94-
raw_params, [](void *p) {
95-
umfDisjointPoolParamsDestroy(
96-
static_cast<umf_disjoint_pool_params_handle_t>(p));
97-
});
98-
99-
ret = umfDisjointPoolParamsSetSlabMinSize(raw_params, 4096);
100-
if (ret != UMF_RESULT_SUCCESS) {
101-
state.SkipWithError("Failed to set slab min size");
102-
return {nullptr, [](void *) {}};
103-
}
104-
105-
ret = umfDisjointPoolParamsSetCapacity(raw_params, 4);
106-
if (ret != UMF_RESULT_SUCCESS) {
107-
state.SkipWithError("Failed to set capacity");
108-
return {nullptr, [](void *) {}};
109-
}
110-
111-
ret = umfDisjointPoolParamsSetMinBucketSize(raw_params, 4096);
112-
if (ret != UMF_RESULT_SUCCESS) {
113-
state.SkipWithError("Failed to set min bucket size");
114-
return {nullptr, [](void *) {}};
115-
}
116-
117-
ret = umfDisjointPoolParamsSetMaxPoolableSize(raw_params, 4096 * 16);
118-
if (ret != UMF_RESULT_SUCCESS) {
119-
state.SkipWithError("Failed to set max poolable size");
120-
return {nullptr, [](void *) {}};
121-
}
122-
123-
return params;
124-
}
125-
126-
static std::string name() {
127-
return "disjoint_pool<" + Provider::name() + ">";
128-
}
129-
};
130-
#endif
131-
132-
#ifdef UMF_POOL_JEMALLOC_ENABLED
133-
template <typename Provider>
134-
struct jemalloc_pool : public pool_interface<Provider> {
135-
umf_memory_pool_ops_t *
136-
getOps([[maybe_unused]] ::benchmark::State &state) override {
137-
return umfJemallocPoolOps();
138-
}
139-
140-
static std::string name() {
141-
return "jemalloc_pool<" + Provider::name() + ">";
142-
}
143-
};
144-
#endif
145-
146-
#ifdef UMF_POOL_SCALABLE_ENABLED
147-
template <typename Provider>
148-
struct scalable_pool : public pool_interface<Provider> {
149-
virtual umf_memory_pool_ops_t *
150-
getOps([[maybe_unused]] ::benchmark::State &state) override {
151-
return umfScalablePoolOps();
152-
}
153-
154-
static std::string name() {
155-
return "scalable_pool<" + Provider::name() + ">";
156-
}
157-
};
158-
#endif
159-
// Benchmarks scenarios:
19+
#define UMF_BENCHMARK_REGISTER_F(BaseClass, Method) \
20+
BENCHMARK_REGISTER_F(BaseClass, Method) \
21+
->ArgNames( \
22+
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::argsName()) \
23+
->Name(BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::name()) \
24+
->Iterations( \
25+
BENCHMARK_PRIVATE_CONCAT_NAME(BaseClass, Method)::iterations())
16026

16127
UMF_BENCHMARK_TEMPLATE_DEFINE(alloc_benchmark, glibc_fix, fixed_alloc_size,
16228
glibc_malloc);
16329

30+
// Benchmarks scenarios:
31+
16432
// The benchmark arguments specified in Args() are, in order:
16533
// benchmark arguments, allocator arguments, size generator arguments.
16634
// The exact meaning of each argument depends on the benchmark, allocator, and size components used.

0 commit comments

Comments
 (0)