From 473de86ee39feb711399f305b99c222702ef9e2d Mon Sep 17 00:00:00 2001 From: Rohan Yadav Date: Fri, 2 Sep 2022 10:23:17 -0400 Subject: [PATCH 1/2] src/cunumeric/search: make nonzero not always allocate SYS_MEM buffers This commit fixes a bug where nonzero would always allocate data in system memory for output buffers even when numa memories were available. This led to error messages like: ``` [0 - 7f2e7001d000] 1.243573 {5}{runtime}: [error 608] LEGION ERROR: Field 1048586 of output region 0 of task cunumeric::NonzeroTask (UID: 58) is requested to have an instance on memory 1e00000000000002, but the returned instance is allocated on memory 1e00000000000000. (from file /opt/legate/legate.core/legion/runtime/legion/runtime.cc:5797) For more information see: http://legion.stanford.edu/messages/error_code.html#error_code_608 ``` --- src/cunumeric/search/nonzero_omp.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cunumeric/search/nonzero_omp.cc b/src/cunumeric/search/nonzero_omp.cc index c0d2e9bec..178956bd6 100644 --- a/src/cunumeric/search/nonzero_omp.cc +++ b/src/cunumeric/search/nonzero_omp.cc @@ -59,7 +59,8 @@ struct NonzeroImplBody { for (auto idx = 1; idx < max_threads; ++idx) offsets[idx] = offsets[idx - 1] + sizes[idx - 1]; } - for (auto& result : results) result = create_buffer(size, Memory::Kind::SYSTEM_MEM); + auto kind = CuNumeric::has_numamem ? Memory::Kind::SOCKET_MEM : Memory::Kind::SYSTEM_MEM; + for (auto& result : results) result = create_buffer(size, kind); #pragma omp parallel { From aa32d901b2be6c4aec9921b8f3981534b3b15949 Mon Sep 17 00:00:00 2001 From: Rohan Yadav Date: Fri, 2 Sep 2022 10:43:10 -0400 Subject: [PATCH 2/2] src/cunumeric/set: make unique not always allocate in SYS_MEM This commit fixes a bug where `unique` would always allocate buffers in system memory, even when numa memory is available. --- src/cunumeric/set/unique_omp.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cunumeric/set/unique_omp.cc b/src/cunumeric/set/unique_omp.cc index f90367e71..42914d853 100644 --- a/src/cunumeric/set/unique_omp.cc +++ b/src/cunumeric/set/unique_omp.cc @@ -68,7 +68,8 @@ struct UniqueImplBody { auto& final_dedup_set = dedup_set[0]; size_t size = final_dedup_set.size(); size_t pos = 0; - auto result = create_buffer(size); + auto kind = CuNumeric::has_numamem ? Memory::Kind::SOCKET_MEM : Memory::Kind::SYSTEM_MEM; + auto result = create_buffer(size, kind); for (auto e : final_dedup_set) result[pos++] = e;