-
Notifications
You must be signed in to change notification settings - Fork 345
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
Issue with refine_grid_layout #3459
Comments
Fix a corner case for AmrMesh::ChopGrids when there is only one cell in one dimension. Close #3459
Something is not right. The snippet I sent yesterday now doesn’t segfault, but it doesn’t increase the number of grids either – the size of the BoxArray is always 4 (see below). Besides, the original code I extracted the snippet from still segfaulsts. Could you advice, please?
Thanks,
Ted
***@***.***_grid_layout % mpiexec -np 4 ./ref_grid_layout
MPI initialized with 4 MPI processes
MPI initialized with thread support level 0
AMReX (23.07-53-gcf8d9f8e233b) initialized
(BoxArray maxbox(4)
m_ref->m_hash_sig(0)
((0,0,0) (7,7,0) (0,0,0)) ((8,0,0) (15,7,0) (0,0,0)) ((0,8,0) (7,15,0) (0,0,0)) ((8,8,0) (15,15,0) (0,0,0)) )
AMReX (23.07-53-gcf8d9f8e233b) finalized
***@***.***_grid_layout % mpiexec -np 8 ./ref_grid_layout
MPI initialized with 8 MPI processes
MPI initialized with thread support level 0
AMReX (23.07-53-gcf8d9f8e233b) initialized
(BoxArray maxbox(4)
m_ref->m_hash_sig(0)
((0,0,0) (7,7,0) (0,0,0)) ((8,0,0) (15,7,0) (0,0,0)) ((0,8,0) (7,15,0) (0,0,0)) ((8,8,0) (15,15,0) (0,0,0)) )
AMReX (23.07-53-gcf8d9f8e233b) finalized
From: Weiqun Zhang ***@***.***>
Date: Monday, July 31, 2023 at 9:55 AM
To: AMReX-Codes/amrex ***@***.***>
Cc: Sariyski, Tzvetan Emilov ***@***.***>, Author ***@***.***>
Subject: [EXTERNAL] Re: [AMReX-Codes/amrex] Issue with refine_grid_layout (Issue #3459)
Closed #3459<#3459> as completed via #3460<#3460>.
—
Reply to this email directly, view it on GitHub<#3459 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUR7V3OEXC5RMTVP7JNG2O3XS7IQDANCNFSM6AAAAAA25QG5C4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
It has a total of 16 x 16 x 1 cells and the blocking factor is 8 x 8 x 1. So the maximal number of boxes is 4. If you change the blocking factor to 4 x 4 x 1, you should be able to get 8 boxes.
We need more detail. |
My understanding is that if I start with four boxes and run the code on eight ranks, the number of boxes should be increased from 4 to something >= 8.
***@***.***_grid_layout % mpiexec -np 8 ./ref_grid_layout
should report a BoxArray with eight elements, but it reports the original four.
I guess I am missing something trivial.
Thanks,
Ted
From: Weiqun Zhang ***@***.***>
Date: Monday, July 31, 2023 at 11:48 AM
To: AMReX-Codes/amrex ***@***.***>
Cc: Sariyski, Tzvetan Emilov ***@***.***>, Author ***@***.***>
Subject: [EXTERNAL] Re: [AMReX-Codes/amrex] Issue with refine_grid_layout (Issue #3459)
Something is not right. The snippet I sent yesterday now doesn’t segfault, but it doesn’t increase the number of grids either – the size of the BoxArray is always 4 (see below).
It has a total of 16 x 16 x 1 cells and the blocking factor is 8 x 8 x 1. So the maximal number of boxes is 4. If you change the blocking factor to 4 x 4 x 1, you should be able to get 8 boxes.
Besides, the original code I extracted the snippet from still segfaulsts. Could you advice, please?
We need more detail.
—
Reply to this email directly, view it on GitHub<#3459 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUR7V3KA2V7FY2FGFNW6YDDXS7VV5ANCNFSM6AAAAAA25QG5C4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
It's constrained by the blocking factor, which is the minimal box size. |
I have it work in Debug mode, thanks for the explanation.
I still have issues with Release, which builds without warnings but produce very different levels of refinement. I attached the configuration file used to build AMReX (difference between release and debug is in 4th and 5th lines). If of interest, I could send the code (which I use to learn AMReX).
Thanks,
Ted
From: Weiqun Zhang ***@***.***>
Date: Monday, July 31, 2023 at 12:08 PM
To: AMReX-Codes/amrex ***@***.***>
Cc: Sariyski, Tzvetan Emilov ***@***.***>, Author ***@***.***>
Subject: [EXTERNAL] Re: [AMReX-Codes/amrex] Issue with refine_grid_layout (Issue #3459)
It's constrained by the blocking factor, which is the minimal box size.
—
Reply to this email directly, view it on GitHub<#3459 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AUR7V3LHY32BIMNIYO22RP3XS7YAVANCNFSM6AAAAAA25QG5C4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hi,
I have problem to make refine_grid_layout to work as expected. The attached snippets illustrate the issue.
I use MakeBaseGrids() to create a box array with four elements. When run on (up to) four ranks, it works as expected:
(BoxArray maxbox(4)
m_ref->m_hash_sig(0)
((0,0,0) (7,7,0) (0,0,0)) ((8,0,0) (15,7,0) (0,0,0)) ((0,8,0) (7,15,0) (0,0,0)) ((8,8,0) (15,15,0) (0,0,0)) )
When run on eight ranks it fails with:
Assertion `! boxes.empty()' failed, file "/Users/tsar/PROJECTS/amex/amrex/Src/Base/AMReX_DistributionMapping.cpp", line 1460 !!!
I also try refine_grid_layout_dim = IntVec{2,2,1} to no avil. I have no clue what I am doing wrong. Could you advice, please?
Thanks,
Ted
======= main.cpp ========
#include
#include "AMReX.H"
#include "AMReX_BLProfiler.H"
#include "AMReX_ParallelDescriptor.H"
#include "PPlane_.H"
using namespace amrex;
using std::endl;
int main(int argc, char *argv[])
{
amrex::Initialize(argc, argv);
AmrInfo st;
st.max_level = 0;
int nlevs = st.max_level + 1;
st.blocking_factor.resize(nlevs);
st.max_grid_size.resize(nlevs);
st.ref_ratio.resize(nlevs);
// st.verbose = 1;
st.max_grid_size[0] = IntVect{AMREX_D_DECL(8, 8, 1)};
st.blocking_factor[0] = IntVect{AMREX_D_DECL(8, 8, 1)};
st.ref_ratio[0] = IntVect{2, 2, 1};
st.refine_grid_layout = true;
IntVect lo(AMREX_D_DECL(0, 0, 0));
IntVect hi(AMREX_D_DECL(15, 15, 0));
IndexType typ({AMREX_D_DECL(1, 1, 1)});
Box dom(lo, hi);
double x_lo = -10, y_lo = -10, z_lo = -0.000001, x_hi = 10, y_hi = 10, z_hi = 0;
RealBox real_box({AMREX_D_DECL(Real(x_lo), Real(y_lo), Real(z_lo))},
{AMREX_D_DECL(Real(x_hi), Real(y_hi), Real(z_hi))});
amrex::Array<int, AMREX_SPACEDIM> is_per{AMREX_D_DECL(1, 1, 1)};
int coord = CoordSys::cartesian;
Geometry level_0_geom(dom, real_box, coord, is_per);
PPlane pp(level_0_geom, st);
amrex::Finalize();
}
==============
PPlane::PPlane(amrex::Geometry const &level_0_geom,
amrex::AmrInfo const &amr_info) : AmrCore(level_0_geom, amr_info)
{
Vector new_grids(max_level + 1);
new_grids[0] = grids[0];
finest_level = 0;
const BoxArray &ba = MakeBaseGrids();
SetBoxArray(0, ba);
DistributionMapping dm(ba);
SetDistributionMap(0, dm);
Print() << grids[0] << "\n";
}
The text was updated successfully, but these errors were encountered: