Batched ADMM total-variation restoration of multichannel recordings
/app/cpu/main.cpp is a multicore CPU program (C++17, OpenMP). It is built as
/app/bin/cpu_baseline with g++ -O3 -march=native -fopenmp -std=c++17 and run as
cpu_baseline INPUT_FILE
It reads one input file and writes its result to stdout.
What the program computes
A batch restoration job for S multichannel sensor recordings (C channels, T samples
each). Everything is generated from the seed and the recording index with the
SplitMix64-based hashes hh/u01 of the CPU source (restore):
- Data generation. A piecewise-constant ground truth
x*_{t,c}(private jumps per channel and common jumps across all channels), time-varying channel gainsg_{t,c}, a fixed crosstalk/lag matrixA1(C x C) and two vectorsu, v. The observation isy_t = A0_t x*_t + A1 x*_{t-1} + noise_twithA0_t = diag(g_t) + (0.3/C) u v^T(x*_{-1} = 0), noise uniform in[-0.05, 0.05], channel weightsw_cin[0.5, 1.5). - Normal equations.
K = A^T A + rho D^T Dwithrho = 0.8andDthe first difference in time per channel.Kis block tridiagonal withC x CblocksK_tt = A0_t^T A0_t + [t < T-1] A1^T A1 + rho deg_t IandK_{t,t-1} = A0_t^T A1 - rho I. The CPU computes its block Cholesky factor (B_t = K_{t,t-1} L_{t-1}^{-T},L_t = chol(K_tt - B_t B_t^T)) once per recording. - ADMM,
itersiterations fromx = z = u = 0, formin 1/2 ||A x - y||^2 + lambda sum_c w_c sum_t |x_{t+1,c} - x_{t,c}|,lambda = 0.15:x = K^{-1} (A^T y + rho D^T (z - u))(block forward / back substitution),z = soft(D x + u, lambda w_c / rho),u = u + D x - z. - Report per recording: the objective
Fat the end, the primal residualrp = ||D x - z||and the dual residualsd = rho ||D^T (z - z_prev)||of the last iteration (both 0 wheniters = 0),rmseagainst the ground truth, the total variationtv = sum |x_{t+1,c} - x_{t,c}|and the energyx2 = sum x^2; also the objectiveFhalfafter iterationiters/2(integer division; atx = 0wheniters < 2).
All arithmetic is IEEE double precision.
Input format
One line: S C T iters SEED with 1 <= S <= 4096, 1 <= C <= 16, 1 <= T <= 8192,
0 <= iters <= 5000, S * T * C * C <= 1.2*10^8; SEED is an unsigned 64-bit integer.
Output format
For every recording r with r % max(1, S/24) == 0:
rec r F <F> rp <rp> sd <sd> rmse <rmse> tv <tv> x2 <x2>
then total S <S> C <C> T <T> iters <iters> F <sum F> Fhalf <sum Fhalf> rmse <sum rmse> tv <sum tv> x2 <sum x2> rp <sum rp> sd <sum sd> (sums over all recordings, on one line).
Reals are printed with %.12e and compared with a relative tolerance of 1e-8 (absolute
1e-11): any summation order or factorisation that is exact in double precision passes,
reduced precision does not.
Hidden inputs
Correctness inputs (13 files) include T = 1 and T = 2, C = 1 and C = 16,
iters = 0 and iters = 1, seeds 0 and 2^64-1, and random sizes with
S <= 50, T <= 2000. The timing input has T = 1024, iters = 400,
C chosen from {10, 12, 14, 16} and S about 114000 / C^2 (about 1150 recordings
for C = 10, 450 for C = 16).
Your task
Port this program to CUDA in /app/gpu/main.cu: same command line (PROGRAM INPUT_FILE),
same output on stdout. Then make it as fast as you can on the GPU while keeping the output correct.
The main computation must execute on the GPU. Renaming CPU code to .cu, running a
CPU fallback, or launching a dummy kernel while computing the answer on the CPU does not satisfy this task.
The CPU source is the specification: when this text and the code disagree, the code wins.
How you are scored
- Only
/app/gpu/main.cuis collected. It is compiled withnvcc -O3 -arch=sm_90 -std=c++17 -o port /app/gpu/main.cu; no extra libraries are linked. The CUDA runtime and the header-only libraries that ship with the CUDA toolkit (CUB, Thrust, libcu++) are allowed. - Your source must not contain any of:
system(,popen(,fork(,exec*,dlopen(,getenv(,#include <filesystem>,/tests/,/proc/. The program may read only the input file it is given. - GPU verification uses the backend selected for this run: an H100 attached to the separate verifier, or a remote H100 worker. Hidden inputs use a fresh random seed.
- For public GPU experiments, use
/app/bin/gpu_run [--backend auto|local|remote] [--repeat N] [--quiet] SOURCE.cu INPUT_FILE.... The default usesGPU_RUNNER_URLwhen configured, otherwise a GPU attached to this sandbox. Sandbox GPU access is configured independently from verification; a CPU-only sandbox needs a runner URL. - Correctness: every hidden input (small edge cases plus the timing input) must pass.
Your output must have the same tokens as the CPU program's output. Numeric tokens may differ by at most
atol + rtol*|expected|with rtol = 1e-08 and atol = 1e-11; every other token must be identical. Any mismatch, crash or timeout gives reward 0. - GPU execution: a separate, untimed CUPTI check must observe completed GPU kernel activity on the hidden timing input. A CPU-only submission receives reward 0 even if its output is correct.
- Speed: The timing input restores several hundred recordings (about 114000 / C^2 for C in {10, 12, 14, 16}) of 1024 samples each with 400 ADMM iterations. Your port and our GPU reference are each run on it
once to warm up and then 5 times, interleaved; the time is the wall clock of the whole process
(including CUDA initialisation, input parsing and output). When correct,
reward = min(2, t_reference / t_yours)using the medians. /app/inputs/holds a few public inputs./app/bin/run_public.shcompiles your port with the flags above and compares it against the CPU baseline on each of them.