Skip to content

Commit f0c40f3

Browse files
authored
Merge pull request #56 from ldorau/Add_TBB_pool_manager
Add TBB pool manager with tests
2 parents 876b91e + 656e509 commit f0c40f3

File tree

11 files changed

+354
-5
lines changed

11 files changed

+354
-5
lines changed

.github/workflows/basic.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install apt packages
2929
run: |
3030
sudo apt-get update
31-
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev
31+
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev libtbb-dev
3232
3333
- name: Install g++-7
3434
if: matrix.compiler.cxx == 'g++-7'
@@ -47,6 +47,7 @@ jobs:
4747
-DUMF_DEVELOPER_MODE=ON
4848
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
4949
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
50+
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
5051
5152
- name: Build UMF
5253
run: |

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
-DUMF_DEVELOPER_MODE=OFF
3636
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
3737
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
38+
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=OFF
3839
-DUMF_ENABLE_POOL_TRACKING=OFF
3940
4041
- name: Build UMF

.github/workflows/codeql.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ jobs:
1818
include:
1919
- os: ubuntu-latest
2020
nproc: $(nproc)
21+
pool_scalable: 'ON'
2122
- os: windows-latest
2223
nproc: $Env:NUMBER_OF_PROCESSORS
24+
pool_scalable: 'OFF'
2325
runs-on: ${{matrix.os}}
2426

2527
steps:
@@ -35,7 +37,7 @@ jobs:
3537
if: matrix.os == 'ubuntu-latest'
3638
run: |
3739
sudo apt-get update
38-
sudo apt-get install -y cmake clang libnuma-dev libjemalloc-dev
40+
sudo apt-get install -y cmake clang libnuma-dev libjemalloc-dev libtbb-dev
3941
4042
- name: Install pip packages
4143
run: python3 -m pip install -r third_party/requirements.txt
@@ -48,6 +50,7 @@ jobs:
4850
-DUMF_FORMAT_CODE_STYLE=ON
4951
-DUMF_DEVELOPER_MODE=ON
5052
-DUMF_ENABLE_POOL_TRACKING=ON
53+
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=${{matrix.pool_scalable}}
5154
5255
- name: Build
5356
run: >

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ include(helpers)
1919
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
2020
option(UMF_BUILD_LIBUMF_POOL_DISJOINT "Build the libumf_pool_disjoint static library" OFF)
2121
option(UMF_BUILD_LIBUMF_POOL_JEMALLOC "Build the libumf_pool_jemalloc static library" OFF)
22+
option(UMF_BUILD_LIBUMF_POOL_SCALABLE "Build the libumf_pool_scalable static library" OFF)
2223
option(UMF_BUILD_TESTS "Build UMF tests" ON)
2324
option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
2425
option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON)

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ The `UMF_BUILD_LIBUMF_POOL_JEMALLOC` option has to be turned `ON` to build this
3939
2) Required packages:
4040
- libjemalloc-dev
4141

42+
### libumf_pool_scalable (Linux-only)
43+
44+
libumf_pool_scalable is a [oneTBB](https://github.com/oneapi-src/oneTBB)-based memory pool manager built as a separate static library.
45+
The `UMF_BUILD_LIBUMF_POOL_SCALABLE` option has to be turned `ON` to build this library.
46+
47+
#### Requirements
48+
49+
1) The `UMF_BUILD_LIBUMF_POOL_SCALABLE` option turned `ON`
50+
2) Required packages:
51+
- libtbb-dev (libraries: libtbbmalloc.so.2)
52+
4253
## Building
4354

4455
### Requirements
@@ -102,6 +113,7 @@ List of options provided by CMake:
102113
| UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
103114
| UMF_BUILD_LIBUMF_POOL_DISJOINT | Build the libumf_pool_disjoint static library | ON/OFF | OFF |
104115
| UMF_BUILD_LIBUMF_POOL_JEMALLOC | Build the libumf_pool_jemalloc static library | ON/OFF | OFF |
116+
| UMF_BUILD_LIBUMF_POOL_SCALABLE | Build the libumf_pool_scalable static library | ON/OFF | OFF |
105117
| UMF_BUILD_TESTS | Build UMF tests | ON/OFF | ON |
106118
| UMF_BUILD_BENCHMARKS | Build UMF benchmarks | ON/OFF | OFF |
107119
| UMF_ENABLE_POOL_TRACKING | Build UMF with pool tracking | ON/OFF | ON |

benchmark/ubench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void w_umfPoolFree(void *provider, void *ptr, size_t size) {
169169
exit(-1);
170170
}
171171
}
172-
#endif /* (defined UMF_BUILD_LIBUMF_POOL_TBB) || (defined UMF_BUILD_LIBUMF_POOL_JEMALLOC) */
172+
#endif /* (defined UMF_BUILD_LIBUMF_POOL_DISJOINT) || (defined UMF_BUILD_LIBUMF_POOL_JEMALLOC) */
173173

174174
#ifdef UMF_BUILD_LIBUMF_POOL_DISJOINT
175175
////////////////// DISJOINT POOL WITH OS MEMORY PROVIDER

include/umf/pools/pool_scalable.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
*
3+
* Copyright (C) 2023 Intel Corporation
4+
*
5+
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
6+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
*
8+
*/
9+
10+
#ifndef UMF_SCALABLE_MEMORY_POOL_H
11+
#define UMF_SCALABLE_MEMORY_POOL_H 1
12+
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
#include <umf/memory_pool.h>
18+
#include <umf/memory_provider.h>
19+
20+
extern umf_memory_pool_ops_t UMF_SCALABLE_POOL_OPS;
21+
22+
#ifdef __cplusplus
23+
}
24+
#endif
25+
26+
#endif /* UMF_SCALABLE_MEMORY_POOL_H */

src/pool/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,19 @@ if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
4141
message(FATAL_ERROR "libumf_pool_jemalloc is supported on Linux only")
4242
endif()
4343
endif()
44+
45+
# libumf_pool_scalable
46+
if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
47+
if(LINUX)
48+
add_umf_library(NAME scalable_pool
49+
TYPE STATIC
50+
SRCS pool_scalable.c
51+
LIBS dl)
52+
add_library(${PROJECT_NAME}::scalable_pool ALIAS scalable_pool)
53+
install(TARGETS scalable_pool
54+
EXPORT ${PROJECT_NAME}-targets
55+
)
56+
else()
57+
message(FATAL_ERROR "libumf_pool_scalable is supported on Linux only")
58+
endif()
59+
endif()

0 commit comments

Comments
 (0)