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

✨ Added timeout for QuickSim #654

Open
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

Drewniok
Copy link
Collaborator

@Drewniok Drewniok commented Feb 1, 2025

Description

This PR adds the option to set a timeout in QuickSim to avoid endless simulations.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have added a changelog entry.
  • I have created/adjusted the Python bindings for any new or updated functionality.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@Drewniok Drewniok added the enhancement New feature or request label Feb 1, 2025
@Drewniok Drewniok self-assigned this Feb 1, 2025
@Drewniok Drewniok changed the title ✨ Added timout for _QuickSim_ ✨ Added timout for QuickSim Feb 1, 2025
@Drewniok Drewniok changed the title ✨ Added timout for QuickSim ✨ Added timout for *QuickSim* Feb 1, 2025
@Drewniok Drewniok changed the title ✨ Added timout for *QuickSim* ✨ Added timout for `QuickSim Feb 1, 2025
@Drewniok Drewniok changed the title ✨ Added timout for `QuickSim ✨ Added timout for QuickSim Feb 1, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.40%. Comparing base (8fbcd0e) to head (afe1338).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #654      +/-   ##
==========================================
- Coverage   98.41%   98.40%   -0.01%     
==========================================
  Files         252      252              
  Lines       40856    40880      +24     
  Branches     1863     1865       +2     
==========================================
+ Hits        40207    40228      +21     
- Misses        649      652       +3     
Files with missing lines Coverage Δ
...de/fiction/algorithms/simulation/sidb/quicksim.hpp 98.85% <100.00%> (+0.18%) ⬆️
...orithms/simulation/sidb/sidb_simulation_result.hpp 100.00% <ø> (ø)
...fiction/technology/charge_distribution_surface.hpp 99.84% <100.00%> (-0.01%) ⬇️
test/algorithms/simulation/sidb/quicksim.cpp 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8fbcd0e...afe1338. Read the comment docs.

@Drewniok Drewniok requested a review from marcelwa February 3, 2025 07:33
@wlambooy wlambooy changed the title ✨ Added timout for QuickSim ✨ Added timeout for QuickSim Feb 3, 2025
// measure run time (artificial scope)
// main loop
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment (// main loop) seems to be misplaced

Comment on lines +47 to +50
/**
* Timeout limit (in ms).
*/
uint64_t timeout = std::numeric_limits<uint64_t>::max();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe, we usually specify our timeouts in seconds. Please check exact and gold to be sure.

Comment on lines +88 to +92
if (ps.timeout == 0)
{
st.additional_simulation_parameters.emplace("timeout_reached", true);
return st;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it really a simulation parameter that the timeout has been reached? In exact, we throw an exception in the _impl class that we then catch in the calling function exact and return an std::nullopt. I'm not 100% sure how gold handles this. You might wanna check.

mockturtle::stopwatch<>::duration time_counter{};

// Track the start time for timeout
auto start_time = std::chrono::high_resolution_clock::now();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be const

Comment on lines +238 to +241
if (timeout_limit_reached)
{
st.additional_simulation_parameters.emplace("timeout_reached", true);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants