libgfortran: Handle images killed by signal in coarray teams
libgfortran now correctly handles coarray images terminated by signals, preventing deadlocks and ensuring proper status reporting.
This commit resolves a deadlock issue in libgfortran’s coarray implementation where an image killed by a signal would not properly detach from its teams’ barriers. This left other images blocked indefinitely. The fix introduces a mechanism where teams register with a supervisor, allowing it to detect and process killed images, simulating their detachment from barriers. This ensures that active images can proceed and correctly report the status of failed images.
In Details
In libgfortran's coarray implementation (caf_shmem.c), images terminated by signals (not STOP or FAIL IMAGE) previously failed to deregister from team barriers. This caused deadlocks in other images waiting on synchronization. This commit enhances _gfortran_caf_form_team to register each team with a supervisor. The supervisor can then walk the registered teams and simulate the necessary barrier detachments for killed images. Additionally, synchronization routines (_gfortran_caf_sync_all, _gfortran_caf_sync_team) and collective subroutines are adjusted to correctly report the statu…
- coarray
- A Fortran language feature providing built-in support for parallel programming by allowing direct access to data on other processing units (images).
- image
- In Fortran coarrays, an 'image' is an independent sequential execution stream, analogous to a process or thread.
- team
- A subset of images within a coarray program, allowing for more flexible and structured parallel communication patterns.
- barrier
- A synchronization primitive that halts all participating images until every image has reached the barrier.
- supervisor
- In this context, a designated image responsible for coordinating actions or managing state across multiple teams or images, especially for error handling.
- SYNC ALL
- A Fortran coarray statement that synchronizes all images in the program.
- SYNC TEAM
- A Fortran coarray statement that synchronizes all images within a specified team.
- STAT=
- An optional argument in Fortran coarray synchronization statements that specifies a variable to receive the status of the operation, including image failure.