Skip to content

Commit e3b2b6c

Browse files
committed
tracker props2
1 parent 6cf2691 commit e3b2b6c

File tree

8 files changed

+360
-14
lines changed

8 files changed

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

0 commit comments

Comments
 (0)