Skip to content

CCC Environment Compile Solutions Once Optimization - #3087

Merged
cmunley1 merged 7 commits into
NVIDIA-NeMo:mainfrom
aleksficek:ccc-node-local-compile-once
Sep 8, 2026
Merged

cmunley1 merged 7 commits into
NVIDIA-NeMo:mainfrom
aleksficek:ccc-node-local-compile-once

Conversation

@aleksficek

@aleksficek aleksficek commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Previously, the same generated solution was compiled independently for every test case. At high rollout concurrency, this creates redundant compiler work and metadata-heavy temporary-file traffic on shared filesystems.

This change reduces compilation to once per solution and allows compiler I/O to occur on node-local storage while retaining distributed test execution and per-test isolation. Additionally, I add warning logs for when SHARED_TEMP_DIR is not set to help with debugging.

Summary

  • Compile each generated solution once and reuse the compiled artifact across its test cases.
  • Add optional local_compile_dir / LOCAL_COMPILE_DIR support for staging compilation on node-local storage (defaults to tmp).
  • Existing shared-storage behavior can be specified with LOCAL_COMPILE_DIR set to null.
  • Added warning logs for when SHARED_TEMP_DIR is not set to help with debugging.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@aleksficek
aleksficek marked this pull request as ready for review September 7, 2026 14:28
@aleksficek
aleksficek enabled auto-merge (squash) September 7, 2026 14:49
Compile each generated solution once before distributing its tests. Add optional node-local compilation staging, then publish completed artifacts to shared storage so test execution can remain distributed across nodes.

Signed-off-by: Aleksander Ficek <[email protected]>
Use /tmp/nemo-gym-compile when no local compile path is configured. Keep the path overridable and treat an explicit null value as disabling local staging.

Signed-off-by: Aleksander Ficek <[email protected]>
@aleksficek
aleksficek force-pushed the ccc-node-local-compile-once branch from be122d5 to f0370f9 Compare September 7, 2026 15:33
@aleksficek

Copy link
Copy Markdown
Contributor Author

/ok to test f0370f9

@aleksficek aleksficek self-assigned this Sep 7, 2026
@aleksficek aleksficek added the env-infra Infra related to creating new environments label Sep 7, 2026
@aleksficek
aleksficek requested a review from cmunley1 September 7, 2026 16:25
command = f"cd {quoted_work_dir} && ./compile.sh"
else:
local_work_dir = os.path.join(local_compile_dir, os.path.basename(work_dir.rstrip(os.sep)))
quoted_local_work_dir = shlex.quote(local_work_dir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this have unique work dir per rollout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes its already unique work dir per rollout so that each node can compile multiple rollouts concurrently

handle.write("\n")


class LocalSandbox:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out. It isn’t a drop-in replacement yet because the compiled artifacts for this env need to be accessible across sandbox nodes, while the new API provides sandbox-local storage. We should eventually migrate once artifacts can be distributed / shared.

@cmunley1

cmunley1 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

/claude review

@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review: HOLD

Focused, well-tested refactor of the CCC verifier: compile each solution once (_compile_solution_once) and reuse the artifact across all test cases, plus optional node-local compile staging (local_compile_dir, default /tmp/nemo-gym-compile) published back to the multi-node shared_dir. The subtask scoring/aggregation state machine is moved verbatim into _evaluate_compiled_solution — no scoring-math change. New test_ccc_eval.py exercises the staging, reuse, and compile-failure paths against a real shell. Good tests, right intent.

One blocker stops merge:

BLOCKER (ccc_eval.py:215) — silent score corruption on shared filesystems. Compile success is not compile_result.get("stderr"), but the new wrapper folds cp -a (--preserve=all) stderr into that same stream. On NFS/Lustre/overlay and cross-UID copies — the exact multi-node deployment this feature targets — cp -a emits Operation not permitted warnings to stderr and exits non-zero even when contents copy fine, flipping a good compile to compile_success=False and zeroing every test. Staging is on by default, so this is live for default configs on networked storage; it passes in local /tmp. Regression vs. base (which compiled directly, no cp in the compile-stderr stream). Fix: gate success on compile.sh's own stderr/returncode, not the union shell stderr.

RISK (ccc_eval.py:451) — solution_dir dropped its per-worker disambiguator. Keyed only on pid + time_ns(); concurrent rows share a pid and can collide on a coarse-clock tick, interleaving two solutions in one dir → wrong scores. Base's per-test dirs carried worker_id for exactly this. Add a thread-id/uuid component.

Both are score-correctness issues in a verifier feeding evals/training, hence the grades. The shared_dir=/tmp warning added in app.py is a good operability touch. Resolve the blocker and the collision window and this is a solid change.

@aleksficek

Copy link
Copy Markdown
Contributor Author

/ok to test c538f50

@aleksficek
aleksficek requested a review from cmunley1 September 8, 2026 14:44
@aleksficek

Copy link
Copy Markdown
Contributor Author

/ok to test 3816f78

@cmunley1
cmunley1 disabled auto-merge September 8, 2026 16:11
@cmunley1
cmunley1 merged commit d388c8e into NVIDIA-NeMo:main Sep 8, 2026
30 checks passed
jkyi-nvidia pushed a commit that referenced this pull request Sep 11, 2026
## What does this PR do?

Previously, the same generated solution was compiled independently for
every test case. At high rollout concurrency, this creates redundant
compiler work and metadata-heavy temporary-file traffic on shared
filesystems.

This change reduces compilation to once per solution and allows compiler
I/O to occur on node-local storage while retaining distributed test
execution and per-test isolation. Additionally, I add warning logs for
when `SHARED_TEMP_DIR` is not set to help with debugging.

## Summary

- Compile each generated solution once and reuse the compiled artifact
across its test cases.
- Add optional `local_compile_dir` / `LOCAL_COMPILE_DIR` support for
staging compilation on node-local storage (defaults to `tmp`).
- Existing shared-storage behavior can be specified with
`LOCAL_COMPILE_DIR` set to null.
- Added warning logs for when `SHARED_TEMP_DIR` is not set to help with
debugging.

## Checklist

- [x] I have read the [contributing
guidelines](https://docs.nvidia.com/nemo/gym/latest/contribute/development-setup).
- [x] The change is focused; unrelated "drive-by" edits are tracked as
separate issues/PRs.
- [x] Tests added or updated and pass locally, or N/A for docs-only /
non-code changes (so CI unit/server checks pass when applicable).
- [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so
CI lint/format/copyright pass).
- [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check
passes).

---------

Signed-off-by: Aleksander Ficek <[email protected]>
Signed-off-by: Junkeun Yi <[email protected]>
ananthsub pushed a commit that referenced this pull request Oct 15, 2026
Super 3.5 post-training launchers export CCC_SHARED_TEMP_DIR and mount
it into the sandbox containers, but main reads only SHARED_TEMP_DIR.
shared_dir then silently falls back to /tmp, which the sandbox cannot
see, so every CCC compile fails and scores 0.

Port #3113 (8ff4a09 on super-v3.5-posttraining) with backward
compatibility, and give LOCAL_COMPILE_DIR (#3087) the same prefix:

- shared_dir reads CCC_SHARED_TEMP_DIR, then SHARED_TEMP_DIR, then /tmp
- local_compile_dir reads CCC_LOCAL_COMPILE_DIR, then LOCAL_COMPILE_DIR,
  then /tmp/nemo-gym-compile
- drop the shared_dir overrides in benchmarks/ioi and benchmarks/ioi26;
  they duplicated the inherited CCC value and would have kept IOI on
  the old name
- point the /tmp warning and the README at the prefixed names

Add tests that resolve the CCC, IOI and IOI26 configs through
GlobalConfigDictParser with the variables unset, legacy-only,
prefixed-only, and both set.

Signed-off-by: Peter Jin <[email protected]>
thibautbar pushed a commit to thibautbar/Gym that referenced this pull request Oct 15, 2026
…NVIDIA-NeMo#3963)

Super 3.5 post-training launchers export CCC_SHARED_TEMP_DIR and mount
it into the sandbox containers, but main reads only SHARED_TEMP_DIR.
shared_dir then silently falls back to /tmp, which the sandbox cannot
see, so every CCC compile fails and scores 0.

Port NVIDIA-NeMo#3113 (8ff4a09 on super-v3.5-posttraining) with backward
compatibility, and give LOCAL_COMPILE_DIR (NVIDIA-NeMo#3087) the same prefix:

- shared_dir reads CCC_SHARED_TEMP_DIR, then SHARED_TEMP_DIR, then /tmp
- local_compile_dir reads CCC_LOCAL_COMPILE_DIR, then LOCAL_COMPILE_DIR,
then /tmp/nemo-gym-compile
- drop the shared_dir overrides in benchmarks/ioi and benchmarks/ioi26;
they duplicated the inherited CCC value and would have kept IOI on the
old name
- point the /tmp warning and the README at the prefixed names

Add tests that resolve the CCC, IOI and IOI26 configs through
GlobalConfigDictParser with the variables unset, legacy-only,
prefixed-only, and both set.

Signed-off-by: Peter Jin <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 3816f784 Deployed Sep 8, 2026 by copy-pr-bot[bot] via release / finalize / notify #2676
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

env-infra Infra related to creating new environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants