Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / gmx_thread_affinity.c
index 75e277999be1fcef991d5d14a30d2456a8449214..e4cc7386e1324c5e825e251ec8f25460f38cb1f8 100644 (file)
@@ -384,6 +384,9 @@ gmx_check_thread_affinity_set(FILE            *fplog,
     int       i, ret, cpu_count, cpu_set;
     gmx_bool  bAllSet;
 #endif
+#ifdef GMX_LIB_MPI
+    gmx_bool  bAllSet_All;
+#endif
 
     assert(hw_opt);
     if (!bAfterOpenmpInit)
@@ -458,6 +461,11 @@ gmx_check_thread_affinity_set(FILE            *fplog,
         bAllSet = bAllSet && (CPU_ISSET(i, &mask_current) != 0);
     }
 
+#ifdef GMX_LIB_MPI
+    MPI_Allreduce(&bAllSet, &bAllSet_All, 1, MPI_INT, MPI_LAND, MPI_COMM_WORLD);
+    bAllSet = bAllSet_All;
+#endif
+
     if (!bAllSet)
     {
         if (hw_opt->thread_affinity == threadaffAUTO)