From 15326145ce4fc939fb31cfe44d966b411f6d0678 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Thu, 28 Nov 2013 19:35:29 +0100 Subject: [PATCH] Fixed zero hardware thread count 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gromacs/gmxlib/gmx_detect_hardware.c b/src/gromacs/gmxlib/gmx_detect_hardware.c index 2638656aa4..48e45e3106 100644 --- a/src/gromacs/gmxlib/gmx_detect_hardware.c +++ b/src/gromacs/gmxlib/gmx_detect_hardware.c @@ -40,6 +40,11 @@ #include #include +#ifdef HAVE_UNISTD_H +/* For sysconf */ +#include +#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 -- 2.22.0