Skip to content

Commit

Permalink
make disjoint pool a C structure
Browse files Browse the repository at this point in the history
  • Loading branch information
bratpiorka committed Dec 10, 2024
1 parent 0fef3fc commit 1bf955a
Show file tree
Hide file tree
Showing 38 changed files with 1,673 additions and 1,505 deletions.
1 change: 0 additions & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=OFF
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
- name: Build
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUMF_BUILD_CUDA_PROVIDER=OFF
Expand Down Expand Up @@ -156,7 +155,6 @@ jobs:
# -DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}} ^
# -DUMF_FORMAT_CODE_STYLE=OFF ^
# -DUMF_DEVELOPER_MODE=ON ^
# -DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON ^
# -DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON ^
# -DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON ^
# -DUMF_BUILD_CUDA_PROVIDER=ON ^
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
-DUMF_DEVELOPER_MODE=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
- name: Build
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/reusable_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_DISABLE_HWLOC=${{matrix.disable_hwloc}}
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.link_hwloc_statically}}
Expand Down Expand Up @@ -208,7 +207,6 @@ jobs:
--build-dir ${{env.BUILD_DIR}}
--install-dir ${{env.INSTL_DIR}}
--build-type ${{matrix.build_type}}
--disjoint-pool
${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }}
--umf-version ${{env.UMF_VERSION}}
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}
Expand Down Expand Up @@ -278,7 +276,6 @@ jobs:
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${{matrix.level_zero_provider}}
-DUMF_BUILD_CUDA_PROVIDER=${{matrix.cuda_provider}}
Expand All @@ -298,7 +295,6 @@ jobs:
--build-dir ${{env.BUILD_DIR}}
--install-dir ${{env.INSTL_DIR}}
--build-type ${{matrix.build_type}}
--disjoint-pool
${{matrix.shared_library == 'ON' && '--proxy' || '' }}
--umf-version ${{env.UMF_VERSION}}
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
Expand Down Expand Up @@ -336,7 +332,6 @@ jobs:
-DUMF_BUILD_EXAMPLES=OFF
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
Expand Down Expand Up @@ -379,7 +374,6 @@ jobs:
-DUMF_BUILD_EXAMPLES=OFF
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
Expand Down Expand Up @@ -478,7 +472,6 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_SHARED_LIBRARY=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
Expand All @@ -492,7 +485,6 @@ jobs:
--build-dir ${{env.BUILD_DIR}}
--install-dir ${{env.INSTL_DIR}}
--build-type ${{env.BUILD_TYPE}}
--disjoint-pool
--proxy
--umf-version ${{env.UMF_VERSION}}
--shared-library
1 change: 0 additions & 1 deletion .github/workflows/reusable_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
-DUMF_DEVELOPER_MODE=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
-DUMF_BUILD_CUDA_PROVIDER=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
- name: Build UMF on Linux
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_dax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
-DUMF_BUILD_GPU_EXAMPLES=OFF
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUMF_TESTS_FAIL_ON_SKIP=ON
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/reusable_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,32 @@ jobs:
matrix:
include:
- os: windows-latest
disjoint: 'OFF'
build_tests: 'ON'
simple_cmake: 'OFF'
# pure C build (Windows)
- os: windows-latest
disjoint: 'OFF'
# Tests' building is off for a pure C build
build_tests: 'OFF'
simple_cmake: 'OFF'
- os: ubuntu-latest
disjoint: 'ON'
build_tests: 'ON'
# Windows doesn't recognize 'CMAKE_BUILD_TYPE', it uses '--config' param in build command
extra_build_options: '-DCMAKE_BUILD_TYPE=Release -DUMF_BUILD_BENCHMARKS=ON -DUMF_BUILD_BENCHMARKS_MT=ON'
simple_cmake: 'OFF'
# pure C build (Linux)
- os: ubuntu-latest
disjoint: 'OFF'
# Windows doesn't recognize 'CMAKE_BUILD_TYPE', it uses '--config' param in build command
# Tests' building is off for a pure C build
build_tests: 'OFF'
extra_build_options: '-DCMAKE_BUILD_TYPE=Release -DUMF_BUILD_BENCHMARKS=ON'
simple_cmake: 'OFF'
# simplest CMake on ubuntu-latest
- os: ubuntu-latest
disjoint: 'OFF'
build_tests: 'ON'
extra_build_options: '-DCMAKE_BUILD_TYPE=Release'
simple_cmake: 'ON'
# simplest CMake ubuntu-20.04
- os: ubuntu-20.04
disjoint: 'OFF'
build_tests: 'ON'
extra_build_options: '-DCMAKE_BUILD_TYPE=Release'
simple_cmake: 'ON'
Expand Down Expand Up @@ -101,7 +95,6 @@ jobs:
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=${{matrix.disjoint}}
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_TESTS=${{matrix.build_tests}}
-DUMF_BUILD_EXAMPLES=ON
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jobs:
-DUMF_BUILD_GPU_TESTS=ON
-DUMF_BUILD_GPU_EXAMPLES=ON
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_CUDA_PROVIDER=OFF
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_multi_numa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
-DUMF_BUILD_BENCHMARKS=OFF
-DUMF_BUILD_TESTS=ON
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=${{ matrix.os == 'rhel-9.1' && 'OFF' || 'ON' }}
-DUMF_TESTS_FAIL_ON_SKIP=ON
${{ matrix.build_type == 'Debug' && matrix.os == 'ubuntu-22.04' && '-DUMF_USE_COVERAGE=ON' || '' }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_proxy_lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=OFF
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON
-DUMF_PROXY_LIB_BASED_ON_POOL=${{matrix.proxy_lib_pool}}
${{ matrix.build_type == 'Debug' && '-DUMF_USE_COVERAGE=ON' || '' }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/reusable_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
-DUMF_USE_UBSAN=${{matrix.sanitizers.ubsan}}
-DUMF_USE_TSAN=${{matrix.sanitizers.tsan}}
Expand Down Expand Up @@ -132,7 +131,6 @@ jobs:
-DUMF_BUILD_SHARED_LIBRARY=OFF
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
-DUMF_BUILD_EXAMPLES=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/reusable_valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUMF_BUILD_CUDA_PROVIDER=OFF
Expand Down
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ find_package(PkgConfig)
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON)
option(UMF_BUILD_CUDA_PROVIDER "Build CUDA memory provider" ON)
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_TESTS "Build UMF tests" ON)
Expand Down Expand Up @@ -408,8 +406,8 @@ endif()
# For using the options listed in the OPTIONS_REQUIRING_CXX variable a C++17
# compiler is required. Moreover, if these options are not set, CMake will set
# up a strict C build, without C++ support.
set(OPTIONS_REQUIRING_CXX "UMF_BUILD_TESTS" "UMF_BUILD_LIBUMF_POOL_DISJOINT"
"UMF_BUILD_BENCHMARKS_MT" "UMF_BUILD_BENCHMARKS")
set(OPTIONS_REQUIRING_CXX "UMF_BUILD_TESTS" "UMF_BUILD_BENCHMARKS_MT"
"UMF_BUILD_BENCHMARKS")
foreach(option_name ${OPTIONS_REQUIRING_CXX})
if(${option_name})
enable_language(CXX)
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For development and contributions:
- cmake-format-0.6 (can be installed with `python -m pip install cmake-format==0.6.13`)
- black (can be installed with `python -m pip install black==24.3.0`)

For building tests, multithreaded benchmarks and Disjoint Pool:
For building tests and multithreaded benchmarks:
- C++ compiler with C++17 support

For Level Zero memory provider tests:
Expand Down Expand Up @@ -100,7 +100,6 @@ List of options provided by CMake:
| UMF_BUILD_SHARED_LIBRARY | Build UMF as shared library | ON/OFF | OFF |
| UMF_BUILD_LEVEL_ZERO_PROVIDER | Build Level Zero memory provider | ON/OFF | ON |
| UMF_BUILD_CUDA_PROVIDER | Build CUDA memory provider | ON/OFF | ON |
| 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_TESTS | Build UMF tests | ON/OFF | ON |
| UMF_BUILD_GPU_TESTS | Build UMF GPU tests | ON/OFF | OFF |
Expand Down Expand Up @@ -258,10 +257,6 @@ To enable this feature, the `UMF_BUILD_SHARED_LIBRARY` option needs to be turned

TODO: Add a description

##### Requirements

To enable this feature, the `UMF_BUILD_LIBUMF_POOL_DISJOINT` option needs to be turned `ON`.

#### Jemalloc pool

Jemalloc pool is a [jemalloc](https://github.com/jemalloc/jemalloc)-based memory
Expand Down
7 changes: 0 additions & 7 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ function(add_umf_benchmark)
"${DLL_PATH_LIST}")
endif()

if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
target_compile_definitions(${BENCH_NAME}
PRIVATE UMF_POOL_DISJOINT_ENABLED=1)
endif()
if(UMF_POOL_JEMALLOC_ENABLED)
target_compile_definitions(${BENCH_NAME}
PRIVATE UMF_POOL_JEMALLOC_ENABLED=1)
Expand Down Expand Up @@ -118,9 +114,6 @@ endfunction()
set(LIB_DIRS ${LIBHWLOC_LIBRARY_DIRS})

# optional libraries
if(UMF_BUILD_LIBUMF_POOL_DISJOINT)
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} disjoint_pool)
endif()
if(LINUX)
set(LIBS_OPTIONAL ${LIBS_OPTIONAL} m)
endif()
Expand Down
7 changes: 1 addition & 6 deletions benchmark/multithread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int main() {
std::cout << "skipping jemalloc_pool mt_alloc_free" << std::endl;
#endif

#if defined(UMF_POOL_DISJOINT_ENABLED)
// NOTE: disjoint pool is always enabled
umf_disjoint_pool_params_handle_t hDisjointParams = nullptr;
umf_result_t ret = umfDisjointPoolParamsCreate(&hDisjointParams);
if (ret != UMF_RESULT_SUCCESS) {
Expand All @@ -132,20 +132,15 @@ int main() {
std::cout << "disjoint_pool mt_alloc_free: ";
mt_alloc_free(poolCreateExtParams{umfDisjointPoolOps(), hDisjointParams,
umfOsMemoryProviderOps(), osParams});
#else
std::cout << "skipping disjoint_pool mt_alloc_free" << std::endl;
#endif

// ctest looks for "PASSED" in the output
std::cout << "PASSED" << std::endl;

#if defined(UMF_POOL_DISJOINT_ENABLED)
ret = umfDisjointPoolParamsDestroy(hDisjointParams);
if (ret != UMF_RESULT_SUCCESS) {
std::cerr << "disjoint pool params destroy failed" << std::endl;
return -1;
}
#endif

return 0;
}
15 changes: 4 additions & 11 deletions benchmark/ubench.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,19 @@

#include <umf/ipc.h>
#include <umf/memory_pool.h>
#include <umf/pools/pool_disjoint.h>
#include <umf/pools/pool_proxy.h>
#include <umf/pools/pool_scalable.h>
#include <umf/providers/provider_level_zero.h>
#include <umf/providers/provider_os_memory.h>

#ifdef UMF_POOL_DISJOINT_ENABLED
#include <umf/pools/pool_disjoint.h>
#endif

#ifdef UMF_POOL_JEMALLOC_ENABLED
#include <umf/pools/pool_jemalloc.h>
#endif

#include "utils_common.h"

#if (defined UMF_BUILD_LIBUMF_POOL_DISJOINT && \
defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS)
#if (defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS)
#include "utils_level_zero.h"
#endif

Expand Down Expand Up @@ -244,7 +240,6 @@ UBENCH_EX(simple, proxy_pool_with_os_memory_provider) {
free(array);
}

#if (defined UMF_POOL_DISJOINT_ENABLED)
////////////////// DISJOINT POOL WITH OS MEMORY PROVIDER

UBENCH_EX(simple, disjoint_pool_with_os_memory_provider) {
Expand Down Expand Up @@ -327,7 +322,6 @@ UBENCH_EX(simple, disjoint_pool_with_os_memory_provider) {
umfMemoryProviderDestroy(os_memory_provider);
free(array);
}
#endif /* (defined UMF_POOL_DISJOINT_ENABLED) */

#if (defined UMF_POOL_JEMALLOC_ENABLED)
////////////////// JEMALLOC POOL WITH OS MEMORY PROVIDER
Expand Down Expand Up @@ -421,8 +415,7 @@ UBENCH_EX(simple, scalable_pool_with_os_memory_provider) {
}
#endif /* (defined UMF_POOL_SCALABLE_ENABLED) */

#if (defined UMF_POOL_DISJOINT_ENABLED && \
defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS)
#if (defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS)
static void do_ipc_get_put_benchmark(alloc_t *allocs, size_t num_allocs,
size_t repeats,
umf_ipc_handle_t *ipc_handles) {
Expand Down Expand Up @@ -630,7 +623,7 @@ UBENCH_EX(ipc, disjoint_pool_with_level_zero_provider) {
err_destroy_context:
utils_ze_destroy_context(context);
}
#endif /* (defined UMF_POLL_DISJOINT_ENABLED && defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS) */
#endif /* (defined UMF_BUILD_LEVEL_ZERO_PROVIDER && defined UMF_BUILD_GPU_TESTS) */

// TODO add IPC benchmark for CUDA

Expand Down
Loading

0 comments on commit 1bf955a

Please sign in to comment.