Incoherent dedispersion over 1000 DM trials with channel flagging and boxcar search
/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 radio-astronomy single-pulse search on a synthetic filterbank.
- Filterbank.
NCHANfrequency channels, channelcatF_c = FTOP - c*CHBWkHz. Each channel holdsNIN = NOUT + MAXDELAYuint8 samples built from the seed: a per-channel bandpass level, 4-byte hash noise, square-wave RFI in about 3% of the channels,NPULSEdispersed pulses with triangular profiles, and a few broadband bursts. All additions saturate at 255 (see the generation loop in the source; every sample is a counter-based hash, so any element can be produced independently). - Delays.
R_c = floor(2^20 (FTOP^2 - F_c^2) / F_c^2)anddelay(c, d) = floor(d * KDM * R_c / 2^20)samples for DM triald = 0 .. NDM-1;MAXDELAY = delay(NCHAN-1, NDM-1). - Channel flagging.
mean_c= integer mean of the firstmin(NIN, 8192)samples of the channel;med= the sorted means at indexNCHAN/2; channelcis flagged (ignored below) whenmean_c > med + 12. - Dedispersion. For every DM trial
dand output samplet < NOUT:s[d][t] = sum over unflagged c of x[c][t + delay(c, d)](int32). - Per-DM statistics. Sum, maximum and first argmax of
s[d], and a hash of all its values. Boxcar search:m = floor(sum / NOUT); for widthswin{1,2,4,8,16,32}(onlyw <= NOUT) andt + w <= NOUT:B = sum_{k<w} s[d][t+k] - w*m,score = trunc(32*B / SQ_w)withSQ = {32,45,64,90,128,181}. The best of a DM is the highest score, ties to the smaller width, then the smallert.
Input format
One line: NCHAN NOUT NDM FTOP CHBW KDM NPULSE SEED (integers, SEED unsigned 64-bit).
Output format
dedisp nchan NCHAN flagged NFLAGGED nin NIN maxdelay MAXDELAY
series sum S hash H
dmstats hash HD
dm d max M argmax A best SCORE w W t T (d = 0, step, 2*step, ... with step = max(1, NDM/16), plus NDM-1)
cand k dm d score SCORE w W t T (k = 0 .. min(16, NDM)-1)
S is the sum of all s[d][t]; H = sum mod 2^64 of
mix64((d*NOUT + t) * 0x9E3779B97F4A7C15 + s[d][t]); HD combines every DM's maximum, argmax
and best boxcar as in the source. cand lines list the DMs ordered by best score (descending),
ties to the smaller DM.
Hidden inputs
1 <= NCHAN <= 4096,1 <= NOUT <= 2^20,1 <= NDM <= 2048,300000 <= FTOP <= 2000000,CHBW >= 1withF_bottom = FTOP - (NCHAN-1)*CHBW > FTOP/2,0 <= KDM <= 1024,0 <= NPULSE <= 64,MAXDELAY <= 80000,NCHAN * NIN <= 1.3e9bytes andNDM * NOUT <= 6e8.- Correctness inputs include a single channel / sample / DM,
NOUTbelow 32 (some boxcar widths absent),KDM = 0(no dispersion), 4096 channels, 2048 DM trials,NOUT = 2^20, no pulses and 64 pulses, and random mid-size cases. - The timing input has 1792-2048 channels, 896-1024 DM trials, about 5e5 output samples and a maximum delay of 40000-70000 samples (about 1e12 channel additions).
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 be identical to the CPU program's output (trailing whitespace ignored). 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 has 1792-2048 channels, 896-1024 DM trials, about 5e5 output samples and maximum delays of 40000-70000 samples (about 1e12 channel additions over a ~1.2 GB filterbank). 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.