All MicroEvals
High-Performance Multi-Color Gauss-Seidel Preconditioned Conjugate Gradient (CUDA C++)
Create MicroEval

High-Performance Multi-Color Gauss-Seidel Preconditioned Conjugate Gradient (CUDA C++)

Prompt

# Challenge: High-Performance Multi-Color Gauss-Seidel Preconditioned Conjugate Gradient (CUDA C++) ## Objective Implement an end-to-end, high-performance Preconditioned Conjugate Gradient (PCG) solver in CUDA C++ for large, sparse, symmetric positive-definite (SPD) linear systems ($Ax = b$) defined over graph topologies. The preconditioner is a Symmetric Multi-Color Gauss-Seidel (MCGS) smoother. --- ## Target System & Workload Scale - **Hardware Architecture:** NVIDIA Ampere A100 GPU (Compute Capability `sm_80`, 40MB L2 Cache, HBM2e memory subsystem). - **Compilation Target:** CUDA Toolkit 12.x (`nvcc -O3 -arch=sm_80 --use_fast_math`). - **Graph Scale:** Approximately 1,000,000 vertices with node degree (fanout) between 3 and 30 edges per vertex. - **Color Partitioning:** The graph coloring is pre-computed and provided as part of the input. The number of colors $K$ and the vertex-to-color assignments are known beforehand, with approximately equal numbers of vertices assigned to each color group. - **Matrix Properties:** Symmetric Positive-Definite (SPD) with strict diagonal dominance to ensure theoretical convergence. - **Precision:** Single-precision floating-point arithmetic (`float` / FP32) for all vectors, matrix coefficients, and iterative solver computations. --- ## Algorithmic Structure 1. **Color-Based Parallelism:** - Consume the pre-assigned color sets where every vertex in a given color group is independent of all other vertices within that same group. - Execute relaxation updates across all vertices of a single color group simultaneously in parallel across GPU threads. 2. **Symmetric Gauss-Seidel Cycle:** - The preconditioning phase ($M z = r$) performs a symmetric cycle: a forward relaxation sweep across color groups $1, 2, \dots, K$ followed by a backward relaxation sweep across color groups $K, K-1, \dots, 1$. --- ## Performance Objectives 1. **Memory Locality & Coalescing:** - Design custom internal data representations, memory layouts, and data layouts for the graph and vectors. - Maximize 128-byte coalesced memory transactions and cache line utilization between adjacent threads. - Maximize spatial and temporal locality within the A100 memory hierarchy (registers, shared memory, and L2 cache). - Maintain uniform thread workloads and balanced execution profiles across all warps despite variations in vertex degrees. 2. **Kernel Launch Minimization & Operator Fusion:** - Bound the number of kernel launches to a constant count per iteration, or across the solve phase as a whole. - Fuse inner products, global reductions, vector updates, and relaxation sweeps to maximize on-chip data residency between consecutive mathematical operations. --- ## Deliverables Provide a complete, self-contained, and compilable CUDA C++ program that: 1. Defines custom data structures and interfaces for ingesting the graph, pre-assigned colors, and linear system. 2. Implements internal data reordering and transformation into your chosen execution layout. 3. Implements the complete FP32 Multi-Color Gauss-Seidel Preconditioned Conjugate Gradient solver. 4. Includes a `main()` function with a synthetic graph generator matching the problem scale ($N \approx 1{,}000{,}000$, degree $d \in [3, 30]$, pre-assigned balanced colors) to initialize the data and invoke the solver.

Response not available

Drag to resize
Drag to resize
Drag to resize