Skip to content

Add TBB pool manager with tests #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev
sudo apt-get install -y clang cmake libnuma-dev libjemalloc-dev libtbb-dev

- name: Install g++-7
if: matrix.compiler.cxx == 'g++-7'
Expand All @@ -47,6 +47,7 @@ jobs:
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON

- name: Build UMF
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
-DUMF_DEVELOPER_MODE=OFF
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=OFF
-DUMF_ENABLE_POOL_TRACKING=OFF

- name: Build UMF
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
include:
- os: ubuntu-latest
nproc: $(nproc)
pool_scalable: 'ON'
- os: windows-latest
nproc: $Env:NUMBER_OF_PROCESSORS
pool_scalable: 'OFF'
runs-on: ${{matrix.os}}

steps:
Expand All @@ -35,7 +37,7 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake clang libnuma-dev libjemalloc-dev
sudo apt-get install -y cmake clang libnuma-dev libjemalloc-dev libtbb-dev

- name: Install pip packages
run: python3 -m pip install -r third_party/requirements.txt
Expand All @@ -48,6 +50,7 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=ON
-DUMF_DEVELOPER_MODE=ON
-DUMF_ENABLE_POOL_TRACKING=ON
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=${{matrix.pool_scalable}}

- name: Build
run: >
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ include(helpers)
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
option(UMF_BUILD_LIBUMF_POOL_DISJOINT "Build the libumf_pool_disjoint static library" OFF)
option(UMF_BUILD_LIBUMF_POOL_JEMALLOC "Build the libumf_pool_jemalloc static library" OFF)
option(UMF_BUILD_LIBUMF_POOL_SCALABLE "Build the libumf_pool_scalable static library" OFF)
option(UMF_BUILD_TESTS "Build UMF tests" ON)
option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON)
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ The `UMF_BUILD_LIBUMF_POOL_JEMALLOC` option has to be turned `ON` to build this
2) Required packages:
- libjemalloc-dev

### libumf_pool_scalable (Linux-only)

libumf_pool_scalable is a [oneTBB](https://github.com/oneapi-src/oneTBB)-based memory pool manager built as a separate static library.
The `UMF_BUILD_LIBUMF_POOL_SCALABLE` option has to be turned `ON` to build this library.

#### Requirements

1) The `UMF_BUILD_LIBUMF_POOL_SCALABLE` option turned `ON`
2) Required packages:
- libtbb-dev (libraries: libtbbmalloc.so.2)

## Building

### Requirements
Expand Down Expand Up @@ -102,6 +113,7 @@ List of options provided by CMake:
| UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
| UMF_BUILD_LIBUMF_POOL_DISJOINT | Build the libumf_pool_disjoint static library | ON/OFF | OFF |
| UMF_BUILD_LIBUMF_POOL_JEMALLOC | Build the libumf_pool_jemalloc static library | ON/OFF | OFF |
| UMF_BUILD_LIBUMF_POOL_SCALABLE | Build the libumf_pool_scalable static library | ON/OFF | OFF |
| UMF_BUILD_TESTS | Build UMF tests | ON/OFF | ON |
| UMF_BUILD_BENCHMARKS | Build UMF benchmarks | ON/OFF | OFF |
| UMF_ENABLE_POOL_TRACKING | Build UMF with pool tracking | ON/OFF | ON |
Expand Down
2 changes: 1 addition & 1 deletion benchmark/ubench.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static void w_umfPoolFree(void *provider, void *ptr, size_t size) {
exit(-1);
}
}
#endif /* (defined UMF_BUILD_LIBUMF_POOL_TBB) || (defined UMF_BUILD_LIBUMF_POOL_JEMALLOC) */
#endif /* (defined UMF_BUILD_LIBUMF_POOL_DISJOINT) || (defined UMF_BUILD_LIBUMF_POOL_JEMALLOC) */

#ifdef UMF_BUILD_LIBUMF_POOL_DISJOINT
////////////////// DISJOINT POOL WITH OS MEMORY PROVIDER
Expand Down
26 changes: 26 additions & 0 deletions include/umf/pools/pool_scalable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
*
* Copyright (C) 2023 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*/

#ifndef UMF_SCALABLE_MEMORY_POOL_H
#define UMF_SCALABLE_MEMORY_POOL_H 1

#ifdef __cplusplus
extern "C" {
#endif

#include <umf/memory_pool.h>
#include <umf/memory_provider.h>

extern umf_memory_pool_ops_t UMF_SCALABLE_POOL_OPS;

#ifdef __cplusplus
}
#endif

#endif /* UMF_SCALABLE_MEMORY_POOL_H */
16 changes: 16 additions & 0 deletions src/pool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,19 @@ if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)
message(FATAL_ERROR "libumf_pool_jemalloc is supported on Linux only")
endif()
endif()

# libumf_pool_scalable
if(UMF_BUILD_LIBUMF_POOL_SCALABLE)
if(LINUX)
add_umf_library(NAME scalable_pool
TYPE STATIC
SRCS pool_scalable.c
LIBS dl)
add_library(${PROJECT_NAME}::scalable_pool ALIAS scalable_pool)
install(TARGETS scalable_pool
EXPORT ${PROJECT_NAME}-targets
)
else()
message(FATAL_ERROR "libumf_pool_scalable is supported on Linux only")
endif()
endif()
Loading