Fix race condition in GPU X halo exchange with GPU update
authorAlan Gray <alangraygerrit@gmail.com>
Sat, 2 Nov 2019 19:24:43 +0000 (12:24 -0700)
committerMark Abraham <mark.j.abraham@gmail.com>
Mon, 25 Nov 2019 21:01:11 +0000 (22:01 +0100)
commit04c94501888fe7af94147a2ceb5beceab63a265d
treecc2403d66bc9e9ec20e167ecf92cbde169376ec2
parent0efd736db1368466bb2f7c54f567a1128bbdbed8
Fix race condition in GPU X halo exchange with GPU update

When the GPU Update featured is enabled on multi-GPU with the GPU halo
exchange feature, it was possible that the GPU receiving the halo data
would still be working on the previous timestep and writing to the
same coordinate buffer in the GPU update, causing a race
condition. This change replaces the pre-existing synchronization
mechanism of a MPI Send/Recv of a boolean flag with the same but
exchanging the events that are recorded when the coordinates are ready
on the device. The remote event is then enqueued to the stream that
the GPU uses for pushing the data, satisfying the dependency of the
push on the remote update being completed on the GPU.

Change-Id: Ie16a93dcc3064d73da1e560d82b4e76870d03e52
src/gromacs/domdec/gpuhaloexchange_impl.cu
src/gromacs/domdec/gpuhaloexchange_impl.cuh