Repository navigation
world_clock: one clock for every simulation (lockstep/batch, followers, state-tree binding, sim_thread on the clock) - #629
Merged
Conversation
…followers, state-tree binding
…binding keep-alive survives the overload merge; include order
This was referenced Oct 14, 2026
transfix
added a commit
to cy-pca/cvcpkg
that referenced
this pull request
Oct 14, 2026
clang-format had only linux and macos columns, so Windows hosts had no clang-format 18 to match CI format gates. libcvc's CI pins 18. Visual Studio ships 19.x, whose output differs. - build.ps1 (new) mirrors build.sh with MSVC + Ninja: only the clang-format target, static LLVM and clang libraries, and a static CRT (CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded, the counterpart of -static-libstdc++), with LLVM_ENABLE_DIA_SDK=OFF as in llvm18. It runs the same smoke test: version 18.x, plus formatting a snippet, tolerating CRLF. - package.files: bin/clang-format scoped to linux/macos, bin/clang-format.exe on windows; the two helper scripts are shared. A note covers running git-clang-format through an interpreter on Windows. - Same revision. No windows bundle existed at any revision, and linux/macos do not change, so populate builds only the missing windows variant. Verified locally on Windows (install-deps + pack --strict-globs, as windows-build.yml runs them): - packed clang-format-18.1.8+cvc.1-windows-x86_64-release-shared.zip (1.5 MB); - clang-format.exe imports only KERNEL32 and ADVAPI32; - `git-clang-format --diff` with it reports a real change set (transfix/libcvc#629) clean.
transfix
added a commit
to CVC-Lab/GRL-SNAM
that referenced
this pull request
Oct 15, 2026
…ch, followers) (#116) * clock: parity with cvc::world_clock's shared-clock API Brings grl_snam.clock.WorldClock to parity with libcvc's one-clock-for-every-simulation work (transfix/libcvc#629): - lockstep mode; - advance_ticks (batch); - configure; - StepResult.first_tick; - realized_scale; - cap_scales_with_rate. Adds ticks_per_step, steps_due and ClockFollower (take/due_at/alpha), so a Python simulation follows a shared clock at its own whole-quantum period, as a C++ one does. All additions keep the existing API and behaviour. tests/test_clock.py mirrors the C++ cases (pacing invariance included) and checks tick-for-tick parity with pycvc.world_clock where pycvc is installed. 32 tests pass locally (Windows, cvcpkg python311 + torch-cp311, pycvc built from libcvc#629), along with the existing WorldClock tests in test_fog_demo.py. * tests/test_clock.py: black
transfix
added a commit
that referenced
this pull request
Oct 17, 2026
Minor release. It carries: - the world clock: lockstep and batch, followers, the sim.* binding, and nav on the clock (#629, #630, #631, #640); - the units registry with SI <-> normalized-frame conversions (#632); - cvc::physics with the Jolt backend (#641); - the material trainer on the kinematic bicycle and its pycvc bindings (#642). Bumps project(VERSION) 3.5.1 -> 3.6.0 and every cvcpkg recipe's upstream_version to match. cvc_revision stays 1, per the recipe-version gate.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
One
cvc::world_clockmechanism for every simulation: one driver advances the clock, every simulation follows it at its own whole-quantum period, and speed, pause, mode and single-step live on the state tree. This is the first step ofdocs/roadmap/WORLD-CLOCK-SYNC-ROADMAP.md, which migrates every demo and simulation loop onto the clock. It is also the prerequisite for a physics engine: a physics tick without a fixed quantum shared with the navigator cannot be deterministic.cvc::world_clocklockstepmode: exactlylockstep_stepsquanta peradvance(), whatever the wall says (frame-by-frame inspection).advance_ticks(n): batch; exactly n quanta now, any mode, no cap.configure(config)/current_config(): a host picks a quantum every simulation divides, before any of them starts. It restarts at tick 0 and keeps the mode.step_result::first_tick: the quanta a call ran arefirst_tick + 1 … first_tick + steps.realized_scale(): world seconds actually simulated per wall second over a ≥ 0.5 s window. A speed the machine cannot deliver reads below the request instead of quietly running slower.cap_scales_with_rate: the live cap grows withscale, so asking for 2x is not silently capped at what a 1x-sized cap allows. Off by default.wait_for_tick_change(): a follower thread blocks until the driver moves the clock.cvc/core/clock_follower.hticks_per_step(dt, fixed_dt)refuses a step that is not a whole number of quanta (a 0.06 s navigator step on a 1/120 s clock would be 7.2). It tolerates a float32 trained dt.steps_dueandclock_follower(take,due_at) let any number of simulations follow one clock at their own periods.alphais the presentation fraction into a follower's own step.cvc::world_clock_bindingThe clock on the state tree under a prefix (default
sim: the keys Ariadne'ssim_transport.arialready binds).speed,paused,mode,lockstep_steps, andstep(a request counter).time,tick,fixed_dt,realized_speed,dropped.drive(wall_dt)pulls the controls, advances, runs requested steps and pushes the telemetry.nav::sim_threadsim_thread(world, clock, options)follows a shared clock, one navigator step everyveh.dt / fixed_dtquanta. It waits on the clock instead of polling. Pausing one simulation leaves the shared clock alone.sim_thread(world, hz): it now drives a private clock athz * veh.dt. Its behaviour is unchanged, and stalls are counted inbehind().Also in this PR
set_config,advance_ticks,realized_scale,ticks_per_step,clock_follower, andworld_clock_binding(app, clock[, prefix]).docs/WORLD_CLOCK_API.md, the sync roadmap, and an update note inNAV_UNITS_ROADMAP.md(a nav step is k quanta; simulation hosts use 0.01 s).The contract, pinned by tests
Pacing decides when quanta run, never which.
ClockFollowerTest.TheTrajectoryIsTheSameUnderEveryPacingModeruns one follower under seven pacings and asserts identical traces: live 1x, 2x and 0.5x, lockstep, batch, and single-step.NavSimThread.AFollowerMatchesDirectSteppingExactlychecks that asim_worldstepped through a threaded follower in uneven clock batches matches direct stepping bit for bit.Tests
world_clock_testfirst_tick,configure, realized speed, the rate-scaled cap, the wait, followers,steps_due(brute-force sweep),alpha, pacing invarianceapp_testnav_testsim_threadcases: follows a shared clock at period 6, refuses 7.2 quanta, matches direct stepping exactlytest_pycvc_world_clock.pyNav kernels are untouched (they never see the clock), so the goldens do not move.
Verified
Windows (MSVC 2022, Ninja). Built against a local cvcpkg prefix:
install-deps cvcpkg/recipes/libcvc, plus cmake, ninja, googletest, python311, numpy-cp311 and swig from cvcpkg.world_clock_test: 49/49.app_testclock and binding cases: 7/7.system_macro_headers_test: passes.nav_test: 63/63, including the 4NavSimThreadcases.test_pycvc_world_clock.py: all 14 against the freshly built_pycvc.pyd.Linux (gcc 11). An earlier revision of the core clock passed
world_clock_testand the binding cases.Two things the local run caught and this PR fixes:
sim_threadre-anchored its follower on the worker thread, so a clock advanced right afterstart()could lose steps. It now anchors instart().CI does not build pycvc, so the Python results above are the only check on the bindings.