Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace Managed vectors with Async arrays in MaestroSlopes.cpp #404

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions Source/MaestroSlopes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ void Maestro::Slopex(const Box& bx, Array4<Real> const s,
int ihi = domainBox.hiVect()[0];

// create lo and hi vectors
IntVector bclo(ncomp);
IntVector bchi(ncomp);
Vector<int> bclo_v(ncomp);
Vector<int> 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<int> bclo(bclo_v.data(), bclo_v.size());
AsyncArray<int> 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
Expand Down Expand Up @@ -214,15 +216,17 @@ void Maestro::Slopey(const Box& bx, Array4<Real> const s,
int jhi = domainBox.hiVect()[1];

// create lo and hi vectors
IntVector bclo(ncomp);
IntVector bchi(ncomp);
Vector<int> bclo_v(ncomp);
Vector<int> 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];
zingale marked this conversation as resolved.
Show resolved Hide resolved
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<int> bclo(bclo_v.data(), bclo_v.size());
AsyncArray<int> 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
Expand Down Expand Up @@ -410,15 +414,17 @@ void Maestro::Slopez(const Box& bx, Array4<Real> const s,
int khi = domainBox.hiVect()[2];

// create lo and hi vectors
IntVector bclo(ncomp);
IntVector bchi(ncomp);
Vector<int> bclo_v(ncomp);
Vector<int> 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];
zingale marked this conversation as resolved.
Show resolved Hide resolved
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<int> bclo(bclo_v.data(), bclo_v.size());
AsyncArray<int> 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
Expand Down
Loading