Skip to content

Commit cc4b8a7

Browse files
Merge pull request #659 from lukaszstolarczuk/merge-fixes-for-0.9.0-rc4
Merge fixes for 0.9.0-rc4
2 parents c1f2232 + 37732d3 commit cc4b8a7

30 files changed

+114
-87
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
8080
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
8181
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
82-
-DUSE_VALGRIND=1
82+
-DUMF_USE_VALGRIND=1
8383
-DUMF_TESTS_FAIL_ON_SKIP=ON
8484
8585
- name: Build

.github/workflows/sanitizers.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ jobs:
5959
-DUMF_DEVELOPER_MODE=ON
6060
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
6161
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
62-
-DUSE_ASAN=${{matrix.sanitizers.asan}}
63-
-DUSE_UBSAN=${{matrix.sanitizers.ubsan}}
64-
-DUSE_TSAN=${{matrix.sanitizers.tsan}}
62+
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
63+
-DUMF_USE_UBSAN=${{matrix.sanitizers.ubsan}}
64+
-DUMF_USE_TSAN=${{matrix.sanitizers.tsan}}
6565
-DUMF_BUILD_EXAMPLES=ON
6666
-DUMF_TESTS_FAIL_ON_SKIP=ON
6767
@@ -127,7 +127,7 @@ jobs:
127127
-DUMF_FORMAT_CODE_STYLE=OFF
128128
-DUMF_DEVELOPER_MODE=ON
129129
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
130-
-DUSE_ASAN=${{matrix.sanitizers.asan}}
130+
-DUMF_USE_ASAN=${{matrix.sanitizers.asan}}
131131
-DUMF_BUILD_EXAMPLES=ON
132132
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
133133
-DUMF_TESTS_FAIL_ON_SKIP=ON

.github/workflows/valgrind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
3636
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
3737
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
38-
-DUSE_VALGRIND=1
38+
-DUMF_USE_VALGRIND=1
3939
-DUMF_TESTS_FAIL_ON_SKIP=ON
4040
4141
- name: Build

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ option(UMF_FORMAT_CODE_STYLE
5757
OFF)
5858
# Only a part of skips is treated as a failure now. TODO: extend to all tests
5959
option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF)
60-
option(USE_ASAN "Enable AddressSanitizer checks" OFF)
61-
option(USE_UBSAN "Enable UndefinedBehaviorSanitizer checks" OFF)
62-
option(USE_TSAN "Enable ThreadSanitizer checks" OFF)
63-
option(USE_MSAN "Enable MemorySanitizer checks" OFF)
64-
option(USE_VALGRIND "Enable Valgrind instrumentation" OFF)
65-
option(USE_GCOV "Enable gcov support" OFF)
60+
option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF)
61+
option(UMF_USE_UBSAN "Enable UndefinedBehaviorSanitizer checks" OFF)
62+
option(UMF_USE_TSAN "Enable ThreadSanitizer checks" OFF)
63+
option(UMF_USE_MSAN "Enable MemorySanitizer checks" OFF)
64+
option(UMF_USE_VALGRIND "Enable Valgrind instrumentation" OFF)
65+
option(UMF_USE_GCOV "Enable gcov support" OFF)
6666
option(
6767
UMF_DISABLE_HWLOC
6868
"Disable features that requires hwloc (OS provider, memory targets, topolgy discovery)"
@@ -266,16 +266,16 @@ if(MSVC)
266266
endif()
267267

268268
# Sanitizer flags
269-
if(USE_ASAN)
269+
if(UMF_USE_ASAN)
270270
add_sanitizer_flag(address)
271271
endif()
272-
if(USE_UBSAN)
272+
if(UMF_USE_UBSAN)
273273
add_sanitizer_flag(undefined)
274274
endif()
275-
if(USE_TSAN)
275+
if(UMF_USE_TSAN)
276276
add_sanitizer_flag(thread)
277277
endif()
278-
if(USE_MSAN)
278+
if(UMF_USE_MSAN)
279279
message(WARNING "MemorySanitizer requires instrumented libraries to "
280280
"prevent reporting false-positives")
281281
add_sanitizer_flag(memory)

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ origin: https://dependency_origin.com
207207
## Code coverage
208208

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

214214
```bash
215-
$ cmake -B build -DUSE_GCOV=1 -DCMAKE_BUILD_TYPE=Debug
215+
$ cmake -B build -DUMF_USE_GCOV=1 -DCMAKE_BUILD_TYPE=Debug
216216
$ cmake --build build -j
217217
$ cd build
218218
$ ctest

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ List of options provided by CMake:
113113
| UMF_DEVELOPER_MODE | Enable additional developer checks | ON/OFF | OFF |
114114
| UMF_FORMAT_CODE_STYLE | Add clang, cmake, and black -format-check and -format-apply targets to make | ON/OFF | OFF |
115115
| UMF_TESTS_FAIL_ON_SKIP | Treat skips in tests as fail | ON/OFF | OFF |
116-
| USE_ASAN | Enable AddressSanitizer checks | ON/OFF | OFF |
117-
| USE_UBSAN | Enable UndefinedBehaviorSanitizer checks | ON/OFF | OFF |
118-
| USE_TSAN | Enable ThreadSanitizer checks | ON/OFF | OFF |
119-
| USE_MSAN | Enable MemorySanitizer checks | ON/OFF | OFF |
120-
| USE_VALGRIND | Enable Valgrind instrumentation | ON/OFF | OFF |
121-
| USE_GCOV | Enable gcov support (Linux only) | ON/OFF | OFF |
116+
| UMF_USE_ASAN | Enable AddressSanitizer checks | ON/OFF | OFF |
117+
| UMF_USE_UBSAN | Enable UndefinedBehaviorSanitizer checks | ON/OFF | OFF |
118+
| UMF_USE_TSAN | Enable ThreadSanitizer checks | ON/OFF | OFF |
119+
| UMF_USE_MSAN | Enable MemorySanitizer checks | ON/OFF | OFF |
120+
| UMF_USE_VALGRIND | Enable Valgrind instrumentation | ON/OFF | OFF |
121+
| UMF_USE_GCOV | Enable gcov support (Linux only) | ON/OFF | OFF |
122122
| UMF_LINK_HWLOC_STATICALLY | Link UMF with HWLOC library statically (Windows+Release only) | ON/OFF | OFF |
123123

124124
## Architecture: memory pools and providers

benchmark/multithread.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_BENCH_MULTITHREAD_HPP
11+
#define UMF_BENCH_MULTITHREAD_HPP
12+
1013
#include <algorithm>
1114
#include <chrono>
1215
#include <cmath>
@@ -87,3 +90,5 @@ template <typename T> double std_dev(const std::vector<T> &values) {
8790
}
8891

8992
} // namespace umf_bench
93+
94+
#endif /* UMF_BENCH_MULTITHREAD_HPP */

cmake/helpers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ function(add_umf_target_compile_options name)
218218
target_compile_options(${name} PRIVATE -fno-omit-frame-pointer
219219
-fstack-protector-strong)
220220
endif()
221-
if(USE_GCOV)
221+
if(UMF_USE_GCOV)
222222
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
223223
message(FATAL_ERROR "To use gcov, the build type must be Debug")
224224
endif()
@@ -254,7 +254,7 @@ function(add_umf_target_link_options name)
254254
if(NOT MSVC)
255255
if(NOT APPLE)
256256
target_link_options(${name} PRIVATE "LINKER:-z,relro,-z,now")
257-
if(USE_GCOV)
257+
if(UMF_USE_GCOV)
258258
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
259259
message(
260260
FATAL_ERROR "To use gcov, the build type must be Debug")

examples/common/utils_level_zero.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
11+
#define UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
12+
1013
#include <stdio.h>
1114
#include <stdlib.h>
1215

@@ -412,3 +415,5 @@ int destroy_context(ze_context_handle_t context) {
412415

413416
return 0;
414417
}
418+
419+
#endif // UMF_EXAMPLE_UTILS_LEVEL_ZERO_H

src/cpp_helpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*
88
*/
99

10-
#ifndef UMF_HELPERS_H
11-
#define UMF_HELPERS_H 1
10+
#ifndef UMF_HELPERS_HPP
11+
#define UMF_HELPERS_HPP 1
1212

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

165165
} // namespace umf
166166

167-
#endif /* UMF_HELPERS_H */
167+
#endif /* UMF_HELPERS_HPP */

src/critnib/critnib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
*
88
*/
99

10-
#ifndef CRITNIB_H
11-
#define CRITNIB_H 1
10+
#ifndef UMF_CRITNIB_H
11+
#define UMF_CRITNIB_H 1
1212

1313
#include <stdint.h>
1414

@@ -44,4 +44,4 @@ void critnib_iter(critnib *c, uintptr_t min, uintptr_t max,
4444
}
4545
#endif
4646

47-
#endif
47+
#endif // UMF_CRITNIB_H

src/utils/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ set(UMF_UTILS_SOURCES_POSIX utils_posix_common.c utils_posix_concurrency.c
1313
set(UMF_UTILS_SOURCES_WINDOWS utils_windows_common.c
1414
utils_windows_concurrency.c utils_windows_math.c)
1515

16-
if(USE_VALGRIND)
17-
if(USE_ASAN
18-
OR USE_TSAN
19-
OR USE_UBSAN
20-
OR USE_MSAN)
16+
if(UMF_USE_VALGRIND)
17+
if(UMF_USE_ASAN
18+
OR UMF_USE_TSAN
19+
OR UMF_USE_UBSAN
20+
OR UMF_USE_MSAN)
2121
message(FATAL_ERROR "Cannot use valgrind and sanitizers together")
2222
endif()
2323

@@ -51,7 +51,7 @@ target_include_directories(
5151
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
5252
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
5353

54-
if(USE_VALGRIND)
54+
if(UMF_USE_VALGRIND)
5555
set(UMF_UTILS_INTERFACE_DEFS "UMF_VG_ENABLED=1")
5656
endif()
5757

src/utils/utils_math.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
*
88
*/
99

10+
#ifndef UMF_MATH_H
11+
#define UMF_MATH_H 1
12+
1013
#include <assert.h>
1114
#include <stddef.h>
1215

@@ -22,3 +25,5 @@ static inline size_t log2Utils(size_t num) { return getLeftmostSetBitPos(num); }
2225
#ifdef __cplusplus
2326
}
2427
#endif
28+
29+
#endif /* UMF_MATH_H */

test/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function(build_umf_test)
4545
endif()
4646

4747
set(TEST_LIBS
48-
test_common
48+
umf_test_common
4949
${ARG_LIBS}
5050
GTest::gtest_main
5151
${LIBS_OPTIONAL}
@@ -390,10 +390,10 @@ endif()
390390
if(LINUX
391391
AND UMF_BUILD_SHARED_LIBRARY
392392
AND NOT
393-
(USE_ASAN
394-
OR USE_UBSAN
395-
OR USE_TSAN
396-
OR USE_MSAN))
393+
(UMF_USE_ASAN
394+
OR UMF_USE_UBSAN
395+
OR UMF_USE_TSAN
396+
OR UMF_USE_MSAN))
397397
set(EXAMPLES "")
398398
if(UMF_POOL_SCALABLE_ENABLED)
399399
set(EXAMPLES ${EXAMPLES} basic)

test/common/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2023 Intel Corporation
1+
# Copyright (C) 2023-2024 Intel Corporation
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

@@ -10,8 +10,9 @@ set(COMMON_SOURCES
1010
provider_trace.c)
1111

1212
add_umf_library(
13-
NAME test_common
13+
NAME umf_test_common
1414
TYPE STATIC
1515
SRCS ${COMMON_SOURCES})
1616

17-
target_include_directories(test_common PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include)
17+
target_include_directories(umf_test_common
18+
PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include)

test/common/base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

test/common/ipc_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef IPC_COMMON_H
9-
#define IPC_COMMON_H
8+
#ifndef UMF_TEST_IPC_COMMON_H
9+
#define UMF_TEST_IPC_COMMON_H
1010

1111
#include <umf/memory_provider.h>
1212

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

27-
#endif // IPC_COMMON_H
27+
#endif // UMF_TEST_IPC_COMMON_H

test/common/ipc_os_prov_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef IPC_OS_PROV_COMMON_H
9-
#define IPC_OS_PROV_COMMON_H
8+
#ifndef UMF_TEST_IPC_OS_PROV_COMMON_H
9+
#define UMF_TEST_IPC_OS_PROV_COMMON_H
1010

1111
#include <stdlib.h>
1212

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

15-
#endif // IPC_OS_PROV_COMMON_H
15+
#endif // UMF_TEST_IPC_OS_PROV_COMMON_H

test/common/multithread_helpers.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_TEST_MULTITHREAD_HELPERS_HPP
11+
#define UMF_TEST_MULTITHREAD_HELPERS_HPP
12+
1013
#include <condition_variable>
1114
#include <memory>
1215
#include <mutex>
@@ -84,3 +87,5 @@ struct syncthreads_barrier {
8487
};
8588

8689
} // namespace umf_test
90+
91+
#endif /* UMF_TEST_MULTITHREAD_HELPERS_HPP */

test/common/numa_helpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_NUMA_HELPERS_H
6-
#define UMF_NUMA_HELPERS_H 1
5+
#ifndef UMF_TEST_NUMA_HELPERS_H
6+
#define UMF_TEST_NUMA_HELPERS_H 1
77

88
#include <numa.h>
99
#include <numaif.h>
@@ -31,4 +31,4 @@ int getNumaNodeByPtr(void *ptr) {
3131
}
3232
#endif
3333

34-
#endif /* UMF_NUMA_HELPERS_H */
34+
#endif /* UMF_TEST_NUMA_HELPERS_H */

test/common/pool.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

test/common/pool_null.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_NULL_POOL_H
6-
#define UMF_NULL_POOL_H
5+
#ifndef UMF_TEST_NULL_POOL_H
6+
#define UMF_TEST_NULL_POOL_H
77

88
#include <umf/memory_pool.h>
99

@@ -17,4 +17,4 @@ extern umf_memory_pool_ops_t UMF_NULL_POOL_OPS;
1717
}
1818
#endif
1919

20-
#endif // UMF_NULL_POOL_H
20+
#endif // UMF_TEST_NULL_POOL_H

0 commit comments

Comments
 (0)