CPU-to-GPU porting benchmark with local or remote H100 verification; CPU-output correctness and speed relative to a GPU reference.
harbor run -d elfsong/cpu2gpu@2harbor download elfsong/cpu2gpu@2Canonical package: elfsong/cpu2gpu@1.2.0 (258 tasks). Both verification modes
use the same CPU program, input generator, GPU reference, comparison policy and
grader for each task.
The dataset includes cpu2gpu-verifier-tools.zip: the launcher, local/remote
profiles, Merlin runner, and the Harbor wheel and patch used for verification.
Download it from this dataset's files, then:
unzip cpu2gpu-verifier-tools.zip
cd cpu2gpu-tools
uv venv --python 3.13 .venv
uv pip install --python .venv/bin/python harbor-0.24.0-py3-none-any.whl
source .venv/bin/activate
Supply your Harbor and Terminal Sandbox credentials in the host environment. The local workspace already has this Harbor build installed. Long sandbox commands run under a supervisor; Harbor polls their output and exit status through the file API so they can outlive the gateway's connection limit.
Harbor collects the agent trajectory in a CPU Terminal Sandbox. It transfers
only /app/gpu into a separate verifier environment, runs hidden tests,
collects rewards and logs, and cleans up both environments.
| Component | Remote verification | Local verification |
|---|---|---|
| Agent | CPU Terminal Sandbox | Same |
| Verifier | Separate CPU Terminal Sandbox | Separate GPU environment, e.g. Docker |
| CUDA compilation/execution | Merlin H100 pool | H100 attached to verifier |
| CPU reference and final scoring | Verifier | Verifier |
| Hidden inputs/reference | Accessible only to verification | Same |
The included Harbor integration adds native verifier.environment settings.
Selecting a profile changes the verifier provider, GPU allocation and network
policy in the run config; it does not rewrite downloaded tasks or their identity.
This integration is required by these profiles; it is not yet an upstream Harbor
feature.
# Set CPU2GPU_GPU_QUEUE to the shared verifier queue prepared below.
# Native Harbor configuration; profiles contain no model credentials.
harbor run -c profiles/merlin.json -d elfsong/cpu2gpu@1.2.0 \
-i '*vis-fast-ring' -a oracle -n 1
# Keep generation in Terminal Sandbox; verify in Docker with an attached H100.
harbor run -c profiles/local.json -d elfsong/cpu2gpu@1.2.0 \
-i '*vis-fast-ring' -a oracle -n 1
The convenience launcher writes the equivalent native config:
python3 run_cpu2gpu.py --verification remote -i '*vis-fast-ring' -- -a oracle -n 1
python3 run_cpu2gpu.py --verification local -i '*vis-fast-ring' -- -a oracle -n 1
--environment selects the agent provider. --verifier-environment overrides the
verifier provider. --prepare-only --output job.json writes a config without
launching anything. Agent/model options after -- are forwarded to Harbor.
Use the shared-volume relay on Merlin: Terminal Sandbox egress to Merlin's export domain is rejected by the company's production/office network isolation. Harbor transfers submissions and results through the official Sandbox file API, then the H100 worker consumes its owner-only shared queue. No direct sandbox-to- Merlin HTTP connection or GPU service token in the sandbox is needed in this mode.
The launcher can start or reuse services on an existing eight-card H100 worker:
python3 run_cpu2gpu.py --verification remote \
--merlin-worker 1122369 \
--shared-dir /mnt/bn/tiktok-mm-5/mz.du/cpu2gpu-gpucheck/harbor-integration-20261007 \
-i '*vis-fast-ring' -- -a oracle -n 1
The worker needs CUDA 12.6 with CUPTI headers/libraries, sudo and bubblewrap. --bwrap specifies the installed
binary. The launcher reuses a healthy runner and its bridge, creates a dedicated
owner-readable service token if absent, and configures Harbor's file relay.
Worker allocation and lifetime remain under Merlin; this command uses an existing
worker and does not create an additional GPU reservation.
Alternatively set gpu_queue_dir in both provider configurations:
{
"environment": {
"type": "terminal-sandbox",
"kwargs": {"bootstrap_script": "bootstrap.sh", "gpu_queue_dir": "${CPU2GPU_GPU_QUEUE}"}
},
"verifier": {
"environment": {
"type": "terminal-sandbox", "override_gpus": 0,
"kwargs": {"bootstrap_script": "bootstrap.sh", "gpu_queue_dir": "${CPU2GPU_GPU_QUEUE}"}
},
"env": {"CPU2GPU_VERIFICATION": "remote"}
}
}
The Terminal Sandbox provider uses existing host-side service credentials and explicit task bootstraps to prepare its fixed CPU image. It does not build the CUDA Dockerfiles. Generation and verification use different sandbox sessions.
The H100 service leases one GPU for a whole submission: compilation, correctness, warmup and timing. An eight-card pool accepts up to eight simultaneous jobs. Each executable runs with a distinct unprivileged host UID per GPU, a restricted filesystem, no network, and no access to the runner token, shared volume or other submissions. Compilation is cached by source, compiler version and flags.
For other deployments with supported direct network connectivity, set
GPU_RUNNER_URL and GPU_RUNNER_TOKEN instead of gpu_queue_dir. The shared
client supports both synchronous runner responses and asynchronous job polling.
It never falls back to local execution after a remote failure.
Local verification requires an H100 exposed to the verifier's container runtime;
Docker must be installed on the Harbor host. The grader checks the actual GPU
model. Merely setting CPU2GPU_VERIFICATION=local cannot allocate hardware; use
profiles/local.json so Harbor requests the GPU before starting verification.
Both modes expose /app/bin/gpu_run and /app/bin/run_public.sh for public GPU
experiments. Agent-side GPU experiments are configured independently of final
verification. A CPU generation sandbox needs the relay or a reachable remote
runner for those experiments, including when final verification is local.
The verifier creates fresh hidden inputs and compares output against its CPU reference using the task's exact or numeric-tolerance policy. Candidate output is checked on every correctness, warmup and timed run. A GPU reference mismatch, missing H100 or unavailable infrastructure produces a Harbor trial error; a bad candidate produces reward 0.
Successful submissions receive
min(2, median(reference time) / median(candidate time)), with one warmup and
five interleaved timing rounds by default. Remote timing measures process wall
time including isolation launch, excluding transfer, queueing and compilation.
It is not kernel-only timing. CPU timings are measured in the verifier environment.
Inspect each trial's verifier/reward.json, verifier/detail.json, trajectory
and artifact manifest. Detail records include candidate/reference hashes, hidden
seed, hardware identity, compiler flags and timing samples. An Oracle submission
should have correct=1 and a speed ratio near 1; Nop should have reward 0.
NVCC also compiles ordinary C++ for the CPU. Compilation and correct output alone
do not establish a GPU port. In addition to correctness, this verifier requires
completed CUDA kernel activity on the hidden timing input, measured by a
verifier-supplied CUPTI collector. Both candidate and reference receive a separate
untimed profiling run. These profiling times never enter the speed score.
A CPU-only submission, including a file that declares but never launches a
kernel, receives reward 0. Missing/broken profiling infrastructure fails the
trial instead of silently accepting the submission. The activity report, kernel
count and accumulated kernel duration are saved in detail.json.
The main computation must run on the GPU. Dummy kernels plus CPU computation violate the task. Activity tracing detects absent GPU execution; it does not prove semantic offloading or protect against deliberate in-process profiler tampering. Suspicious submissions still require source/trace review.
The first Haiku smoke submitted CPU-only code and received a positive score under the previous verifier. That result is invalid as a GPU-porting success and is retained only as a negative regression fixture.
python3 _tools/build_dataset.py
python3 -m unittest discover -s _tools/tests -v
The builder selects validated, non-retired sources and writes unified-gpu/.
Use --replace to rebuild generated files. Building does not publish to Hub.