New verification check for "Thread Safety"


Thread safety is critical when using interatomic models with OpenMP style threading. OpenKIM does not currently support threading at the model level (i.e. parallel computation of the energy and forces of a single configuration). However, OpenKIM models can be run in parallel to perform independent calculations. This can be done using either a distributed memory MPI approach (as done for example when using a KIM model with LAMMPS) or a shared memory OpenMP approach using multiple threads. In order for a KIM model to work correctly with OpenMP threading it must not perform operations that could be corrupted if performed simultaneously by multiple thread. An example is access or modification of static (persistent) memory.

To examine whether a model is safe for threading, the thread safety verification check (VC) creates a number of independent random configurations of different size and composition and runs them in parallel using multiple threads. The results much match those obtained in preliminary serial calculations. It is important to point out that it is impossible to guarantee thread safety with a check of this kind due to the inherent randomness of race conditions in unsafe code. To be certain, the model code must be read and analyzed carefully. However, this VC does provide some assurance that the model is safe if it passes, and definitely indicates a problem if it does not.

The results for the threads safety VC are presented here, and on the model pages of individual Open KIM Models (as an example, see here). VC grades are accompanied by a detailed report and data providing more information on the model. For more information, see About VCs.

VCs are written in Python and make use of the Atomic Simulation Environment (ASE). We welcome the contribution of new VCs. If you have an idea, Contact us!