Using Numba for GPU acceleration of Neutron Beamline Digital Twins
Coleman J. Kendrick
Jiao Y. Y. Lin
Garrett E. Granroth
Digital twins of neutron instruments using Monte Carlo ray tracing have proven to be useful in neutron data analysis and verifying instrument and sample designs. However, these simulations can become quite complex and computationally demanding with tens of billions of neutrons. In this paper, we present a GPU accelerated version of MCViNE using Python and Numba to balance user extensibility with performance. Numba is an open-source just-in-time (JIT) compiler for Python using LLVM to generate efficient machine code for CPUs and GPUs with NVIDIA CUDA. The JIT nature of Numba allowed complex instrument kernels to be generated easily. Initial simulations have shown a speedup between 200-1000x over the original CPU implementation. The performance gain with Numba enables more sophisticated data analysis and impacts neutron scattering science and instrument design.
Monte Carlo, numba, digital twin, Python, neutron, GPU, ray tracing, CUDA
DOI10.25080/gerudo-f2bc6f59-006