Nested-dissection supernodal Cholesky of one large 3D hex-mesh system
/app/cpu/main.cpp is the source of a multicore CPU program (C++17, OpenMP).
The program takes one input-file path (PROGRAM INPUT_FILE) and writes its result to stdout.
What the program computes
A structured three-dimensional hexahedral mesh defines one SPD matrix. Every cell contributes a seed-dependent positive Laplacian over its eight vertices; every vertex also receives a positive ground stiffness. The program orders vertices by recursive coordinate bisection (nested dissection), discovers separator fronts and their boundary variables, constructs the elimination tree and symbolic column counts, then performs multifrontal FP64 Cholesky: each front is assembled from the matrix and from its two children's Schur complements, its separator columns are eliminated, the L columns are kept and the Schur block is handed to the parent. Forward and backward triangular solves recover a known generated displacement field. The final residual is recomputed against the original assembled matrix, not against the factor.
Input format
One line: NX NY NZ SYSTEMS SEED. Dimensions are 1..56 on each axis, SYSTEMS is 1..8 (independent coefficient fields on the same mesh, factored one after another), and SEED is an unsigned 64-bit integer. Small dimensions, including one-vertex and two-vertex sides, are valid.
Output format
The first line contains the mean relative residual and a smooth solution-energy checksum as FP64 numbers. The second line contains exact labeled tokens nnz=, flops=, etree_height=, max_front=, and pivot_digest=. nnz is the stored supernodal factor nonzero count, flops the symbolic Cholesky operation count, max_front the widest dense front. The pivot digest hashes coarse quantized diagonal pivots in global column order.
Hidden inputs
Correctness inputs cover small and uneven mesh dimensions, including 1 and 2, and multiple independent coefficient fields. The timing input is a single 56x56x56 system whose elimination tree has thousands of tiny leaf fronts and a few dozen dense fronts of 1500-4700 columns near the root. Floating summaries are compared with relative tolerance 1e-9 and absolute tolerance 1e-11; labeled structural quantities and the digest are exact.
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.
This sandbox is for writing the source only: it has g++ and the CPU program, but no CUDA
compiler and no GPU. Compilation, execution and verification happen later on an H100 in a
separate verifier, and a port that does not compile is rejected, so check your logic against
the CPU program before you finish (for example by emulating your kernels on the host).
How your port is verified
- 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. - Verification runs on one H100 in a fresh container without network. Hidden inputs are generated with a fresh random seed at verification time.
- Correctness: every hidden input (small edge cases plus a large 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-09 and atol = 1e-11; every other token must be identical. Any mismatch, crash or timeout is rejected. - GPU execution is checked: a port that computes its answer on the CPU is rejected even when its output is correct.
- Speed: At scale 1.0 the input is a single 56x56x56 hex-element system (175616 unknowns, about 2.0e11 factor flops, top fronts up to 4704 columns, elimination-tree height about 7300). The grid side scales like scale^(1/6) so the factor work stays roughly linear in scale; no clamp at 1.0 other than the program's 56-per-axis bound.
/app/inputs/timing_example.inhas the shape and size of the hidden timing input. Your port is timed against a reference GPU port on it; the faster your port, the higher its score. /app/inputs/holds public input examples for understanding the input format.