From cb5b7a91885d840477d800c1f3fb7db1f8e980ff Mon Sep 17 00:00:00 2001 From: Azamat Mametjanov Date: Wed, 11 Dec 2024 09:12:58 -0800 Subject: [PATCH] Fix reductions ctest for nvidia on perlmutter Release build with -O2 incorrectly optimized out inner-loop if-stmt. This re-orders for-loops to avoid that. --- components/omega/test/base/ReductionsTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/omega/test/base/ReductionsTest.cpp b/components/omega/test/base/ReductionsTest.cpp index a9d24154bb10..ad4a611371a3 100644 --- a/components/omega/test/base/ReductionsTest.cpp +++ b/components/omega/test/base/ReductionsTest.cpp @@ -288,8 +288,8 @@ int main(int argc, char *argv[]) { // test MIN, MAX of arrays HostArray1DI4 HostA1DI4Work("HostA1DI4Work", NumCells * MySize); HostArray1DI4 HostA1DI4Min("HostA1DI4Min", NumCells * MySize); - for (i = 0; i < MySize; i++) { - for (j = 0; j < NumCells; j++) { + for (j = 0; j < NumCells; j++) { + for (i = 0; i < MySize; i++) { k = i * NumCells + j; if (MyTask == i) { HostA1DI4Work(k) = (i + 1) * k; // processor-specific work array