Skip to content

Commit e59eee4

Browse files
committed
tracker props2
1 parent 6cf2691 commit e59eee4

File tree

8 files changed

+351
-14
lines changed

8 files changed

+351
-14
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
205205
strategy:
206206
matrix:
207-
os: ['windows-2019', 'windows-2022']
207+
os: ['windows-2022']
208208
build_type: [Debug]
209209
compiler: [{c: icx, cxx: icx}]
210210
shared_library: ['ON', 'OFF']

.github/workflows/reusable_basic.yml

Lines changed: 333 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,336 @@ jobs:
230230
${{ matrix.install_tbb == 'ON' && matrix.disable_hwloc != 'ON' && matrix.shared_library == 'ON' && '--proxy' || '' }}
231231
--umf-version ${{env.UMF_VERSION}}
232232
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}
233+
234+
windows-build:
235+
env:
236+
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
237+
VCPKG_PATH_BIN: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows/bin;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows/bin;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows/bin"
238+
strategy:
239+
matrix:
240+
os: ['windows-2022']
241+
build_type: [Debug, Release]
242+
compiler: [{c: cl, cxx: cl}]
243+
shared_library: ['ON', 'OFF']
244+
level_zero_provider: ['ON']
245+
cuda_provider: ['ON']
246+
cmake_ver: ['default']
247+
include:
248+
- os: 'windows-2022'
249+
build_type: Release
250+
compiler: {c: cl, cxx: cl}
251+
shared_library: 'ON'
252+
level_zero_provider: 'ON'
253+
cuda_provider: 'ON'
254+
umfd_lib: 'ON'
255+
cmake_ver: '3.28.0-windows-x86_64'
256+
- os: 'windows-2022'
257+
build_type: Release
258+
compiler: {c: cl, cxx: cl}
259+
shared_library: 'ON'
260+
level_zero_provider: 'OFF'
261+
cuda_provider: 'OFF'
262+
cmake_ver: 'default'
263+
name: Basic (${{matrix.os}}, build_type=${{matrix.build_type}}, compilers=${{matrix.compiler.c}}/${{matrix.compiler.cxx}}, shared_library=${{matrix.shared_library}}, level_zero_provider=${{matrix.level_zero_provider}}, cuda_provider=${{matrix.cuda_provider}}, cmake_ver=${{matrix.cmake_ver}})
264+
runs-on: ${{matrix.os}}
265+
266+
steps:
267+
- name: Checkout
268+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
269+
with:
270+
fetch-depth: 0
271+
272+
- name: Install cmake (non-default version)
273+
if: matrix.cmake_ver != 'default'
274+
run: |
275+
$ErrorActionPreference = "Stop"
276+
$cmakePath = "C:\Program Files\CMake"
277+
if (Test-Path -Path $cmakePath) {
278+
Write-Host "Removing existing CMake installation..."
279+
Remove-Item -Recurse -Force -Path $cmakePath
280+
}
281+
$cmakeInstaller = "cmake-${{matrix.cmake_ver}}.msi"
282+
$cmakeInstallerParts = $cmakeInstaller -split '-|\.'
283+
$cmakeMajorMinorPatch = "$($cmakeInstallerParts[1]).$($cmakeInstallerParts[2]).$($cmakeInstallerParts[3])"
284+
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v$cmakeMajorMinorPatch/$cmakeInstaller"
285+
Write-Host "Downloading CMake version ${{matrix.cmake_ver}}..."
286+
Invoke-WebRequest -Uri $cmakeUrl -OutFile $cmakeInstaller -TimeoutSec 360
287+
Write-Host "Installing CMake version ${{matrix.cmake_ver}}..."
288+
Start-Process msiexec.exe -ArgumentList "/i $cmakeInstaller /quiet /norestart" -Wait
289+
cmake --version
290+
291+
- name: Initialize vcpkg
292+
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
293+
with:
294+
vcpkgGitCommitId: ea2a964f9303270322cf3f2d51c265ba146c422d # 1.04.2025
295+
vcpkgDirectory: ${{env.BUILD_DIR}}/vcpkg
296+
vcpkgJsonGlob: '**/vcpkg.json'
297+
298+
# Install the dependencies and add the bin folders to the PATH for older
299+
# versions of CMake to correctly locate the libraries
300+
- name: Install dependencies
301+
run: |
302+
vcpkg install --triplet x64-windows
303+
$env:Path = "${{env.VCPKG_PATH_BIN}};$env:Path"
304+
echo "PATH=$env:Path" >> $env:GITHUB_ENV
305+
shell: pwsh # Specifies PowerShell as the shell for running the script.
306+
307+
- name: Get UMF version
308+
run: |
309+
$version = (git describe --tags --abbrev=0 | Select-String -Pattern '\d+\.\d+\.\d+').Matches.Value
310+
echo "UMF_VERSION=$version" >> $env:GITHUB_ENV
311+
shell: pwsh
312+
313+
- name: Configure build
314+
run: >
315+
cmake
316+
-B ${{env.BUILD_DIR}}
317+
${{matrix.toolset}}
318+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
319+
-DCMAKE_PREFIX_PATH="${{env.VCPKG_PATH}}"
320+
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
321+
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
322+
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
323+
-DUMF_FORMAT_CODE_STYLE=OFF
324+
-DUMF_DEVELOPER_MODE=ON
325+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
326+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=${{matrix.level_zero_provider}}
327+
-DUMF_BUILD_CUDA_PROVIDER=${{matrix.cuda_provider}}
328+
-DUMF_TESTS_FAIL_ON_SKIP=ON
329+
-DUMF_USE_DEBUG_POSTFIX=${{matrix.umfd_lib}}
330+
331+
- name: Build UMF
332+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
333+
334+
- name: Run tests
335+
working-directory: ${{env.BUILD_DIR}}
336+
# For CMake versions < 3.22 we have to add the build directory to the PATH
337+
# manually
338+
run: |
339+
$m = [regex]::Matches((cmake --version), "cmake version (\d+)\.(\d+)\.(\d+)")
340+
if ($m) {
341+
$major = [int]$m.groups[1].Value
342+
$minor = [int]$m.groups[2].Value
343+
if ($major -lt 3 -or ($major -eq 3 -and $minor -lt 22)) {
344+
$env:Path = "${{env.BUILD_DIR}}/bin/${{matrix.build_type}};${{env.BUILD_DIR}}/src/proxy_lib/${{matrix.build_type}};$env:Path"
345+
}
346+
}
347+
ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
348+
shell: pwsh
349+
350+
- name: Test UMF installation and uninstallation
351+
# The '--shared-library' parameter is added to the installation test when
352+
# the UMF is built as a shared library
353+
run: >
354+
python3 ${{github.workspace}}/test/test_installation.py
355+
--build-dir ${{env.BUILD_DIR}}
356+
--install-dir ${{env.INSTL_DIR}}
357+
--build-type ${{matrix.build_type}}
358+
${{matrix.shared_library == 'ON' && '--proxy' || '' }}
359+
--umf-version ${{env.UMF_VERSION}}
360+
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
361+
${{ matrix.umfd_lib == 'ON' && '--umfd-lib' || ''}}
362+
363+
- name: check /DEPENDENTLOADFLAG in umf.dll
364+
if: ${{matrix.shared_library == 'ON' && matrix.compiler.cxx == 'cl'}}
365+
run: ${{github.workspace}}/.github/scripts/check_dll_flags.ps1 ${{env.BUILD_DIR}}/bin/${{matrix.build_type}}/umf.dll
366+
shell: pwsh
367+
368+
- name: check /DEPENDENTLOADFLAG in umf_proxy.dll
369+
if: ${{matrix.shared_library == 'ON' && matrix.compiler.cxx == 'cl'}}
370+
run: ${{github.workspace}}/.github/scripts/check_dll_flags.ps1 ${{env.BUILD_DIR}}/src/proxy_lib/${{matrix.build_type}}/umf_proxy.dll
371+
shell: pwsh
372+
373+
windows-dynamic_build_hwloc:
374+
name: "Windows dynamic UMF + static hwloc"
375+
strategy:
376+
matrix:
377+
build_type: [Release]
378+
379+
runs-on: 'windows-2022'
380+
381+
steps:
382+
- name: Checkout
383+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
384+
with:
385+
fetch-depth: 0
386+
387+
- name: Configure build
388+
run: >
389+
cmake
390+
-B ${{env.BUILD_DIR}}
391+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
392+
-DUMF_BUILD_SHARED_LIBRARY=ON
393+
-DUMF_BUILD_EXAMPLES=ON
394+
-DUMF_FORMAT_CODE_STYLE=OFF
395+
-DUMF_DEVELOPER_MODE=ON
396+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
397+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
398+
-DUMF_BUILD_CUDA_PROVIDER=ON
399+
-DUMF_TESTS_FAIL_ON_SKIP=ON
400+
-DUMF_LINK_HWLOC_STATICALLY=ON
401+
402+
- name: Build UMF
403+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
404+
405+
- name: Run tests
406+
working-directory: ${{env.BUILD_DIR}}
407+
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
408+
409+
# we check umf.dll only here - note that the proxy library is disabled in
410+
# this configuration
411+
- name: check /DEPENDENTLOADFLAG in umf.dll
412+
run: ${{github.workspace}}/.github/scripts/check_dll_flags.ps1 ${{env.BUILD_DIR}}/bin/${{matrix.build_type}}/umf.dll
413+
shell: pwsh
414+
415+
windows-static_build_hwloc:
416+
name: "Windows static UMF + static hwloc"
417+
strategy:
418+
matrix:
419+
build_type: [Release]
420+
421+
runs-on: 'windows-2022'
422+
423+
steps:
424+
- name: Checkout
425+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
426+
with:
427+
fetch-depth: 0
428+
429+
- name: Configure build
430+
run: >
431+
cmake
432+
-B ${{env.BUILD_DIR}}
433+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
434+
-DUMF_BUILD_SHARED_LIBRARY=OFF
435+
-DUMF_BUILD_EXAMPLES=ON
436+
-DUMF_FORMAT_CODE_STYLE=OFF
437+
-DUMF_DEVELOPER_MODE=ON
438+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=OFF
439+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
440+
-DUMF_BUILD_CUDA_PROVIDER=ON
441+
-DUMF_TESTS_FAIL_ON_SKIP=ON
442+
-DUMF_LINK_HWLOC_STATICALLY=ON
443+
444+
- name: Build UMF
445+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS -v
446+
447+
- name: Run tests
448+
working-directory: ${{env.BUILD_DIR}}
449+
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
450+
451+
windows-dynamic_mingw_hwloc:
452+
env:
453+
HWLOC_PACKAGE_NAME: hwloc-win64-build-2.10.0
454+
TBB_PACKAGE_NAME: oneapi-tbb-2021.12.0
455+
TBB_LIB_DIR: lib\intel64\vc14
456+
TBB_BIN_DIR: redist\intel64\vc14
457+
458+
name: "Windows dynamic UMF + mingw libhwloc"
459+
strategy:
460+
matrix:
461+
build_type: [Release]
462+
463+
runs-on: 'windows-2022'
464+
465+
steps:
466+
- name: Checkout
467+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
468+
with:
469+
fetch-depth: 0
470+
471+
- name: Get hwloc from official repo (mingw version)
472+
run: |
473+
Invoke-WebRequest -Uri https://download.open-mpi.org/release/hwloc/v2.10/${{env.HWLOC_PACKAGE_NAME}}.zip -OutFile ${{github.workspace}}\${{env.HWLOC_PACKAGE_NAME}}.zip -TimeoutSec 360
474+
Expand-Archive ${{github.workspace}}\${{env.HWLOC_PACKAGE_NAME}}.zip -DestinationPath ${{github.workspace}}
475+
476+
- name: Get TBB from github
477+
run: |
478+
Invoke-WebRequest -Uri https://github.com/oneapi-src/oneTBB/releases/download/v2021.12.0/${{env.TBB_PACKAGE_NAME}}-win.zip -OutFile "${{github.workspace}}\${{env.TBB_PACKAGE_NAME}}-win.zip" -TimeoutSec 360
479+
Expand-Archive "${{github.workspace}}\${{env.TBB_PACKAGE_NAME}}-win.zip" -DestinationPath ${{github.workspace}}
480+
481+
- name: Configure build
482+
run: >
483+
cmake
484+
-B ${{env.BUILD_DIR}}
485+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
486+
-DCMAKE_PREFIX_PATH="${{github.workspace}}\${{env.HWLOC_PACKAGE_NAME}};${{github.workspace}}\${{env.TBB_PACKAGE_NAME}};${{github.workspace}}\${{env.TBB_PACKAGE_NAME}}\${{env.TBB_LIB_DIR}};${{github.workspace}}\${{env.TBB_PACKAGE_NAME}}\${{env.TBB_BIN_DIR}}"
487+
-DUMF_BUILD_SHARED_LIBRARY=ON
488+
-DUMF_BUILD_EXAMPLES=ON
489+
-DUMF_FORMAT_CODE_STYLE=OFF
490+
-DUMF_DEVELOPER_MODE=ON
491+
-DUMF_TESTS_FAIL_ON_SKIP=ON
492+
-DUMF_HWLOC_NAME=libhwloc
493+
494+
- name: Build UMF
495+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
496+
497+
- name: Run tests
498+
working-directory: ${{env.BUILD_DIR}}
499+
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
500+
501+
macos-build:
502+
strategy:
503+
matrix:
504+
os: ['macos-13', 'macos-14']
505+
include:
506+
- os: macos-14
507+
static_hwloc: 'ON'
508+
env:
509+
BUILD_TYPE : "Release"
510+
name: Basic (${{matrix.os}}, static_hwloc=${{matrix.static_hwloc}})
511+
runs-on: ${{matrix.os}}
512+
513+
steps:
514+
- name: Checkout
515+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
516+
with:
517+
fetch-depth: 0
518+
519+
# Latest distros do not allow global pip installation
520+
- name: Install Python requirements in venv
521+
run: |
522+
python3 -m venv .venv
523+
. .venv/bin/activate
524+
echo "$PATH" >> $GITHUB_PATH
525+
python3 -m pip install -r third_party/requirements.txt
526+
527+
- name: Install dependencies
528+
run: brew install jemalloc tbb automake libtool
529+
530+
- name: Install hwloc
531+
if: ${{ !matrix.static_hwloc }}
532+
run: brew install hwloc
533+
534+
- name: Get UMF version
535+
run: |
536+
VERSION=$(git describe --tags --abbrev=0 | grep -Eo '\d+\.\d+\.\d+')
537+
echo "UMF_VERSION=$VERSION" >> $GITHUB_ENV
538+
539+
- name: Configure build
540+
run: >
541+
cmake
542+
-B ${{env.BUILD_DIR}}
543+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
544+
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
545+
-DUMF_FORMAT_CODE_STYLE=OFF
546+
-DUMF_DEVELOPER_MODE=ON
547+
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
548+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
549+
-DUMF_BUILD_SHARED_LIBRARY=ON
550+
-DUMF_TESTS_FAIL_ON_SKIP=ON
551+
-DUMF_LINK_HWLOC_STATICALLY=${{matrix.static_hwloc}}
552+
${{matrix.static_hwloc}}
553+
554+
- name: Build UMF
555+
run: cmake --build ${{env.BUILD_DIR}} -j $(sysctl -n hw.logicalcpu)
556+
557+
- name: Test UMF installation and uninstallation
558+
run: >
559+
python3 ${{github.workspace}}/test/test_installation.py
560+
--build-dir ${{env.BUILD_DIR}}
561+
--install-dir ${{env.INSTL_DIR}}
562+
--build-type ${{env.BUILD_TYPE}}
563+
--proxy
564+
--umf-version ${{env.UMF_VERSION}}
565+
--shared-library

src/ipc.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,19 @@ umf_result_t umfGetIPCHandle(const void *ptr, umf_ipc_handle_t *umfIPCHandle,
5858
}
5959

6060
size_t ipcHandleSize = 0;
61-
umf_alloc_info_t allocInfo = {NULL, 0, NULL, NULL};
61+
umf_alloc_info_t allocInfo = {NULL, 0, NULL};
6262
umf_result_t ret = umfMemoryTrackerGetAllocInfo(ptr, &allocInfo);
6363
if (ret != UMF_RESULT_SUCCESS) {
6464
LOG_ERR("cannot get alloc info for ptr = %p.", ptr);
6565
return ret;
6666
}
6767

68-
ret = umfPoolGetIPCHandleSize(allocInfo.pool, &ipcHandleSize);
68+
if (allocInfo.props == NULL || allocInfo.props->pool == NULL) {
69+
LOG_ERR("cannot get pool from alloc info for ptr = %p.", ptr);
70+
return UMF_RESULT_ERROR_UNKNOWN;
71+
}
72+
73+
ret = umfPoolGetIPCHandleSize(allocInfo.props->pool, &ipcHandleSize);
6974
if (ret != UMF_RESULT_SUCCESS) {
7075
LOG_ERR("cannot get IPC handle size.");
7176
return ret;
@@ -79,12 +84,13 @@ umf_result_t umfGetIPCHandle(const void *ptr, umf_ipc_handle_t *umfIPCHandle,
7984

8085
// We cannot use umfPoolGetMemoryProvider function because it returns
8186
// upstream provider but we need tracking one
82-
if (allocInfo.pool == NULL || allocInfo.pool->provider == NULL) {
87+
if (allocInfo.props == NULL || allocInfo.props->pool == NULL ||
88+
allocInfo.props->pool->provider == NULL) {
8389
LOG_ERR("cannot get memory provider from pool");
8490
umf_ba_global_free(ipcData);
8591
return UMF_RESULT_ERROR_UNKNOWN;
8692
}
87-
umf_memory_provider_handle_t provider = allocInfo.pool->provider;
93+
umf_memory_provider_handle_t provider = allocInfo.props->pool->provider;
8894

8995
ret = umfMemoryProviderGetIPCHandle(provider, allocInfo.base,
9096
allocInfo.baseSize,

src/memory_props.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ umfGetMemoryPropertiesHandle(const void *ptr,
2323
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
2424
}
2525

26-
umf_alloc_info_t allocInfo = {NULL, 0, NULL, NULL};
26+
umf_alloc_info_t allocInfo = {NULL, 0, NULL};
2727
umf_result_t ret = umfMemoryTrackerGetAllocInfo(ptr, &allocInfo);
2828
if (ret != UMF_RESULT_SUCCESS) {
2929
return UMF_RESULT_ERROR_INVALID_ARGUMENT;

0 commit comments

Comments
 (0)