You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@dwillcox and I have been working on the hands-on example for ATPESC when this issue cropped up. We have a PDE-constrained optimization problem (boundary control) with PETSc/TAO at the top driving the optimization and AMReX underneath doing the Poisson forward and adjoint solutions. Command line arguments we use for PETSc/TAO cause AMReX to crash on initialization because AMReX isn't just ignoring arguments it doesn't recognize. We've worked around the issue by hard-coding parameters we need for AMReX and initializing it without an inputs file so that PETSc/TAO is the only library that parses the arguments. However, in the long term interest of making AMReX play nicer with other libraries, Don and I thought it would be good to file an issue here.
The text was updated successfully, but these errors were encountered:
int main (int argc, char* argv[])
{
amrex::Initialize(argc, argv);
.....
and so the whole command line is passed to AMReX. In the case where we only want AMReX to read the first argument (typically the name of the inputs file) and ignore everything past that (so that, for example, we can pass those arguments to PETSc/TAO instead), we can intercept the argc argument as below:
int main (int argc, char* argv[])
{
int argc_to_initialize = 2;
amrex::Initialize(argc_to_initialize, argv);
.....
which tells the AMReX code to only read the first two arguments (the first one being the name of the executable). So, for example, if we had the command line as follows:
main2d*.exe inputs -tao_monitor
then AMReX will parse the inputs file but will ignore the "-tao_monitor"
@dwillcox and I have been working on the hands-on example for ATPESC when this issue cropped up. We have a PDE-constrained optimization problem (boundary control) with PETSc/TAO at the top driving the optimization and AMReX underneath doing the Poisson forward and adjoint solutions. Command line arguments we use for PETSc/TAO cause AMReX to crash on initialization because AMReX isn't just ignoring arguments it doesn't recognize. We've worked around the issue by hard-coding parameters we need for AMReX and initializing it without an inputs file so that PETSc/TAO is the only library that parses the arguments. However, in the long term interest of making AMReX play nicer with other libraries, Don and I thought it would be good to file an issue here.
The text was updated successfully, but these errors were encountered: