Skip to content

Conversation

@ax3l
Copy link
Member

@ax3l ax3l commented Oct 7, 2021

100k+ step runs are quite common in WarpX. To simplify post-processing scripts, increase the default to pad to 6 digits.

This might break some hand-written scripts that use ????? wild-cards over * wildcards in regex and thus need to be updated. But it at the same time simplifies regexes for analysis of data series and listing of such file series.

Notes:

@ax3l ax3l added the component: diagnostics all types of outputs label Oct 7, 2021
@ax3l ax3l requested review from WeiqunZhang and dpgrote October 7, 2021 00:30
@ax3l
Copy link
Member Author

ax3l commented Oct 7, 2021

Found a couple of scripts that need updates:

Regression/Checksum/checksumAPI.py
83:    plotfile_list = glob.glob(path_to_all_plotfiles + '*_plt?????',

Docs/source/developers/checksum.rst
26:This can also be included in an existing analysis script. Note that the plotfile must be ``<test name>_plt?????``, as is generated by the CI framework.

Docs/source/dataanalysis/plot_parallel.rst
27:will loop through plotfiles named ``plt?????`` (e.g., ``plt00000``, ``plt00100`` etc.)

Examples/Tests/collision/analysis_collision_3d.py
55:fn_list = glob(last_fn[:-5] + "?????")

Examples/Tests/collision/analysis_collision_2d.py
55:fn_list = glob(last_fn[:-5] + "?????")

Tools/DevUtils/compare_wx_w_3d.ipynb
57:    "file_list_warpx = glob.glob(path_warpx + 'plt?????')\n",
71:    "file_list_warp = glob.glob(path_warp + 'diags/hdf5/data????????.h5')\n",

Tools/PostProcessing/video_yt.py
36:file_list = glob.glob('./diags/plotfiles/plt?????')

Tools/PostProcessing/plot_parallel.py
47:                    help='path to plotfiles, defaults to diags/plotfiles. Plotfiles names must be plt?????')
236:file_list = glob.glob(os.path.join(path, 'plt?????'))

Tools/PostProcessing/yt3d_mpi.py
39:file_list = glob.glob('plotfiles/plt?????')

Tools/PostProcessing/plot_nci_growth_rate.ipynb
58:    "file_list_warpx = glob.glob(path_wx + 'diag1?????')\n",

Tools/PostProcessing/plot_particle_path.py
131:    fn_list = glob.glob("plt?????")

Tools/LibEnsemble/read_sim_output.py
87:    file_list = glob.glob('diags/plotfiles/plt?????')

@ax3l ax3l added the help wanted Extra attention is needed label Oct 7, 2021
@ax3l
Copy link
Member Author

ax3l commented Oct 7, 2021

The replacement for glob can potentially be as easy as this:

glob('./diags/plotfiles/plt[0-9]+')

Simple regex that is matching trailing digits if we introduce _ in plotfiles: .*_(\d+)$

@EZoni
Copy link
Member

EZoni commented Oct 7, 2021

To fix the tests uniform_plasma_restart, restart, restart_psatd and restart_psatd_time_avg, we will need to change 5 to 6 in the following line of the Python file regtest.py within the regression_testing repository (https://github.com/ECP-WarpX/regression_testing/blob/9aab727cd00dc4527ff2cc6fdd5772c9ebb9ffab/regtest.py#L736-L737):

--- a/regtest.py
+++ b/regtest.py
@@ -734,7 +734,7 @@ def test_suite(argv):
                 shutil.move(test.diffDir, orig_diff_dir)
 
             # get the file number to restart from
-            restart_file = "%s_chk%5.5d" % (test.name, test.restartFileNum)
+            restart_file = "%s_chk%6.6d" % (test.name, test.restartFileNum)

@ax3l
Copy link
Member Author

ax3l commented Oct 15, 2021

regression_testing

I for now just overwrote the 4 checkpoint-restart tests we have to use 5 digits.

Copy link
Member

@dpgrote dpgrote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch 2 times, most recently from 3bc0ae5 to 4146970 Compare October 22, 2021 00:00
@ax3l ax3l changed the title file_min_digits: 5->6 [WIP] file_min_digits: 5->6 Nov 9, 2021
This was referenced Nov 19, 2021
@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch from 4146970 to 8848601 Compare December 17, 2021 03:12
@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch from 2895661 to 41f9840 Compare March 2, 2022 17:35
@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch 3 times, most recently from 6fd31af to f33647f Compare March 2, 2022 21:56
@ax3l ax3l mentioned this pull request Mar 3, 2022
@ax3l ax3l changed the title [WIP] file_min_digits: 5->6 file_min_digits: 5->6 Mar 3, 2022
ax3l and others added 13 commits March 3, 2022 08:54
100k+ step runs are quite common in WarpX. To simplify
post-processing scripts, increase the default to pad to 6 digits.

This might break some hand-written scripts that use `?????`
wild-cards over `*` wildcards in regex and thus need to be updated.
But it at the same time simplifies regexes for analysis of data
series and listing of such file series.
`regtest.py` in `regression_testing` hard-codes 5 digits:
```diff
--- a/regtest.py
+++ b/regtest.py
@@ -734,7 +734,7 @@ def test_suite(argv):
                 shutil.move(test.diffDir, orig_diff_dir)

             # get the file number to restart from
-            restart_file = "%s_chk%5.5d" % (test.name, test.restartFileNum)
+            restart_file = "%s_chk%6.6d" % (test.name, test.restartFileNum)
```
@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch 5 times, most recently from 8479f0e to abe3c45 Compare March 3, 2022 17:27
Same as other CI restart tests: hard-coded value in regression
suite makes this necessary.

X-ref: AMReX-Codes/regression_testing#119
@ax3l ax3l force-pushed the topic-fileMinPrefix6 branch from abe3c45 to 8b35a0e Compare March 3, 2022 17:39
Copy link
Member

@EZoni EZoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looks great to me!

@RemiLehe RemiLehe merged commit 795c872 into BLAST-WarpX:development Mar 3, 2022
@ax3l ax3l deleted the topic-fileMinPrefix6 branch March 3, 2022 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: diagnostics all types of outputs help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants