BGP path-vector convergence and link-failure impact study
/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
An inter-domain routing study: route propagation under a BGP-like path-vector protocol on a generated AS topology, run once on the intact network and once after a set of link failures.
- Topology.
Nautonomous systems (ids0..N-1). The firstT1form a full peer mesh. Every later ASibuys transit from 1-3 providersj < ipicked with a preferential bias toward low ids, and with probability 1/4 adds 1-2 lateral peer links to ASes in[max(T1, i-64), i). Each link gets per-direction policy hashes (link preference, prepending, MED).Flink ids are drawn by hash and marked failed (duplicates collapse; the effective count is printed). - Base epoch. For each prefix
p(origin AS and an 8-bit origin community tag come from hashes ofp), synchronous rounds are run: in roundtevery AS recomputes its best route from its neighbours' roundt-1routes. A neighbourvadvertises its route toronly if it is valley-free (learned from a customer or originated, orrisv's customer) and the route's no-export community (tag & 0xE0 == 0xE0) does not forbid it. Advertisements to providers may be prepended 1 or 2 extra times.rrejects routes containing its own AS (loop detection) or longer than 20 hops. Candidates are ranked lexicographically by local preference (relationship base 300/200/100 + link preference 0..31, minus 24 when the transformed tag's low nibble matchesr's low nibble), then AS-path length, then MED, then neighbour id. Iteration stops at the first round in which no AS changes (route, tag and AS path) or after 64 rounds. - Failure epoch. Starting from the converged base state, every route whose next hop crosses a failed link is withdrawn, failed links are removed and rounds are run again to convergence.
- Analytics. Per epoch: convergence-round histogram, reachability, learned-from class counts, AS-path length histogram, the 10 ASes that appear most often as transit in best paths (each AS counted once per path, the origin excluded), and an order-independent digest of all RIB entries; then how many (prefix, AS) entries changed / lost / gained reachability, and 8 sample prefixes.
The CPU source is the exact specification of every hash, rule and tie-break.
Input format
One line: N T1 P F seed — number of ASes, tier-1 mesh size, number of prefixes, number of link
failures drawn, 64-bit seed. 1 <= T1 <= min(N, 32), N <= 20000, P >= 0, 0 <= F <= 64.
Output format
A topology line, then for base and fail the lines converged/nonconverged/round_sum,
rounds r:count ..., reach ... cust peer prov, len l:count ..., transit_top as:count ...,
digest=<16 hex>; then [diff] changed lost gained and up to 8 sample lines. Exact match.
Hidden inputs
Correctness inputs (12 files) include N = 1, N = 2 with its only link failing, a pure 16-AS
tier-1 mesh, P = 0, F = 0, seeds 0 and 2^64-1, N up to 3000 and random cases with
20 <= N <= 1200, 1 <= P <= 300. The timing input has N uniform in [5000, 6000],
T1 in [10, 16], P = 30000 prefixes and F in [16, 48].
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 5000-6000 ASes (about 12-15k links), 30000 prefixes and 16-48 failed links; every prefix converges in about 10-25 base rounds plus a shorter failure re-convergence. 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.