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

Remove solver_.parameters_ #668

Merged
merged 55 commits into from
Jan 14, 2025
Merged

Remove solver_.parameters_ #668

merged 55 commits into from
Jan 14, 2025

Conversation

montythind
Copy link
Contributor

@montythind montythind commented Sep 24, 2024

This PR includes moving Parameters
absolute tolerance and relative tolearnce to state from solver

Note:
I have left
std::vector absolute_tolerance_;
double relative_tolerance_{ 1e-6 };

in rosenbrock_solver_prarameter.hpp as the CUDA tests are failing because tolerance doesnt get copied over to the device. Issue occurs in CudaRosenbrockSolver constructor when doing this->parameters_.absolute_tolerance_.size(); it comes out as zero

We can potential get rid of this line in solver_builder.inl. This is also a temporary. solution.
options.absolute_tolerance_ = state_parameters.absolute_tolerance_;

Along with that i have commented out unit tests till we don't have a solution how to deal with tolerance.

closes #621

@montythind
Copy link
Contributor Author

I do see some calls where solver.solver_.parameters_ is not being modifiedbut rather the value is getting used. Example:

EXPECT_EQ(solver.solver_.parameters_.absolute_tolerance_[state.variable_map_["Ar"]], 1.0e-12);
std::vector atol = gpu_solver.solver_.parameters_.absolute_tolerance_;

I am unsure if we need to change these as well?

@K20shores @mattldawson

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.38%. Comparing base (faf21bd) to head (757e613).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #668      +/-   ##
==========================================
+ Coverage   94.09%   94.38%   +0.29%     
==========================================
  Files          63       63              
  Lines        4281     4294      +13     
==========================================
+ Hits         4028     4053      +25     
+ Misses        253      241      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@K20shores K20shores left a comment

Choose a reason for hiding this comment

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

Right direction, but we still have some more work to do. Any mechanism-specific thing (like tolerances) need to be moved somewhere else. We should spend some time figuring out where they need to go. Also, the parameters need to be any set of paramters (rosenbrock, backward euler, etc.)

include/micm/solver/solver.hpp Outdated Show resolved Hide resolved
@montythind montythind force-pushed the allowSolversToModify_621 branch from d059401 to 32a16e2 Compare October 1, 2024 21:07
@montythind montythind changed the title Draft PR: Remove solver_.parameters_ Remove solver_.parameters_ Oct 16, 2024
@montythind montythind requested a review from K20shores October 16, 2024 20:28
Copy link
Collaborator

@sjsprecious sjsprecious left a comment

Choose a reason for hiding this comment

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

Thanks @montythind for working on this PR. I observed the following failures on Derecho:

         15 - cuda_rosenbrock (SEGFAULT)
         31 - rosenbrock (SEGFAULT)
         45 - regression_test_solve (NUMERICAL)
         46 - chapman_integration (SEGFAULT)
         47 - analytical_rosenbrock_integration (NUMERICAL)
         48 - analytical_backward_euler (NUMERICAL)
         49 - terminator (NUMERICAL)
         50 - integrated_reaction_rates (NUMERICAL)
         52 - README_example (NUMERICAL)
         53 - solve_results (NUMERICAL)
         54 - multiple_grid_cells (NUMERICAL)
         55 - rate_constants_no_user_defined_example_by_hand (NUMERICAL)
         56 - rate_constants_user_defined_example_by_hand (NUMERICAL)
         57 - solver_configuration (NUMERICAL)
         59 - rate_constants_no_user_defined_example_with_config (NUMERICAL)
         60 - rate_constants_user_defined_example_with_config (NUMERICAL)
         61 - carbon_bond_5_example (NUMERICAL)
         62 - chapman_example (NUMERICAL)
         63 - robertson_example (NUMERICAL)
         64 - ts1_example (NUMERICAL)

include/micm/solver/rosenbrock_solver_parameters.hpp Outdated Show resolved Hide resolved
@montythind
Copy link
Contributor Author

I am not sure what happened but after my latest pull and merge- lot of tests failed. I am looking what caused the test failures

@K20shores K20shores requested a review from sjsprecious January 9, 2025 20:51
Copy link
Collaborator

@sjsprecious sjsprecious left a comment

Choose a reason for hiding this comment

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

Thanks @K20shores and @montythind for working on this and addressing all my comments. It looks great to me and I could confirm that all the CPU & GPU tests pass on Derecho.

Copy link
Collaborator

@mattldawson mattldawson left a comment

Choose a reason for hiding this comment

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

Looks great! Just one minor question, but nothing that should hold up merging

include/micm/solver/solver.hpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@boulderdaze boulderdaze left a comment

Choose a reason for hiding this comment

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

Looks good! I just have a couple questions and suggestions.

include/micm/configure/solver_config.hpp Outdated Show resolved Hide resolved
include/micm/configure/solver_config.hpp Outdated Show resolved Hide resolved
include/micm/solver/solver.hpp Outdated Show resolved Hide resolved
include/micm/solver/solver_builder.inl Outdated Show resolved Hide resolved
@K20shores K20shores requested a review from boulderdaze January 14, 2025 15:14
@K20shores K20shores merged commit 71302b7 into main Jan 14, 2025
28 checks passed
@K20shores K20shores deleted the allowSolversToModify_621 branch January 14, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants