Skip to content
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

Fix issue with Database class #276

Merged
merged 5 commits into from
May 16, 2024
Merged

Fix issue with Database class #276

merged 5 commits into from
May 16, 2024

Conversation

ckendrick
Copy link
Collaborator

This adds a return statement to the base Database functions open() and create(). Without these, calls to endSamples() and writeSnapshot() would hang indefinitely printing newlines to screen.

This also adds a test to the CI that calls writeSnapshot() to catch this behavior in the future.

@ckendrick ckendrick added bug RFR Ready for review labels Mar 11, 2024
@dylan-copeland
Copy link
Collaborator

@ckendrick can you please provide an example test that demonstrates the issue?

@ckendrick
Copy link
Collaborator Author

@dylan-copeland this issue should occur if you run any example from the current upstream branch during the offline phase. This should happen to any code that calls endSamples() or writeSnapshot(). Some examples I tried were
dg_advection_global_rom -offline
poisson_global_rom -offline -f 1.0 -id 0

@@ -35,6 +35,7 @@ bool
Database::create(const std::string& file_name)
{
std::cout << "Creating file: " << file_name << std::endl;
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change is already made at #274 . I'm open to @dylan-copeland 's suggestion.

@chldkdtn
Copy link
Collaborator

@dylan-copeland would you review this PR again?

@chldkdtn
Copy link
Collaborator

chldkdtn commented May 2, 2024

@dreamer2368 do you approve this PR?

lib/utils/Database.cpp Outdated Show resolved Hide resolved
lib/utils/Database.cpp Outdated Show resolved Hide resolved
lib/utils/HDFDatabase.cpp Outdated Show resolved Hide resolved
lib/utils/HDFDatabase.cpp Outdated Show resolved Hide resolved
lib/utils/HDFDatabaseMPIO.cpp Outdated Show resolved Hide resolved
lib/utils/HDFDatabaseMPIO.cpp Outdated Show resolved Hide resolved
lib/utils/CSVDatabase.cpp Outdated Show resolved Hide resolved
@chldkdtn
Copy link
Collaborator

chldkdtn commented May 9, 2024

@dylan-copeland we need your review again on this PR.

@@ -144,5 +142,5 @@ main(

// Finalize MPI and return.
MPI_Finalize();
return !status;
return 0;
Copy link
Collaborator

@dylan-copeland dylan-copeland May 10, 2024

Choose a reason for hiding this comment

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

It looks like the goal of this test is just to run without failing? There is nothing checked, like in test_Matrix.cpp where EXPECT* functions are called. Is this the intention?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this test was added to the CI only intending to be a quick check if an error occurred with endSamples()/writeSnapshot(). The issue that caused this problem has since been fixed, but the only test I could find that uses these functions is in test_HDFDatabase.cpp which is restricted to parallel HDF5 builds only.
In the future, we should provide a serial test in test_HDFDatabase.cpp and remove this test (and other outdated/unused tests).

@ckendrick ckendrick merged commit d7b275e into master May 16, 2024
4 checks passed
@dylan-copeland dylan-copeland deleted the database_fix branch May 17, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug RFR Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants