[Paper Review] Application of GPUs for the Calculation of Two Point Correlation Functions in Cosmology
This paper presents a CUDA-based GPU implementation of the Landy-Szalay estimator for computing the angular two-point correlation function (w(θ)) in cosmology, leveraging shared memory and atomic operations to accelerate pair counting. The method achieves a 100-fold speedup over CPU computation with negligible statistical deviation, enabling efficient analysis of large-scale structure in upcoming cosmological surveys.
In this work, we have explored the advantages and drawbacks of using GPUs instead of CPUs in the calculation of a standard 2-point correlation function algorithm, which is useful for the analysis of Large Scale Structure of galaxies. Taking into account the huge volume of data foreseen in upcoming surveys, our main goal has been to accelerate significantly the analysis codes. We find that GPUs offer a 100-fold increase in speed with respect to a single CPU without a significant deviation in the results. For comparison's sake, an MPI version was developed as well. Some issues, like code implementation, which arise from using this option are discussed.
Motivation & Objective
- Accelerate the computation of the two-point correlation function (2pcf) for large cosmological galaxy catalogs to meet the demands of upcoming high-volume surveys.
- Address the computational bottleneck of 2pcf calculation, which is prohibitively slow on traditional CPUs due to O(N²) scaling with object count.
- Explore GPU acceleration as a scalable solution to handle the massive data volumes expected in modern cosmological surveys.
- Ensure numerical accuracy by validating GPU results against established CPU implementations, confirming statistical consistency within cosmic variance.
Proposed method
- Implemented the Landy-Szalay estimator for w(θ) in CUDA to exploit massive parallelism on GPU architectures.
- Utilized shared memory for efficient computation of angular distances via dot product and arc-cosine operations, reducing global memory access.
- Applied atomic operations within shared memory to safely accumulate histogram counts (DD, DR, RR) across multiple thread blocks in parallel.
- Combined partial histograms from shared memory into global memory using atomic updates to avoid race conditions.
- Explored a multi-GPU strategy using three GPUs—two for DD/RR and one for DR—to maximize bandwidth and load balancing.
- Validated the implementation using publicly available MICE simulation galaxy catalogs, comparing results with a standard CPU-based C implementation.
Experimental results
Research questions
- RQ1Can GPU acceleration significantly reduce the computation time of the two-point correlation function in cosmology without compromising accuracy?
- RQ2How does the performance of a CUDA-based GPU implementation compare to a single CPU and to an MPI-based distributed CPU implementation?
- RQ3What are the key GPU optimization techniques—such as shared memory usage and atomic operations—that enable efficient histogram accumulation in 2pcf computation?
- RQ4To what extent can multi-GPU configurations further improve performance for large-scale 2pcf calculations?
- RQ5How do the results from the GPU implementation compare statistically to those from a reference CPU code, particularly in terms of residuals and cosmic variance?
Key findings
- The GPU implementation achieved a 164-fold speedup over a single CPU for the C2050 GPU, with execution times dropping from ~5.76×10⁵ seconds on CPU to ~3.51×10³ seconds for 1.72×10⁶ objects.
- For the largest catalog tested (6.89×10⁶ objects), the GPU version completed in 5.61×10⁴ seconds (about 1.56 hours), compared to 9.22×10⁶ seconds (~106 days) on CPU.
- Residuals between GPU and CPU results were negligible, falling well within expected cosmic variance, confirming numerical accuracy.
- The GTX295 and C1060 GPUs achieved speedups of approximately 100-fold relative to the CPU, with consistent performance across multiple catalog sizes.
- The multi-GPU configuration improved efficiency by distributing histogram computation across separate GPUs, with optimal load balancing between DD/RR and DR tasks.
- While MPI with more than 64 nodes eventually surpassed GPU performance, the GPU solution remains highly competitive and more energy-efficient for typical survey-scale analyses.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.