*WINNER* Further Optimization of an Ultracold Neutron Spin Dynamics Simulation Code
Abstract
The UCNτ experiment is designed to measure an ultracold neutron’s (UCN’s) mean lifetime when trapped by a magnetic field before undergoing beta-decay. One value needed to determine this lifetime to high precision is a UCN’s depolarization rate. This value is difficult to measure empirically because it’s very small, but simulations may be used to estimate it. One simulation we are developing can be validated by comparing to actual trap lifetimes measured at different holding fields. Due to the amount of required computation, on a 10-core computer running Ubuntu 16.04 this code initially took about 36 hours to simulate 100 disjoint UCNs; but we really want to simulate in batches of millions of UCNs to get good statistics, which would take over 40 years to complete on the same hardware when scaled up. Optimization of the simulation code was required for better time efficiency. This code was fully converted to C++ from Python after trying optimization methods in Python and before using basic parallel programming methods, resulting in code 169 times faster than its Python equivalent. Interesting issues encountered during the conversion process, optimization methods used, and some parallel programming methods used to further enhance efficiency will be presented.