-
Notifications
You must be signed in to change notification settings - Fork 20
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
pytest: Temporary Working Directory #424
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ax3l
added
component: third party
Changes in ImpactX that reflect a change in a third-party library
workaround
component: tests
examples, tests and benchmarks
labels
Aug 28, 2023
Simetimes our tests are so quick that they finish below 1second. That does not work with `UniqueStrings` in AMReX' `UtilCreateCleanDirectory`, which can only do one name per second: https://github.com/AMReX-Codes/amrex/blob/23.08/Src/Base/AMReX_Utility.cpp#L186-L199 If the target exist, the behavior of `std::rename` is implementation dependent. We see crashes of this on macOS. https://en.cppreference.com/w/cpp/io/c/rename
Update: the names are odd
this does not seem right |
Avoid clean-up needs by using a cwd that is unique per test.
5 tasks
ax3l
added
bug
Something isn't working
bug: affects latest release
Bug also exists in latest release version
labels
Aug 28, 2023
ax3l
pushed a commit
to AMReX-Codes/amrex
that referenced
this pull request
Aug 28, 2023
# Summary Previously UniqueString used MPI_Wtime, which could have a very low resolution (1e-5s) on some machines. In this PR, we switch to use amrex::second(), which uses the highest resolution steady clock (usually 1.e-9s). We have also changed a hardwired number according to resolution of the clock so that the digits are not wasted on trailing zeros. ## Additional background ECP-WarpX/impactx#424 ## Checklist The proposed changes: - [x] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
ax3l
commented
Aug 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug: affects latest release
Bug also exists in latest release version
bug
Something isn't working
component: tests
examples, tests and benchmarks
component: third party
Changes in ImpactX that reflect a change in a third-party library
workaround
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests can generate temporary output and directories, which might clash and/or need cleaning between tests.
This changes the current working directory to a unique directory per test.
Seen as:
AMReX counts seconds passed (and factions thereof) since initialization. For subsequent tests, this can collide.
Also, the
UniqueStrings
in AMReX'UtilCreateCleanDirectory
is pretty coarse in MPI contexts:https://github.com/AMReX-Codes/amrex/blob/23.08/Src/Base/AMReX_Utility.cpp#L186-L199
If the target exist, the behavior of
std::rename
is implementation dependent. We see crashes of this on macOS.https://en.cppreference.com/w/cpp/io/c/rename