From f25f6d8ae5c486aac184b860164d5ba0fca8e58d Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Tue, 9 Jul 2024 00:16:11 +0100 Subject: [PATCH] fix: Check for existence of_ SC_AVPHYS_PAGES to fix MacOS compilation. (#3207) * check for existence of_ SC_AVPHYS_PAGES --------- Co-authored-by: Randolph Settgast --- .github/workflows/ci_tests.yml | 10 ++++++++++ src/coreComponents/common/MemoryInfos.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 213a7676b3a..cfb05e6313f 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -259,6 +259,16 @@ jobs: GCP_BUCKET: geosx/ubuntu22.04-gcc11 RUNS_ON: Runner_4core_16GB + # mac_builds: + # needs: + # - is_not_draft_pull_request + # runs-on: macos-14-xlarge + # steps: + # - run: sysctl -n hw.physicalcpu + # - run: sysctl -h hw.memsize + # - run: sysctl -n machdep.cpu.brand_string + + # If the 'ci: run CUDA builds' PR label is found, the cuda jobs run immediately along side linux jobs. # Note: CUDA jobs should only be run if PR is ready to merge. cuda_builds: diff --git a/src/coreComponents/common/MemoryInfos.cpp b/src/coreComponents/common/MemoryInfos.cpp index 98b0093c82f..145fff87f7a 100644 --- a/src/coreComponents/common/MemoryInfos.cpp +++ b/src/coreComponents/common/MemoryInfos.cpp @@ -27,8 +27,13 @@ MemoryInfos::MemoryInfos( umpire::MemoryResourceTraits::resource_type resourceTy case umpire::MemoryResourceTraits::resource_type::pinned: #if defined( _SC_PHYS_PAGES ) && defined( _SC_PAGESIZE ) m_totalMemory = sysconf( _SC_PHYS_PAGES ) * sysconf( _SC_PAGESIZE ); + #if defined(_SC_AVPHYS_PAGES) m_availableMemory = sysconf( _SC_AVPHYS_PAGES ) * sysconf( _SC_PAGESIZE ); #else + GEOS_WARNING( "Unknown device avaialable memory size getter for this system." ); + m_availableMemory = 0; + #endif + #else GEOS_WARNING( "Unknown device physical memory size getter for this compiler." ); m_physicalMemoryHandled = 0; #endif