Fixed zero hardware thread count
authorBerk Hess <hess@kth.se>
Thu, 28 Nov 2013 18:35:29 +0000 (19:35 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 1 Dec 2013 12:08:58 +0000 (13:08 +0100)
A missing include caused sysconf not to be called, which lead
to the hardware thread count being zero on most non-Windows systems.

Change-Id: I102c04f494f2946725bb5714482cb861aa8f69fc

src/gromacs/gmxlib/gmx_detect_hardware.c

index 2638656aa48399206c368aa73b59a562520c92b7..48e45e3106b7d0de9d4065eb328376a938372da6 100644 (file)
 #include <assert.h>
 #include <string.h>
 
+#ifdef HAVE_UNISTD_H
+/* For sysconf */
+#include <unistd.h>
+#endif
+
 #include "types/enums.h"
 #include "types/hw_info.h"
 #include "types/commrec.h"
@@ -497,6 +502,8 @@ static int get_nthreads_hw_avail(FILE *fplog, const t_commrec *cr)
     ret = sysconf(_SC_NPROCESSORS_CONF);
 #elif defined(_SC_NPROC_CONF)
     ret = sysconf(_SC_NPROC_CONF);
+#else
+#warning "No valid sysconf argument value found. Executables will not be able to determine the number of hardware threads: mdrun will use 1 thread by default!"
 #endif /* End of check for sysconf argument values */
 
 #else