Skip to content

Commit 8fd1ab1

Browse files
authored
Merge branch 'main' into addDocker
2 parents 1dc7cca + e31c856 commit 8fd1ab1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+889
-592
lines changed

.cmake-format

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ with section("parse"):
99
"pargs": 0,
1010
"flags": [],
1111
'kwargs': {
12-
'NAME': '*',
13-
'SRCS': '*',
14-
'LIBS': '*' ,
12+
'NAME': '*',
13+
'SRCS': '*',
14+
'LIBS': '*' ,
1515
'LIBDIRS': '*'}},
1616
'add_umf_executable': {
1717
"pargs": 0,
1818
"flags": [],
1919
'kwargs': {
20-
'NAME': '*',
21-
'SRCS': '*',
20+
'NAME': '*',
21+
'SRCS': '*',
2222
'LIBS': '*'}},
2323
'add_umf_test': {
2424
"pargs": 0,
2525
"flags": [],
2626
'kwargs': {
27-
'NAME': '*',
28-
'SRCS': '*',
27+
'NAME': '*',
28+
'SRCS': '*',
2929
'LIBS': '*'}},
3030
'add_umf_library': {
3131
"pargs": 0,
3232
"flags": [],
3333
'kwargs': {
34-
'NAME': '*',
35-
'TYPE': '*',
36-
'SRCS': '*',
34+
'NAME': '*',
35+
'TYPE': '*',
36+
'SRCS': '*',
3737
'LIBS': '*',
3838
'LINUX_MAP_FILE': '*',
3939
'WINDOWS_DEF_FILE': '*'}},
@@ -43,7 +43,20 @@ with section("parse"):
4343
'kwargs': {
4444
'LABELS': '*',
4545
'PASS_REGULAR_EXPRESSION': '*'}},
46-
}
46+
'build_umf_test': {
47+
"pargs": 0,
48+
"flags": [],
49+
'kwargs': {
50+
'NAME': '*',
51+
'SRCS': '*',
52+
'LIBS': '*' }},
53+
'add_umf_ipc_test': {
54+
"pargs": 0,
55+
"flags": [],
56+
'kwargs': {
57+
'TEST': '*',
58+
'SRC_DIR': '*'}},
59+
}
4760

4861
# Override configurations per-command where available
4962
override_spec = {}

.github/workflows/reusable_basic.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ jobs:
145145
- name: Install libhwloc
146146
run: .github/scripts/install_hwloc.sh
147147

148-
- name: Set ptrace value for IPC test
149-
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
150-
151148
- name: Get UMF version
152149
run: |
153150
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+')
@@ -341,7 +338,7 @@ jobs:
341338
-B ${{env.BUILD_DIR}}
342339
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
343340
-DUMF_BUILD_SHARED_LIBRARY=ON
344-
-DUMF_BUILD_EXAMPLES=ON
341+
-DUMF_BUILD_EXAMPLES=OFF
345342
-DUMF_FORMAT_CODE_STYLE=OFF
346343
-DUMF_DEVELOPER_MODE=ON
347344
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
@@ -384,7 +381,7 @@ jobs:
384381
-B ${{env.BUILD_DIR}}
385382
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
386383
-DUMF_BUILD_SHARED_LIBRARY=OFF
387-
-DUMF_BUILD_EXAMPLES=ON
384+
-DUMF_BUILD_EXAMPLES=OFF
388385
-DUMF_FORMAT_CODE_STYLE=OFF
389386
-DUMF_DEVELOPER_MODE=ON
390387
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
@@ -456,6 +453,9 @@ jobs:
456453
strategy:
457454
matrix:
458455
os: ['macos-13', 'macos-14']
456+
include:
457+
- os: macos-14
458+
static_hwloc: '-DUMF_LINK_HWLOC_STATICALLY=ON'
459459
env:
460460
BUILD_TYPE : "Release"
461461
runs-on: ${{matrix.os}}
@@ -474,8 +474,12 @@ jobs:
474474
echo "$PATH" >> $GITHUB_PATH
475475
python3 -m pip install -r third_party/requirements.txt
476476
477+
- name: Install dependencies
478+
run: brew install jemalloc tbb automake libtool
479+
477480
- name: Install hwloc
478-
run: brew install hwloc tbb automake
481+
if: ${{ !matrix.static_hwloc }}
482+
run: brew install hwloc
479483

480484
- name: Get UMF version
481485
run: |
@@ -495,6 +499,7 @@ jobs:
495499
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
496500
-DUMF_BUILD_SHARED_LIBRARY=ON
497501
-DUMF_TESTS_FAIL_ON_SKIP=ON
502+
${{matrix.static_hwloc}}
498503
499504
- name: Build UMF
500505
run: cmake --build ${{env.BUILD_DIR}} -j $(sysctl -n hw.logicalcpu)

.github/workflows/reusable_proxy_lib.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
sudo apt-get update
3535
sudo apt-get install -y cmake libhwloc-dev libtbb-dev lcov
3636
37-
- name: Set ptrace value for IPC test
38-
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
39-
4037
- name: Configure build
4138
run: >
4239
cmake

.github/workflows/reusable_sanitizers.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ jobs:
4040
sudo apt-get update
4141
sudo apt-get install -y intel-oneapi-ippcp-devel intel-oneapi-ipp-devel intel-oneapi-common-oneapi-vars intel-oneapi-compiler-dpcpp-cpp
4242
43-
44-
- name: Set ptrace value for IPC test
45-
run: sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
46-
4743
- name: Configure build
4844
run: >
4945
${{ matrix.compiler.cxx == 'icpx' && '. /opt/intel/oneapi/setvars.sh &&' || ''}}

CMakeLists.txt

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ list(APPEND CMAKE_MODULE_PATH "${UMF_CMAKE_SOURCE_DIR}/cmake")
1010
# Use full path of the helpers module (to omit potential conflicts with others)
1111
include(${UMF_CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
1212

13+
# --------------------------------------------------------------------------- #
14+
# Set UMF version variables, define project, and add basic modules
15+
# --------------------------------------------------------------------------- #
16+
1317
# We use semver aligned version, set via git tags. We parse git output to
1418
# establish the version of UMF to be used in CMake, Win dll's, and within the
1519
# code (e.g. in logger). We have 3-component releases (e.g. 1.5.1) plus release
@@ -22,6 +26,12 @@ project(
2226
umf
2327
VERSION ${UMF_CMAKE_VERSION}
2428
LANGUAGES C)
29+
if(UMF_CMAKE_VERSION VERSION_EQUAL "0.0.0")
30+
message(
31+
WARNING
32+
"UMF version is set to 0.0.0, which most likely is not expected! "
33+
"Please checkout the git tags to get a proper version.")
34+
endif()
2535

2636
if(PROJECT_VERSION_PATCH GREATER 0)
2737
# set extra variable for Windows dll metadata
@@ -33,6 +43,10 @@ include(CMakePackageConfigHelpers)
3343
include(GNUInstallDirs)
3444
find_package(PkgConfig)
3545

46+
# --------------------------------------------------------------------------- #
47+
# Set UMF build options (and CACHE variables)
48+
# --------------------------------------------------------------------------- #
49+
3650
# Define a list to store the names of all options
3751
set(UMF_OPTIONS_LIST "")
3852
list(APPEND UMF_OPTIONS_LIST CMAKE_BUILD_TYPE)
@@ -43,7 +57,6 @@ macro(umf_option)
4357
option(${ARGV})
4458
endmacro()
4559

46-
# Build Options
4760
umf_option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
4861
umf_option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON)
4962
umf_option(UMF_BUILD_CUDA_PROVIDER "Build CUDA memory provider" ON)
@@ -56,9 +69,8 @@ umf_option(UMF_BUILD_GPU_TESTS "Build UMF GPU tests" OFF)
5669
umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
5770
umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF)
5871
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
59-
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6072
umf_option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
61-
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
73+
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6274
umf_option(
6375
UMF_DISABLE_HWLOC
6476
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
@@ -67,9 +79,6 @@ umf_option(
6779
UMF_LINK_HWLOC_STATICALLY
6880
"Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build)"
6981
OFF)
70-
umf_option(
71-
UMF_FORMAT_CODE_STYLE
72-
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
7382
set(UMF_HWLOC_NAME
7483
"hwloc"
7584
CACHE STRING "Custom name for hwloc library w/o extension")
@@ -81,6 +90,10 @@ set(UMF_INSTALL_RPATH
8190
"Set the runtime search path to the directory with dependencies (e.g. hwloc)"
8291
)
8392

93+
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
94+
umf_option(
95+
UMF_FORMAT_CODE_STYLE
96+
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
8497
# Only a part of skips is treated as a failure now. TODO: extend to all tests
8598
umf_option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF)
8699
umf_option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF)
@@ -100,6 +113,11 @@ set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
100113
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS})
101114
list(APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)
102115

116+
# --------------------------------------------------------------------------- #
117+
# Setup required variables, definitions; fetch dependencies; include
118+
# sub_directories based on build options; set flags; etc.
119+
# --------------------------------------------------------------------------- #
120+
103121
if(UMF_BUILD_TESTS
104122
AND DEFINED ENV{CI}
105123
AND NOT UMF_TESTS_FAIL_ON_SKIP)
@@ -263,8 +281,8 @@ else()
263281

264282
set(LIBHWLOC_INCLUDE_DIRS
265283
${hwloc_targ_SOURCE_DIR}/include;${hwloc_targ_BINARY_DIR}/include)
266-
set(LIBHWLOC_LIBRARY_DIRS ${hwloc_targ_BINARY_DIR}/$<CONFIG>)
267-
set(LIBHWLOC_LIBRARIES ${hwloc_targ_BINARY_DIR}/$<CONFIG>/hwloc.lib)
284+
set(LIBHWLOC_LIBRARY_DIRS
285+
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
268286
else()
269287
include(FetchContent)
270288
message(
@@ -711,7 +729,7 @@ if(UMF_FORMAT_CODE_STYLE)
711729
add_custom_target(
712730
cmake-format-apply
713731
COMMAND ${CMAKE_FORMAT} --in-place ${format_cmake_list}
714-
COMMENT "Format Cmake files using cmake-format")
732+
COMMENT "Format CMake files using cmake-format")
715733
endif()
716734

717735
if(BLACK)

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,12 @@ OS memory provider supports two types of memory mappings (set by the `visibility
159159
IPC API requires the `UMF_MEM_MAP_SHARED` memory `visibility` mode
160160
(`UMF_RESULT_ERROR_INVALID_ARGUMENT` is returned otherwise).
161161

162-
IPC API uses the file descriptor duplication. It requires using `pidfd_getfd(2)` to obtain
163-
a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported since Linux 5.6).
164-
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
165-
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
166-
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
162+
IPC API uses file descriptor duplication, which requires the `pidfd_getfd(2)` system call to obtain
163+
a duplicate of another process's file descriptor. This system call is supported since Linux 5.6.
164+
Required permission ("restricted ptrace") is governed by the `PTRACE_MODE_ATTACH_REALCREDS` check
165+
(see `ptrace(2)`). To allow file descriptor duplication in a binary that opens IPC handle, you can call
166+
`prctl(PR_SET_PTRACER, ...)` in the producer binary that gets the IPC handle.
167+
Alternatively you can change the `ptrace_scope` globally in the system, e.g.:
167168

168169
```sh
169170
sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
@@ -194,16 +195,16 @@ Packages required for tests (Linux-only yet):
194195

195196
A memory provider that provides memory from L0 device.
196197

197-
IPC API uses the file descriptor duplication. It requires using `pidfd_getfd(2)` to obtain
198-
a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported since Linux 5.6).
199-
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
200-
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
201-
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
198+
IPC API uses file descriptor duplication, which requires the `pidfd_getfd(2)` system call to obtain
199+
a duplicate of another process's file descriptor. This system call is supported since Linux 5.6.
200+
Required permission ("restricted ptrace") is governed by the `PTRACE_MODE_ATTACH_REALCREDS` check
201+
(see `ptrace(2)`). To allow file descriptor duplication in a binary that opens IPC handle, you can call
202+
`prctl(PR_SET_PTRACER, ...)` in the producer binary that gets the IPC handle.
203+
Alternatively you can change the `ptrace_scope` globally in the system, e.g.:
202204

203205
```sh
204206
sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
205207
```
206-
207208
##### Requirements
208209

209210
1) Linux or Windows OS
@@ -359,7 +360,7 @@ The memory used by the proxy memory allocator is mmap'ed:
359360
1) with the `MAP_PRIVATE` flag by default or
360361
2) with the `MAP_SHARED` flag if the `UMF_PROXY` environment variable contains one of two following strings: `page.disposition=shared-shm` or `page.disposition=shared-fd`. These two options differ in a mechanism used during IPC:
361362
- `page.disposition=shared-shm` - IPC uses the named shared memory. An SHM name is generated using the `umf_proxy_lib_shm_pid_$PID` pattern, where `$PID` is the PID of the process. It creates the `/dev/shm/umf_proxy_lib_shm_pid_$PID` file.
362-
- `page.disposition=shared-fd` - IPC uses the file descriptor duplication. It requires using `pidfd_getfd(2)` to obtain a duplicate of another process's file descriptor. Permission to duplicate another process's file descriptor is governed by a ptrace access mode `PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using the `/proc/sys/kernel/yama/ptrace_scope` interface. `pidfd_getfd(2)` is supported since Linux 5.6.
363+
- `page.disposition=shared-fd` - IPC API uses file descriptor duplication, which requires the `pidfd_getfd(2)` system call to obtain a duplicate of another process's file descriptor. This system call is supported since Linux 5.6. Required permission ("restricted ptrace") is governed by the `PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`). To allow file descriptor duplication in a binary that opens IPC handle, you can call `prctl(PR_SET_PTRACER, ...)` in the producer binary that gets the IPC handle. Alternatively you can change the `ptrace_scope` globally in the system, e.g.: `sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"`.
363364

364365
**Size threshold**
365366

RELEASE_STEPS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ Do changes for a release:
4949
- If stable branch for this release is required, create it:
5050
- `git checkout -b v$VER.x`
5151
- For some early versions (like `0.1.0`) we may omit creation of the branch
52+
- For major/minor release, when release is done, add an extra "dev" tag on the `main` branch:
53+
- `git tag -a -s -m "Development version $VERSION+1" v$VERSION+1-dev`
54+
- for example, when `v0.1.0` is released, the dev tag would be `v0.2.0-dev`
55+
- if needed, further in time, an extra dev tag can be introduced, e.g. `v0.2.0-dev1`
56+
- This way, the `main` branch will introduce itself as the next version
5257

5358
## Publish changes
5459

0 commit comments

Comments
 (0)