amrex icon indicating copy to clipboard operation
amrex copied to clipboard

`amrex::ParmParse::dumpTable` shows duplicate values

Open ax3l opened this issue 1 year ago • 4 comments

@JustinRayAngus discovered that since recently, the function amrex::ParmParse::dumpTable starts to plot values multiple times, likely because they were changed. The old values should not be shown.

Used in WarpX and ImpactX to plot the ultimately used inputs, e.g. here: https://github.com/ECP-WarpX/WarpX/blob/24.08/Source/ablastr/utils/UsedInputsFile.cpp

ax3l avatar Aug 16 '24 20:08 ax3l

The "issue" here is mainly a conscious choice of WarpX. WarpX processes many ParmParse parameters using Parser first and then explicitly uses add or addarr to add the post-processed values to ParmParse.

I tested with 24.07, which does not have the recent ParmParse changes. It has the same "issue". The only difference is in the old way the entries were not sorted so it was harder to notice.

WeiqunZhang avatar Aug 19 '24 03:08 WeiqunZhang

For example,

$ git grep -n "pp.*add" Source/
Source/Diagnostics/BTD_Plotfile_Header_Impl.H:263:    /** Append particle info of the newly added box, namely,
Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp:33:    pp_diag_name.add("openpmd_backend", openpmd_backend);
Source/Diagnostics/ReducedDiags/ParticleHistogram2D.cpp:68:    pp_rd_name.add("openpmd_backend", m_openpmd_backend);
Source/EmbeddedBoundary/WarpXInitEB.cpp:104:            pp_eb2.add("geom_type", geom_type); // use all_regular by default
Source/FieldSolver/FiniteDifferenceSolver/HybridPICSolveE.cpp:423:    // modified if such support wants to be added
Source/Initialization/WarpXAMReXInit.cpp:49:            pp_amr.add("blocking_factor", 1);
Source/Parallelization/WarpXComm.cpp:1051:    // overlapping points among boxes. Using the mask, we can add the
Source/Particles/PhysicalParticleContainer.cpp:392:    pp_species_name.queryarr("addIntegerAttributes", m_user_int_attribs);
Source/Particles/PhysicalParticleContainer.cpp:407:    pp_species_name.queryarr("addRealAttributes", m_user_real_attribs);
Source/Utils/WarpXUtil.cpp:55:        a_pp.addarr(input_str, input_array);
Source/Utils/WarpXUtil.cpp:93:    pp_geometry.addarr("prob_lo", prob_lo);
Source/Utils/WarpXUtil.cpp:94:    pp_geometry.addarr("prob_hi", prob_hi);
Source/Utils/WarpXUtil.cpp:222:    pp_geometry.addarr("prob_lo", prob_lo);
Source/Utils/WarpXUtil.cpp:223:    pp_geometry.addarr("prob_hi", prob_hi);
Source/Utils/WarpXUtil.cpp:225:      pp_warpx.addarr("fine_tag_lo", fine_tag_lo);
Source/Utils/WarpXUtil.cpp:226:      pp_warpx.addarr("fine_tag_hi", fine_tag_hi);
Source/Utils/WarpXUtil.cpp:229:    pp_slice.addarr("dom_lo",slice_lo);
Source/Utils/WarpXUtil.cpp:230:    pp_slice.addarr("dom_hi",slice_hi);
Source/Utils/WarpXUtil.cpp:311:        dims_error.append("inputs file does not declare 'geometry.dims'. Please add 'geometry.dims = ");
Source/Utils/WarpXUtil.cpp:362:    pp_amr.addarr("blocking_factor_x", blocking_factor_x);
Source/Utils/WarpXUtil.cpp:363:    pp_amr.addarr("max_grid_size_x", max_grid_size_x);
Source/Utils/WarpXUtil.cpp:386:    pp_amr.addarr("blocking_factor_y", bf);
Source/Utils/WarpXUtil.cpp:401:    pp_amr.addarr("max_grid_size_y", mg);
Source/Utils/WarpXUtil.cpp:498:    pp_geometry.addarr("is_periodic", geom_periodicity);
Source/WarpX.cpp:1037:            pp_vismf.add("usesingleread", use_single_read);
Source/WarpX.cpp:1038:            pp_vismf.add("usesinglewrite", use_single_write);
Source/WarpX.cpp:1045:            pp_particles.add("particles_nfiles", particle_io_nfiles);

WeiqunZhang avatar Aug 19 '24 03:08 WeiqunZhang

For example, with 24.07, max_grid_size appears twice at lines 2 and 126. So it's hard to notice.

$ grep -n "max_grid_size" warpx_used_inputs
2:amr.max_grid_size = 64
126:amr.max_grid_size = 64

With the current versions, it appears at lines 6 and 7.

$ grep -n "max_grid_size" warpx_used_inputs
6:amr.max_grid_size = 64
7:amr.max_grid_size = 64

WeiqunZhang avatar Aug 19 '24 04:08 WeiqunZhang

Haha, so the current version is actually stable/reproducible, showing the latest used value last.

Yes, adding an option to remove overwritten values would be a good idea to avoid confusion for codes that want this.

ax3l avatar Aug 21 '24 18:08 ax3l

Closing this issue due to lack of activity. Please re-open it if you feel there is is still an issue!

asalmgren avatar Jul 02 '25 18:07 asalmgren