cosmokdtree: a flexible OpenMP-parallelized k-d tree for computational astrophysics applications
Óscar Monllor-Berbegal, David Vallés-Pérez, Susana Planelles, Vicent Quilis
Abstract
Modern numerical astrophysics applications present a common demand for efficient spatial querying techniques, such as neighbor searches or density estimations over billions of resolution elements. To address the growing need for fast and versatile tools tailored to these tasks, we present cosmokdtree, a fast and flexible multi-purpose k-d tree implementation in Fortran, parallelized with OpenMP directives. Our library supports arbitrary dimensionality and spatial distributions, and is designed for efficient tree construction and fast query performance for moderate-scale applications (performance tested up to 109 points). Python bindings coupled to the module are also provided. All these ingredients yield a k-d tree package suitable for analysis purposes. We benchmark cosmokdtree across a variety of scenarios, including different point distributions, dimensionality, and parallel scaling. We also compare its performance against the widely used scipy implementation and other efficient alternatives such as coretran's and a GPU-based version, showing that cosmokdtree consistently achieves lower construction and query times than CPU alternatives while keeping a reasonable memory usage. Our tree-building phase implementation, executed on a mid-range workstation-class CPU, approaches the performance of GPU-based implementations when run on high-end consumer graphic cards, although data-center GPUs, out of the scope for our comparison, could still deliver substantially higher performance and a broader conclusion cannot be extracted. We further present some applications tackling common problems in astrophysics, namely, the friends-of-friends clustering algorithm and the particle-to-mesh assignment process. The code is publicly released and intended to serve as a flexible multi-purpose tool for computational applications in a wide range of scenarios, particularly in astrophysics.
Create a lesson
Related papers
Characterization of the CSST Survey Camera CCDs: I. basic electro-optical performance
Zun Luo, Hu Zhan, Youhua Xu et al.
The Nancy Grace Roman Space Telescope Coronagraph Community Participation Program
Dmitry Savransky, Vanessa P. Bailey, Schuyler G. Wolff et al.
Supporting users in their observation preparation - the ESO ObsPrep tool
Monika G. Petr-Gotzens, Vincenzo Forchi, Andrea Mehner et al.
The GOTO Telescope Control System
Martin J. Dyer, Vik S. Dhillon, Stuart Littlefair et al.
Transitioning from ADS to SciX to Serve 21st Century Astronomy
Jennifer Lynn Bartlett, Suze Kundu, Alberto Accomazzi et al.
Progress in quantum telescopes
David R. Gozzard, Fiona H. Panther, Andrew G. White