Skip to content

Merge fixes for 0.9.0-rc4 #659

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
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
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUSE_VALGRIND=1
-DUMF_USE_VALGRIND=1
-DUMF_TESTS_FAIL_ON_SKIP=ON

- name: Build
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ jobs:
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUSE_ASAN=${{matrix.sanitizers.asan}}
-DUSE_UBSAN=${{matrix.sanitizers.ubsan}}
-DUSE_TSAN=${{matrix.sanitizers.tsan}}
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
-DUMF_USE_UBSAN=${{matrix.sanitizers.ubsan}}
-DUMF_USE_TSAN=${{matrix.sanitizers.tsan}}
-DUMF_BUILD_EXAMPLES=ON
-DUMF_TESTS_FAIL_ON_SKIP=ON

Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
-DUMF_FORMAT_CODE_STYLE=OFF
-DUMF_DEVELOPER_MODE=ON
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUSE_ASAN=${{matrix.sanitizers.asan}}
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
-DUMF_BUILD_EXAMPLES=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUMF_TESTS_FAIL_ON_SKIP=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
-DUSE_VALGRIND=1
-DUMF_USE_VALGRIND=1
-DUMF_TESTS_FAIL_ON_SKIP=ON

- name: Build
Expand Down
20 changes: 10 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ option(UMF_FORMAT_CODE_STYLE
OFF)
# Only a part of skips is treated as a failure now. TODO: extend to all tests
option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF)
option(USE_ASAN "Enable AddressSanitizer checks" OFF)
option(USE_UBSAN "Enable UndefinedBehaviorSanitizer checks" OFF)
option(USE_TSAN "Enable ThreadSanitizer checks" OFF)
option(USE_MSAN "Enable MemorySanitizer checks" OFF)
option(USE_VALGRIND "Enable Valgrind instrumentation" OFF)
option(USE_GCOV "Enable gcov support" OFF)
option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF)
option(UMF_USE_UBSAN "Enable UndefinedBehaviorSanitizer checks" OFF)
option(UMF_USE_TSAN "Enable ThreadSanitizer checks" OFF)
option(UMF_USE_MSAN "Enable MemorySanitizer checks" OFF)
option(UMF_USE_VALGRIND "Enable Valgrind instrumentation" OFF)
option(UMF_USE_GCOV "Enable gcov support" OFF)
option(
UMF_DISABLE_HWLOC
"Disable features that requires hwloc (OS provider, memory targets, topolgy discovery)"
Expand Down Expand Up @@ -266,16 +266,16 @@ if(MSVC)
endif()

# Sanitizer flags
if(USE_ASAN)
if(UMF_USE_ASAN)
add_sanitizer_flag(address)
endif()
if(USE_UBSAN)
if(UMF_USE_UBSAN)
add_sanitizer_flag(undefined)
endif()
if(USE_TSAN)
if(UMF_USE_TSAN)
add_sanitizer_flag(thread)
endif()
if(USE_MSAN)
if(UMF_USE_MSAN)
message(WARNING "MemorySanitizer requires instrumented libraries to "
"prevent reporting false-positives")
add_sanitizer_flag(memory)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ origin: https://dependency_origin.com
## Code coverage

After adding a new functionality add tests and check coverage before and after the change.
To do this, enable coverage instrumentation by turning on the USE_GCOV flag in CMake.
To do this, enable coverage instrumentation by turning on the UMF_USE_GCOV flag in CMake.
Coverage instrumentation feature is supported only by GCC and Clang.
An example flow might look like the following:

```bash
$ cmake -B build -DUSE_GCOV=1 -DCMAKE_BUILD_TYPE=Debug
$ cmake -B build -DUMF_USE_GCOV=1 -DCMAKE_BUILD_TYPE=Debug
$ cmake --build build -j
$ cd build
$ ctest
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ List of options provided by CMake:
| UMF_DEVELOPER_MODE | Enable additional developer checks | ON/OFF | OFF |
| UMF_FORMAT_CODE_STYLE | Add clang, cmake, and black -format-check and -format-apply targets to make | ON/OFF | OFF |
| UMF_TESTS_FAIL_ON_SKIP | Treat skips in tests as fail | ON/OFF | OFF |
| USE_ASAN | Enable AddressSanitizer checks | ON/OFF | OFF |
| USE_UBSAN | Enable UndefinedBehaviorSanitizer checks | ON/OFF | OFF |
| USE_TSAN | Enable ThreadSanitizer checks | ON/OFF | OFF |
| USE_MSAN | Enable MemorySanitizer checks | ON/OFF | OFF |
| USE_VALGRIND | Enable Valgrind instrumentation | ON/OFF | OFF |
| USE_GCOV | Enable gcov support (Linux only) | ON/OFF | OFF |
| UMF_USE_ASAN | Enable AddressSanitizer checks | ON/OFF | OFF |
| UMF_USE_UBSAN | Enable UndefinedBehaviorSanitizer checks | ON/OFF | OFF |
| UMF_USE_TSAN | Enable ThreadSanitizer checks | ON/OFF | OFF |
| UMF_USE_MSAN | Enable MemorySanitizer checks | ON/OFF | OFF |
| UMF_USE_VALGRIND | Enable Valgrind instrumentation | ON/OFF | OFF |
| UMF_USE_GCOV | Enable gcov support (Linux only) | ON/OFF | OFF |
| UMF_LINK_HWLOC_STATICALLY | Link UMF with HWLOC library statically (Windows+Release only) | ON/OFF | OFF |

## Architecture: memory pools and providers
Expand Down
5 changes: 5 additions & 0 deletions benchmark/multithread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*
*/

#ifndef UMF_BENCH_MULTITHREAD_HPP
#define UMF_BENCH_MULTITHREAD_HPP

#include <algorithm>
#include <chrono>
#include <cmath>
Expand Down Expand Up @@ -87,3 +90,5 @@ template <typename T> double std_dev(const std::vector<T> &values) {
}

} // namespace umf_bench

#endif /* UMF_BENCH_MULTITHREAD_HPP */
4 changes: 2 additions & 2 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function(add_umf_target_compile_options name)
target_compile_options(${name} PRIVATE -fno-omit-frame-pointer
-fstack-protector-strong)
endif()
if(USE_GCOV)
if(UMF_USE_GCOV)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(FATAL_ERROR "To use gcov, the build type must be Debug")
endif()
Expand Down Expand Up @@ -254,7 +254,7 @@ function(add_umf_target_link_options name)
if(NOT MSVC)
if(NOT APPLE)
target_link_options(${name} PRIVATE "LINKER:-z,relro,-z,now")
if(USE_GCOV)
if(UMF_USE_GCOV)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(
FATAL_ERROR "To use gcov, the build type must be Debug")
Expand Down
5 changes: 5 additions & 0 deletions examples/common/utils_level_zero.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*
*/

#ifndef UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
#define UMF_EXAMPLE_UTILS_LEVEL_ZERO_H

#include <stdio.h>
#include <stdlib.h>

Expand Down Expand Up @@ -412,3 +415,5 @@ int destroy_context(ze_context_handle_t context) {

return 0;
}

#endif // UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
6 changes: 3 additions & 3 deletions src/cpp_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*
*/

#ifndef UMF_HELPERS_H
#define UMF_HELPERS_H 1
#ifndef UMF_HELPERS_HPP
#define UMF_HELPERS_HPP 1

#include <umf/memory_pool.h>
#include <umf/memory_pool_ops.h>
Expand Down Expand Up @@ -164,4 +164,4 @@ template <typename Type> umf_result_t &getPoolLastStatusRef() {

} // namespace umf

#endif /* UMF_HELPERS_H */
#endif /* UMF_HELPERS_HPP */
8 changes: 4 additions & 4 deletions src/critnib/critnib.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*/

#ifndef CRITNIB_H
#define CRITNIB_H 1
#ifndef UMF_CRITNIB_H
#define UMF_CRITNIB_H 1

#include <stdint.h>

Expand Down Expand Up @@ -44,4 +44,4 @@ void critnib_iter(critnib *c, uintptr_t min, uintptr_t max,
}
#endif

#endif
#endif // UMF_CRITNIB_H
12 changes: 6 additions & 6 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ set(UMF_UTILS_SOURCES_POSIX utils_posix_common.c utils_posix_concurrency.c
set(UMF_UTILS_SOURCES_WINDOWS utils_windows_common.c
utils_windows_concurrency.c utils_windows_math.c)

if(USE_VALGRIND)
if(USE_ASAN
OR USE_TSAN
OR USE_UBSAN
OR USE_MSAN)
if(UMF_USE_VALGRIND)
if(UMF_USE_ASAN
OR UMF_USE_TSAN
OR UMF_USE_UBSAN
OR UMF_USE_MSAN)
message(FATAL_ERROR "Cannot use valgrind and sanitizers together")
endif()

Expand Down Expand Up @@ -51,7 +51,7 @@ target_include_directories(
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)

if(USE_VALGRIND)
if(UMF_USE_VALGRIND)
set(UMF_UTILS_INTERFACE_DEFS "UMF_VG_ENABLED=1")
endif()

Expand Down
7 changes: 6 additions & 1 deletion src/utils/utils_math.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/*
*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 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_MATH_H
#define UMF_MATH_H 1

#include <assert.h>
#include <stddef.h>

Expand All @@ -22,3 +25,5 @@ static inline size_t log2Utils(size_t num) { return getLeftmostSetBitPos(num); }
#ifdef __cplusplus
}
#endif

#endif /* UMF_MATH_H */
10 changes: 5 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function(build_umf_test)
endif()

set(TEST_LIBS
test_common
umf_test_common
${ARG_LIBS}
GTest::gtest_main
${LIBS_OPTIONAL}
Expand Down Expand Up @@ -390,10 +390,10 @@ endif()
if(LINUX
AND UMF_BUILD_SHARED_LIBRARY
AND NOT
(USE_ASAN
OR USE_UBSAN
OR USE_TSAN
OR USE_MSAN))
(UMF_USE_ASAN
OR UMF_USE_UBSAN
OR UMF_USE_TSAN
OR UMF_USE_MSAN))
set(EXAMPLES "")
if(UMF_POOL_SCALABLE_ENABLED)
set(EXAMPLES ${EXAMPLES} basic)
Expand Down
7 changes: 4 additions & 3 deletions test/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023 Intel Corporation
# Copyright (C) 2023-2024 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Expand All @@ -10,8 +10,9 @@ set(COMMON_SOURCES
provider_trace.c)

add_umf_library(
NAME test_common
NAME umf_test_common
TYPE STATIC
SRCS ${COMMON_SOURCES})

target_include_directories(test_common PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include)
target_include_directories(umf_test_common
PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include)
2 changes: 1 addition & 1 deletion test/common/base.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down
6 changes: 3 additions & 3 deletions test/common/ipc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#ifndef IPC_COMMON_H
#define IPC_COMMON_H
#ifndef UMF_TEST_IPC_COMMON_H
#define UMF_TEST_IPC_COMMON_H

#include <umf/memory_provider.h>

Expand All @@ -24,4 +24,4 @@ int run_consumer(int port, umf_memory_provider_ops_t *provider_ops,
void *provider_params, memcopy_callback_t memcopy_callback,
void *memcopy_ctx);

#endif // IPC_COMMON_H
#endif // UMF_TEST_IPC_COMMON_H
6 changes: 3 additions & 3 deletions test/common/ipc_os_prov_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#ifndef IPC_OS_PROV_COMMON_H
#define IPC_OS_PROV_COMMON_H
#ifndef UMF_TEST_IPC_OS_PROV_COMMON_H
#define UMF_TEST_IPC_OS_PROV_COMMON_H

#include <stdlib.h>

void memcopy(void *dst, const void *src, size_t size, void *context);

#endif // IPC_OS_PROV_COMMON_H
#endif // UMF_TEST_IPC_OS_PROV_COMMON_H
5 changes: 5 additions & 0 deletions test/common/multithread_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*
*/

#ifndef UMF_TEST_MULTITHREAD_HELPERS_HPP
#define UMF_TEST_MULTITHREAD_HELPERS_HPP

#include <condition_variable>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -84,3 +87,5 @@ struct syncthreads_barrier {
};

} // namespace umf_test

#endif /* UMF_TEST_MULTITHREAD_HELPERS_HPP */
6 changes: 3 additions & 3 deletions test/common/numa_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef UMF_NUMA_HELPERS_H
#define UMF_NUMA_HELPERS_H 1
#ifndef UMF_TEST_NUMA_HELPERS_H
#define UMF_TEST_NUMA_HELPERS_H 1

#include <numa.h>
#include <numaif.h>
Expand Down Expand Up @@ -31,4 +31,4 @@ int getNumaNodeByPtr(void *ptr) {
}
#endif

#endif /* UMF_NUMA_HELPERS_H */
#endif /* UMF_TEST_NUMA_HELPERS_H */
2 changes: 1 addition & 1 deletion test/common/pool.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down
8 changes: 4 additions & 4 deletions test/common/pool_null.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (C) 2023 Intel Corporation
// Copyright (C) 2023-2024 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_NULL_POOL_H
#define UMF_NULL_POOL_H
#ifndef UMF_TEST_NULL_POOL_H
#define UMF_TEST_NULL_POOL_H

#include <umf/memory_pool.h>

Expand All @@ -17,4 +17,4 @@ extern umf_memory_pool_ops_t UMF_NULL_POOL_OPS;
}
#endif

#endif // UMF_NULL_POOL_H
#endif // UMF_TEST_NULL_POOL_H
Loading
Loading