Skip to content

feat(gui): ion count and CPU time run limits in Run panel#13

Open
dhanavanthesh wants to merge 2 commits into
ir2-lab:mainfrom
dhanavanthesh:feat/ions-to-run-limit
Open

feat(gui): ion count and CPU time run limits in Run panel#13
dhanavanthesh wants to merge 2 commits into
ir2-lab:mainfrom
dhanavanthesh:feat/ions-to-run-limit

Conversation

@dhanavanthesh
Copy link
Copy Markdown
Contributor

The "Ions to run" spinbox maxes out at INT_MAX (~2.1B). Load a config with max_no_ions = 5000000000 and it silently stores garbage. Type mismatch between int setter and size_t storage.

The config has max_cpu_time and the engine uses it, but there's no GUI field. Users have to edit JSON by hand.

This PR lifts the ion ceiling to 2^53 and adds a "Max CPU time (s)" spinbox.


Changes

  • Replace QSpinBox to QDoubleSpinBox (range [1, 2^53])
  • Fix setMaxIons: int to quint64 with clamp at source
  • Route setOptions() through setMaxIons() so JSON load is also clamped
  • Define kMaxExactIons constant once, reference from both widget and driver
  • Add sbMaxTime spinbox (0 = "no limit", suffix "s", step 60s)
  • Wire max_cpu_time through all 6 paths in mcdriverobj.cpp
  • Disable both controls while sim running; re-enable on stop
  • Label as "Max CPU time (s)" engine uses CPU time, not wall time

Note: Ion count capped at 2^53. QDoubleSpinBox uses double internally, values above 2^53 lose integer precision. Full quint64 range needs a custom text input widget.


Tested

Ion count

Test Result
Fresh load shows 100
Load 5B ions in JSON displays 5000000000
Load 1e16 ions clamps to 9007199254740992
Type 2^53 + 1 clamps down to 2^53
Spinbox disabled while running, re-enables on stop
Revert on config load restores correct value

CPU time

Test Result
Fresh load shows "no limit"
Set 120 shows "120 s"
Set 0 shows "no limit"
Set 10s with 4 threads stops at 2.5s wall time
Set 10s with 1 thread stops at 10s wall time
Disabled while running, re-enables on stop
Save JSON writes Run.max_cpu_time correctly
Reload JSON restores Max CPU time correctly

Closes TODO: "set limit on ion histories or time to run"

Replace "Ions to run" spinbox from QSpinBox to QDoubleSpinBox.

- Lift limit from INT_MAX (2.1B) to 2^53 (9 quadrillion)
- Fix setMaxIons(int) to setMaxIons(quint64) with clamping
- JSON load routes through clamp (no silent truncation)
- Define kMaxExactIons constant, use in both driver and widget

Closes TODO: "set limit on ion histories or time to run" (ions half).
Time limit is a follow-up
                                                         - add sbMaxTime spinbox (0 = "no limit", suffix "s", step 60s)
- label as "Max CPU time (s)" engine uses CPU time, not wall time
- tooltip explains N-thread effect on wall time
- wire max_cpu_time_ through all 6 paths in mcdriverobj.cpp
- sim stops when either ion count or time limit is reached
                                                        Closes TODO: "set limit on ion histories or time to un"
@dhanavanthesh
Copy link
Copy Markdown
Contributor Author

@gapost ready for review. Check whenever you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant