-
Notifications
You must be signed in to change notification settings - Fork 196
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
CTest: split checksum analysis from test analysis, expose arguments #5456
base: development
Are you sure you want to change the base?
Conversation
e341b73
to
9df2a19
Compare
- split checksum analysis from test analysis - expose arguments to call evaluate_checksum - update and fix existing tests
9df2a19
to
1d25dab
Compare
|
||
# get checksum script and optional command-line arguments | ||
separate_arguments(CHECKSUM_LIST UNIX_COMMAND "${checksum}") | ||
list(GET CHECKSUM_LIST 0 CHECKSUM_FILE) |
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.
I'm thinking about ways to make this simpler. Instead of having a soft link each place where the default analysis script is used, can this check if CHECKSUM_FILE
is equal to analysis_default_regression.py
and put in the appropriate direct path? Perhaps use some keyword like "DEFAULT" instead of the script name?
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.
I guess that would be nice, but when Axel and I set up ctest in the first place we did not manage to make it work with the direct paths (there were several attempts and then we turned to soft links). Especially, I think Axel found issues with running ctest from within an IDE. We could rivisit once he is back, but I would not try this here.
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.
Thinking further, instead of writing out the full command to do the benchmark check, could the arguments to the analysis script be added as arguments to this function? In most cases, default values could be used so most CMakeLists.txt
files wouldn't need any extra arguments (especially with the automatic discovery I suggest above). Then the rtol
and skip-fields
and skip-particles
could be added via variable arguments pairs, like this
rtol 1.e-5
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.
I think this was another design choice that we made with Axel initially.
We wanted to keep the number of arguments of add_warpx_test
as little as possible, especially given that we cannot use keywords like in Python (e.g., add_warpx_test(..., rtol=1e-6, ...)
).
Another issue I see is that we would be treating the arguments to the custom analysis script (which cannot be predicted in advance) differently than the arguments to the default analysis script. It might be confusing to see a rtol
argument and not know for sure whether it refers to the custom analysis script or to the default one, given that the interface of the custom analysis script is up to the developer who added it.
If you feel strongly about this, I would recommend that we wait until Axel is back and discuss with him further.
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.
Another comment is that we wanted to display commands that developers could copy/paste to try things locally, whenever that is needed (e.g., for debugging purposes). This came out of discussions with @aeriforme, and I think it would be valuable in general, as opposed to passing arguments to add_warpx_test
when they are actually arguments read/used by the analysis scripts.
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.
I don't feel strongly about this, just brain storming ideas. I see that having the command to do the benchmark check written out is convenient for debugging.
BTW, you can imitate keyword arguments though it's a bit kludgy. You can use variable arguments and scan through them. If one has a value of the argument name, then take the next argument as the value.
[--skip-particles] | ||
options: | ||
-h, --help show this help message and exit | ||
--path PATH path to output file(s) |
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.
Can automatic discovery be used here instead of relying on the arguments? The checksum script could determine whether the output is a plotfile or openpmd. Also, the checksum would presumably always be done on the last diagnostic file and this could be automatically found. Then the path here would only be the top level diag directory.
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.
Yes, automating some of this was something I was hoping to do as well. Would you have a suggestion on how to automatically distinguish between plotfile and openpmd output?
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.
One way would be to check for the Header
file which would signify a plotfile diagnostic.
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.
I pushed something to see if this works:
# set args.format automatically
try:
yt.load(args.path)
except Exception:
try:
OpenPMDTimeSeries(args.path)
except Exception:
print("Could not open the file as a plotfile or an openPMD time series")
else:
args.format = "openpmd"
else:
args.format = "plotfile"
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.
This looks good.
1d1deba
to
1da2140
Compare
Hi Dave, as you saw I updated the default analysis script to detect the output file format automatically as you suggested. Personally I would postpone further automation and/or interface changes to follow-up work, due to the comments following #5456 (comment). Please feel free to leave another review. |
Thanks to @dpgrote's comments, we made this even easier to use, with automatic detection of the output file format, which does not have to be passed as command line argument anymore. See updated PR description for the latest usage. |
I added you as reviewers to this PR as well, since this is now at a mature stage and could be approved and merged soon. Please feel free to have a look, especially at the proposed feature rather then the individual code changes, and provide feedback, if any. |
This comment was marked as resolved.
This comment was marked as resolved.
I see that it's possible to turn off the analysis with the What would happen if one used |
I think the behavior is the same as for the analysis script (i.e., it's skipped). I agree that it should be documented, I will update the documentation asap. I think it's a good idea to throw an error if the checksum analysis is skipped. I just have to double check that this is fine for all existing tests, but I guess it is. |
Regarding this,
I think we cannot throw an error when the checksum command is set to OFF because we use that feature specifically for tests that need a preparatory step, such as the LASY tests ("output" here is "checksum" in this PR): WarpX/Examples/Tests/laser_injection_from_file/CMakeLists.txt Lines 64 to 82 in 2cdcb77
We did not manage to merge the preparatory step and the actual test into one single test when we set up ctest initially, I can't remember why but we ended up with this solution after trying to fix the LASY tests for a while, so I would not change this now. |
Regarding this,
I updated the documentation in 874d362. |
After discussing with @aeriforme, we added the particle data to the checksums of two RZ scraping tests (not clear why the particle data had been skipped when those tests were added in the first place). To be double checked in the future if the first two values will raise issues due to the small order of magnitude:
|
Prototype of implementation to see if this can achieve goals such as:
This PR replaces #5447, see #5447 (comment).
Old usage
New usage
ln -s ../../analysis_default_regression.py analysis_default_regression.py
Notes
To-do
Follow-up
checksumAPI
or are some obsolete?git grep "# checksum" Examples/ | grep "rtol"
)