Skip to content

Commit ecdd495

Browse files
esenneshclaude
andauthored
Fix stale trace count in test_mcmc_parallel_chain and run it in CI (#2223)
* Fix stale trace count in test_mcmc_parallel_chain and run it in CI PR #1910 merged postprocess_fn into the fori_collect loop, adding two extra model traces for deterministic values, and updated test_mcmc_one_chain accordingly (4 -> 5) but left test_mcmc_parallel_chain asserting 4. The parallel-chain path has the same two extra calls, so the test fails with `assert 5 == 4` on any host with two or more devices. This went unnoticed because CI only runs test/test_compile.py without XLA_FLAGS=--xla_force_host_platform_device_count=2, so the skipif marker always skips the parallel-chain test. Update the assertion to 5 and add the file to the multi-device "Test chains" batch so it actually runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * pyproject.toml: add enough `dev` dependencies to get `uv run make test` passing Signed-off-by: Eli Sennesh <elisennesh@astera.org> --------- Signed-off-by: Eli Sennesh <elisennesh@astera.org> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent e37e7d7 commit ecdd495

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ jobs:
148148
XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/contrib/test_tfp.py -k "chain"
149149
XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/infer/test_hmc_gibbs.py -k "chain"
150150
XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/infer/test_mcmc.py -k "chain or pmap or vmap"
151+
XLA_FLAGS="--xla_force_host_platform_device_count=2" uv run pytest -vs test/test_compile.py -k "chain"
151152
- name: Test custom prng
152153
run: |
153154
JAX_ENABLE_CUSTOM_PRNG=1 uv run pytest -vs test/infer/test_mcmc.py

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,19 @@ dev = [
4949
"jaxns>=2.6.3,<=2.6.9",
5050
"matplotlib",
5151
"optax>=0.0.6",
52+
"pandas>=3.0.3",
5253
"pylab-sdk", # jaxns dependency
54+
"pyro-api>=0.1.2",
55+
"pytest>=9.1.1",
5356
"pytest-cov",
5457
"pyyaml", # flax dependency
5558
"requests", # pylab dependency
59+
"ruff>=0.15.22",
60+
"scikit-learn>=1.9.0",
61+
"seaborn>=0.13.2",
5662
"tfp-nightly",
63+
"ty>=0.0.57",
64+
"wordcloud>=1.9.6",
5765
]
5866
ci = [
5967
"coverage>=7.13.5",

test/test_compile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ def test_mcmc_parallel_chain(deterministic):
5353
mcmc.get_samples()
5454

5555
if deterministic:
56-
assert GLOBAL["count"] == 4
56+
# As in test_mcmc_one_chain, we have two extra calls to the model
57+
# to get deterministic values:
58+
# 1. transform the init state
59+
# 2. transform state during the loop
60+
assert GLOBAL["count"] == 5
5761
else:
5862
assert GLOBAL["count"] == 3
5963

0 commit comments

Comments
 (0)