affinity setting broken with MPI
With the MPI builds (i.e GMX_MPI=ON) the affinity setting seems to be broken. While affinity setting works with the exact same build and launch configuration when compiling with thread_mpi, with MPI I get the warning suggesting that affinity setting is not supported by the current platform.
This means that
TMPI_SETAFFINITY_SUPPORT_NO which suggests that
HAVE_PTHREAD_SETAFFINITY is not defined. I suspect a bug in the build system.
As this bug will result in no affinities set in all MPI runs, it will cause considerable performance regression - especially at high parallelization where OpenMP is used.
Comprehensive hwinfo structure concurrency fix.
The hwinfo structure and structures contained therein are inherently
global to any mdrun processes/ranks. This patch makes sure that
- The hwinfo structure is shared among all threads
- Only one thread creates a hwinfo structure
- The hwinfo structure is safe to read for all threads after they
In addition, it fixes the detection for pthread_setaffinity in thread_mpi.
This fixes concurrency issues with thread affinity settings with or
without MPI, and makes runner.c slightly easier to read because the
concurrency logic is pushed to gmx_detect_hardware.c
Note that #1254 issue 3 seems to be an OpenMPI bug.