APS Logo

Contending with concurrency across programming languages

ORAL

Abstract

Leveraging modern computational resources efficiently takes many forms in computational physics. Algorithmic requirements determine the maximal parallelism, typically bound by Amdahl's law. At a higher level, computational programming language features and internal consistency models also provide barriers to effective usage. The ability to spawn threads and processes is key to both concurrency and parallelism. A process requires more explicit sharing of data (e.g. MPI, the message passing interface) than a thread (which shares memory). A data race is one which may occur when a shared structure is modified without ensuring isolation. Until recently, Python would hold a Global Interpreter Lock (GIL) to prevent data races during accessing internal data; which has now been experimentally removed in 3.13. This has downstream consequences for other shared memory parallelism primitives, as for example those exposed in newer Fortran standards like do concurrent. Herein we discuss the interactions between Python and Fortran parallel constructs when consistency of access must be ensured by the programmer; along with the pitfalls and gains which accessible from the added complexity of managing multiple threads from Python and Fortran. It shall be instructive to compare the more mature consistency primitives within the C++ standard library (locks, mutexs, guards) to obtain maximal performance from modern hardware, and build systems for cross-language software will also be briefly discussed.

Publication: 1. "Concurrency without guardrails, no-GIL Python and Fortran", Rohit Goswami, The International Journal of High Performance Computing Applications [to be submitted]

Presenters

  • Rohit Goswami

    University of Iceland

Authors

  • Rohit Goswami

    University of Iceland