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@4harbor download elfsong/cpu2gpu@4Canonical package: elfsong/cpu2gpu@1.3.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.3.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.3.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 the verifier provider configuration:
{
"environment": {
"type": "terminal-sandbox"
},
"verifier": {
"environment": {
"type": "terminal-sandbox", "override_gpus": 0,
"kwargs": {"gpu_queue_dir": "${CPU2GPU_GPU_QUEUE}"}
},
"env": {"CPU2GPU_VERIFICATION": "remote"}
}
}
The Terminal Sandbox provider uses existing host-side service credentials and 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.
Timed runs are isolated across the host by default (--timing-isolation exclusive): while one runs, no other GPU process on the worker starts,
initializes or exits, because those stretch main() of short programs on other
GPUs by up to several times. Compilation, correctness, warmup and profiling runs
still proceed on all eight GPUs.
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.
The generation sandbox provides /app/cpu/main.cpp and public input examples in
/app/inputs/. The agent writes /app/gpu/main.cu. Bootstrap copies the inputs
and creates the output directory. Generation does not compile a CPU baseline,
provide run_public.sh or gpu_run, or connect to a GPU service. Compilation and
execution belong to the separate verifier, which builds its own CPU reference.
Terminal Sandbox automatically runs the task's bootstrap.sh and defaults to a
90-minute session. Explicit provider kwargs override these defaults.
This local build contains source-generation changes that have not yet been
published to Hub. Use harbor run -p /path/to/unified-gpu/tasks for this build;
add --disable-verification to collect the CUDA source for verification later.
The generated file is saved under each trial's artifacts/app/gpu/main.cu.
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. Speed rounds use the verifier-owned
in-process timer (inproc_timer.cpp, format inproc-v1), preloaded into both
programs: it creates the CUDA context before main() and measures main() until
it returns or calls exit(). Process launch, isolation, context creation and
teardown (about 0.7 s per run) are excluded; input parsing, host work, transfers,
kernels and output inside main() count, so this is not kernel-only timing. A
candidate without a valid report receives reward 0; a reference without one is an
infrastructure error. Process wall times remain in detail.json (t_ref_wall,
t_agent_wall). Timing inputs are sized so the reference main() takes at least
about 0.5 s on an H100. 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, or timer tampering beyond its per-run nonce and wall-time bound. 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.