From cea341f3648f0eb7082a9231d089b160aa4ae3e7 Mon Sep 17 00:00:00 2001 From: biboyd Date: Tue, 12 Dec 2023 19:39:29 -0500 Subject: [PATCH 1/2] replace Managed vectors with Async arrays --- Source/MaestroSlopes.cpp | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Source/MaestroSlopes.cpp b/Source/MaestroSlopes.cpp index 7f30687c0..bbe745a5f 100644 --- a/Source/MaestroSlopes.cpp +++ b/Source/MaestroSlopes.cpp @@ -17,15 +17,17 @@ void Maestro::Slopex(const Box& bx, Array4 const s, int ihi = domainBox.hiVect()[0]; // create lo and hi vectors - IntVector bclo(ncomp); - IntVector bchi(ncomp); + Vector bclo_v(ncomp); + Vector bchi_v(ncomp); for (int i = 0; i < ncomp; ++i) { - bclo[i] = bcs[bc_start_comp + i].lo()[0]; - bchi[i] = bcs[bc_start_comp + i].hi()[0]; + bclo_v[i] = bcs[bc_start_comp + i].lo()[0]; + bchi_v[i] = bcs[bc_start_comp + i].hi()[0]; } - int* AMREX_RESTRICT bclo_p = bclo.dataPtr(); - int* AMREX_RESTRICT bchi_p = bchi.dataPtr(); + AsyncArray bclo(bclo_v.data(), bclo_v.size()); + AsyncArray bchi(bchi_v.data(), bchi_v.size()); + int* AMREX_RESTRICT bclo_p = bclo.data(); + int* AMREX_RESTRICT bchi_p = bchi.data(); if (slope_order == 0) { // 1st order @@ -214,15 +216,17 @@ void Maestro::Slopey(const Box& bx, Array4 const s, int jhi = domainBox.hiVect()[1]; // create lo and hi vectors - IntVector bclo(ncomp); - IntVector bchi(ncomp); + Vector bclo_v(ncomp); + Vector bchi_v(ncomp); for (int i = 0; i < ncomp; ++i) { - bclo[i] = bcs[bc_start_comp + i].lo()[1]; - bchi[i] = bcs[bc_start_comp + i].hi()[1]; + bclo_v[i] = bcs[bc_start_comp + i].lo()[0]; + bchi_v[i] = bcs[bc_start_comp + i].hi()[0]; } - int* AMREX_RESTRICT bclo_p = bclo.dataPtr(); - int* AMREX_RESTRICT bchi_p = bchi.dataPtr(); + AsyncArray bclo(bclo_v.data(), bclo_v.size()); + AsyncArray bchi(bchi_v.data(), bchi_v.size()); + int* AMREX_RESTRICT bclo_p = bclo.data(); + int* AMREX_RESTRICT bchi_p = bchi.data(); if (slope_order == 0) { // 1st order @@ -410,15 +414,17 @@ void Maestro::Slopez(const Box& bx, Array4 const s, int khi = domainBox.hiVect()[2]; // create lo and hi vectors - IntVector bclo(ncomp); - IntVector bchi(ncomp); + Vector bclo_v(ncomp); + Vector bchi_v(ncomp); for (int i = 0; i < ncomp; ++i) { - bclo[i] = bcs[bc_start_comp + i].lo()[2]; - bchi[i] = bcs[bc_start_comp + i].hi()[2]; + bclo_v[i] = bcs[bc_start_comp + i].lo()[0]; + bchi_v[i] = bcs[bc_start_comp + i].hi()[0]; } - int* AMREX_RESTRICT bclo_p = bclo.dataPtr(); - int* AMREX_RESTRICT bchi_p = bchi.dataPtr(); + AsyncArray bclo(bclo_v.data(), bclo_v.size()); + AsyncArray bchi(bchi_v.data(), bchi_v.size()); + int* AMREX_RESTRICT bclo_p = bclo.data(); + int* AMREX_RESTRICT bchi_p = bchi.data(); if (slope_order == 0) { // 1st order From ad6d3f7471aa8a36107cc1ad827f761dba66b7e7 Mon Sep 17 00:00:00 2001 From: biboyd Date: Thu, 11 Apr 2024 14:15:28 -0400 Subject: [PATCH 2/2] fix index type --- Source/MaestroSlopes.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/MaestroSlopes.cpp b/Source/MaestroSlopes.cpp index 02be36c11..7674ec53e 100644 --- a/Source/MaestroSlopes.cpp +++ b/Source/MaestroSlopes.cpp @@ -219,8 +219,8 @@ void Maestro::Slopey(const Box& bx, Array4 const s, Vector bclo_v(ncomp); Vector bchi_v(ncomp); for (int i = 0; i < ncomp; ++i) { - bclo_v[i] = bcs[bc_start_comp + i].lo()[0]; - bchi_v[i] = bcs[bc_start_comp + i].hi()[0]; + bclo_v[i] = bcs[bc_start_comp + i].lo()[1]; + bchi_v[i] = bcs[bc_start_comp + i].hi()[1]; } AsyncArray bclo(bclo_v.data(), bclo_v.size()); @@ -417,8 +417,8 @@ void Maestro::Slopez(const Box& bx, Array4 const s, Vector bclo_v(ncomp); Vector bchi_v(ncomp); for (int i = 0; i < ncomp; ++i) { - bclo_v[i] = bcs[bc_start_comp + i].lo()[0]; - bchi_v[i] = bcs[bc_start_comp + i].hi()[0]; + bclo_v[i] = bcs[bc_start_comp + i].lo()[2]; + bchi_v[i] = bcs[bc_start_comp + i].hi()[2]; } AsyncArray bclo(bclo_v.data(), bclo_v.size());