Manually sort some includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxlib / gmx_detect_hardware.cpp
index 385bdee82e471b1c36acf403256b7aff1354d9cb..e05629a5122d20532c97e034ed17a15914f5b5c3 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
 
-#include <string>
-#include <vector>
+#include "gromacs/legacyheaders/gmx_detect_hardware.h"
 
 #include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include <string>
+#include <vector>
+
+#include "config.h"
+
 #ifdef HAVE_UNISTD_H
 /* For sysconf */
 #include <unistd.h>
 #endif
+#ifdef GMX_NATIVE_WINDOWS
+#include <windows.h>
+#endif
 
-#include "types/enums.h"
-#include "types/hw_info.h"
-#include "types/commrec.h"
-#include "network.h"
-#include "md_logging.h"
-#include "gmx_cpuid.h"
-#include "gpu_utils.h"
-#include "copyrite.h"
-#include "gmx_detect_hardware.h"
-#include "md_logging.h"
+#include "thread_mpi/threads.h"
 
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/legacyheaders/gmx_cpuid.h"
+#include "gromacs/legacyheaders/gpu_utils.h"
+#include "gromacs/legacyheaders/md_logging.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/legacyheaders/types/enums.h"
+#include "gromacs/legacyheaders/types/hw_info.h"
 #include "gromacs/utility/basenetwork.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/stringutil.h"
 
-#include "thread_mpi/threads.h"
-
-#ifdef GMX_NATIVE_WINDOWS
-#include <windows.h>
-#endif
-
 #ifdef GMX_GPU
 const gmx_bool bGPUBinary = TRUE;
 #else
@@ -536,9 +534,14 @@ static int gmx_count_gpu_dev_unique(const gmx_gpu_info_t *gpu_info,
 
 
 /* Return the number of hardware threads supported by the current CPU.
- * We assume that this is equal with the number of CPUs reported to be
- * online by the OS at the time of the call.
- */
+ * We assume that this is equal with the number of "processors"
+ * reported to be online by the OS at the time of the call. The
+ * definition of "processor" is according to an old POSIX standard.
+ *
+ * Note that the number of hardware threads is generally greater than
+ * the number of cores (e.g. x86 hyper-threading, Power). Managing the
+ * mapping of software threads to hardware threads is managed
+ * elsewhere. */
 static int get_nthreads_hw_avail(FILE gmx_unused *fplog, const t_commrec gmx_unused *cr)
 {
     int ret = 0;
@@ -565,21 +568,20 @@ static int get_nthreads_hw_avail(FILE gmx_unused *fplog, const t_commrec gmx_unu
 #endif /* End of check for sysconf argument values */
 
 #else
-    /* Neither windows nor Unix. No fscking idea how many CPUs we have! */
+    /* Neither windows nor Unix. No fscking idea how many hardware threads we have! */
     ret = -1;
 #endif
 
     if (debug)
     {
-        fprintf(debug, "Detected %d processors, will use this as the number "
-                "of supported hardware threads.\n", ret);
+        fprintf(debug, "Detected %d hardware threads to use.\n", ret);
     }
 
 #ifdef GMX_OPENMP
     if (ret != gmx_omp_get_num_procs())
     {
         md_print_warn(cr, fplog,
-                      "Number of CPUs detected (%d) does not match the number reported by OpenMP (%d).\n"
+                      "Number of hardware threads detected (%d) does not match the number reported by OpenMP (%d).\n"
                       "Consider setting the launch configuration manually!",
                       ret, gmx_omp_get_num_procs());
     }