Hardware reporting now covers all nodes
[alexxy/gromacs.git] / src / gromacs / gmxlib / gmx_cpuid.c
index 9791608f4b61e5059e7297712fa0c20bb46b864a..8e496ea5e64292651b3c02d98f58f422e89b3347 100644 (file)
@@ -289,6 +289,13 @@ static const enum gmx_cpuid_simd compiled_simd = GMX_CPUID_SIMD_NONE;
 #endif
 
 
+enum gmx_cpuid_simd
+gmx_compiled_simd()
+{
+    return compiled_simd;
+}
+
+
 #ifdef GMX_CPUID_X86
 
 /* Execute CPUID on x86 class CPUs. level sets function to exec, and the
@@ -1174,19 +1181,19 @@ gmx_cpuid_formatstring       (gmx_cpuid_t              cpuid,
 
 #ifdef _MSC_VER
     _snprintf(str, n,
-              "Vendor: %s\n"
-              "Brand:  %s\n"
-              "Family: %2d  Model: %2d  Stepping: %2d\n"
-              "Features:",
+              "    Vendor: %s\n"
+              "    Brand:  %s\n"
+              "    Family: %2d  model: %2d  stepping: %2d\n"
+              "    CPU features:",
               gmx_cpuid_vendor_string[gmx_cpuid_vendor(cpuid)],
               gmx_cpuid_brand(cpuid),
               gmx_cpuid_family(cpuid), gmx_cpuid_model(cpuid), gmx_cpuid_stepping(cpuid));
 #else
     snprintf(str, n,
-             "Vendor: %s\n"
-             "Brand:  %s\n"
-             "Family: %2d  Model: %2d  Stepping: %2d\n"
-             "Features:",
+             "    Vendor: %s\n"
+             "    Brand:  %s\n"
+             "    Family: %2d  model: %2d  stepping: %2d\n"
+             "    CPU features:",
              gmx_cpuid_vendor_string[gmx_cpuid_vendor(cpuid)],
              gmx_cpuid_brand(cpuid),
              gmx_cpuid_family(cpuid), gmx_cpuid_model(cpuid), gmx_cpuid_stepping(cpuid));
@@ -1307,34 +1314,14 @@ gmx_cpuid_simd_suggest  (gmx_cpuid_t                 cpuid)
 }
 
 
-
 int
-gmx_cpuid_simd_check(gmx_cpuid_t   cpuid,
-                     FILE *        log,
-                     int           print_to_stderr)
+gmx_cpuid_simd_check(enum gmx_cpuid_simd  simd_suggest,
+                     FILE *               log,
+                     int                  print_to_stderr)
 {
-    int                           rc;
-    char                          str[1024];
-    enum gmx_cpuid_simd           simd;
-
-    simd = gmx_cpuid_simd_suggest(cpuid);
-
-    rc = (simd != compiled_simd);
+    int  rc;
 
-    gmx_cpuid_formatstring(cpuid, str, 1023);
-    str[1023] = '\0';
-
-    if (log != NULL)
-    {
-        fprintf(log,
-                "\nDetecting CPU SIMD instructions.\nPresent hardware specification:\n"
-                "%s"
-                "SIMD instructions most likely to fit this hardware: %s\n"
-                "SIMD instructions selected at GROMACS compile time: %s\n\n",
-                str,
-                gmx_cpuid_simd_string[simd],
-                gmx_cpuid_simd_string[compiled_simd]);
-    }
+    rc = (simd_suggest != compiled_simd);
 
     if (rc != 0)
     {
@@ -1343,14 +1330,14 @@ gmx_cpuid_simd_check(gmx_cpuid_t   cpuid,
             fprintf(log, "\nBinary not matching hardware - you might be losing performance.\n"
                     "SIMD instructions most likely to fit this hardware: %s\n"
                     "SIMD instructions selected at GROMACS compile time: %s\n\n",
-                    gmx_cpuid_simd_string[simd],
+                    gmx_cpuid_simd_string[simd_suggest],
                     gmx_cpuid_simd_string[compiled_simd]);
         }
         if (print_to_stderr)
         {
             fprintf(stderr, "Compiled SIMD instructions: %s (GROMACS could use %s on this machine, which is better)\n",
                     gmx_cpuid_simd_string[compiled_simd],
-                    gmx_cpuid_simd_string[simd]);
+                    gmx_cpuid_simd_string[simd_suggest]);
         }
     }
     return rc;