From e9e9cacb71cef84d38247f6d8fe4ce27d809e4fa Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Sun, 19 Jul 2020 14:55:10 -0400 Subject: [PATCH] Support numa if libnume-dev is installed Let rocclr decide numa dependence Change-Id: I65bdfba7ec0d06b550f86632318bcfd1f765cfa9 [ROCm/hip-tests commit: f6f37fb73f9ad7e48f256bcaab21d2f01e2e3090] --- projects/hip-tests/perftests/memory/hipHostNumaAlloc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/hip-tests/perftests/memory/hipHostNumaAlloc.cpp b/projects/hip-tests/perftests/memory/hipHostNumaAlloc.cpp index 75d6edf0cf..38401c8046 100644 --- a/projects/hip-tests/perftests/memory/hipHostNumaAlloc.cpp +++ b/projects/hip-tests/perftests/memory/hipHostNumaAlloc.cpp @@ -34,12 +34,13 @@ THE SOFTWARE. #include #include "hip/hip_runtime.h" /* HIT_START - * BUILD: %t %s ../../src/test_common.cpp EXCLUDE_HIP_PLATFORM nvcc + * BUILD_CMD: hipHostNumaAlloc %hc -I%S/../../src %S/%s %S/../../src/test_common.cpp -lnuma -o %T/%t EXCLUDE_HIP_PLATFORM nvcc * TEST: %t * HIT_END */ -// To run it correctly, we must not export HIP_VISIBLE_DEVICES +// To run it correctly, we must not export HIP_VISIBLE_DEVICES. +// And we must explicitly link libnuma because of numa api move_pages(). #define NUM_PAGES 4 char *h = nullptr; char *d_h = nullptr; @@ -127,6 +128,7 @@ bool test(int cpuId, int gpuId, int numaMode, unsigned int hostMallocflags) { printf("\n"); HIPCHECK(hipHostFree((void* )h)); + hipHostUnregister(m); free(m); if (cpuId >= 0 && (numaMode == MPOL_BIND || numaMode == MPOL_PREFERRED)) { @@ -149,8 +151,7 @@ bool runTest(const int &cpuCount, const int &gpuCount, for (int i = 0; i < cpuCount; i++) { for (int j = 0; j < gpuCount; j++) { - if (!test(i, j, mode[m], - hipHostMallocDefault | hipHostMallocNumaUser)) { + if (!test(i, j, mode[m], hostMallocflags)) { return false; } }