-
Notifications
You must be signed in to change notification settings - Fork 172
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
[WIP] EBs: Compiled by Default, Controlled at Runtime #4865
base: development
Are you sure you want to change the base?
Conversation
64f9e2b
to
9aaa9e6
Compare
9aaa9e6
to
e783f39
Compare
This is a good thing to do. Though, is a separate input flag needed? The code can check if |
Thanks, Dave! I was wondering as well, but in the end we have at least three ways to turn it on:
We could a) fix the lack of docs and b) write a helper function that checks them or so? Open to suggestions cc @RemiLehe @roelof-groenewald |
The |
amrex::Array4<amrex::Real> lr, lt, lz; | ||
|
||
if (eb_enabled) { | ||
lr = edge_lengths[0]->array(mfi); | ||
lt = edge_lengths[1]->array(mfi); | ||
lz = edge_lengths[2]->array(mfi); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we can always have a well defined EBFactory which just doesn't cover any of the domain when it is not wanted. Then the edge_lengths
and similar multifabs could be properly defined in all cases and we wouldn't have to have the if (eb_enabled)
block. Similarly lime 131 below could simply be:
if (lr(i, j, 0) <= 0) return;
and the same for all the other similar occurrences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would waste memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we would implement an Array4
variant that returns 0 outside of the covered domain, which we could use elsewhere as well (e.g. #4807). But that then probably leads to register bloat (unless we implement as in mdspan
a variant that have optionally known compile-time sizes).
A separate bool ParmParse parameter is not needed unless we want to the one flag to rule them all. If we want a bool variable to be used in the code for convenience, we can add a variable to WarpX class. EB is initialized in WarpX::InitEB. There we can set it to true or false. There are basically two ways to enable EB in WarpXInitEB, (1) |
Thank you for all the ideas!
In ImpactX and also more in WarpX, I try to avoid using global variables in the central sim class and instead use globals from the ParmParser. That way, we do not need to keep them in sync when changing options at runtime (e.g., from Python) and do not need to include a heavy central class everywhere. I would for now write a free standing helper function instead that we can use :) |
Maybe a free function in WarpX like this
|
Note that amrex::IndexSpace has a static member, a vector of amrex::IndexSpace. Somehow this comes into my mind by your mention of global variable. https://en.wiktionary.org/wiki/%E6%88%91%E4%B8%8D%E5%85%A5%E5%9C%B0%E7%8D%84%EF%BC%8C%E8%AA%B0%E5%85%A5%E5%9C%B0%E7%8D%84 |
Note that |
6475eac
to
7031a74
Compare
a974c06
to
24e0c90
Compare
16474c7
to
7e86c97
Compare
7e86c97
to
5065ea8
Compare
5065ea8
to
1879a88
Compare
Enable embedded boundary compilation by default.
Control via runtime option (default: off).
Close #4863
Action Items