mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Retire cpu_count()
Set threads number always to 1 at startup and let the user explicitly to chose the number of threads. Also preserve the useful behavior of automatically set "Min Split Depth" according to the requested threads, indeed this parameter is too technical for a casual user, so, when left to zero, we set it on a sensible value. No functional change
This commit is contained in:
committed by
Marco Costalba
parent
408e6ee9b6
commit
a16ba5bbd1
29
src/misc.cpp
29
src/misc.cpp
@@ -24,10 +24,6 @@
|
||||
#include "misc.h"
|
||||
#include "thread.h"
|
||||
|
||||
#ifdef __hpux
|
||||
# include <sys/pstat.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
/// Version number. If Version is left empty, then compile date, in the
|
||||
@@ -169,31 +165,6 @@ std::ostream& operator<<(std::ostream& os, SyncCout sc) {
|
||||
void start_logger(bool b) { Logger::start(b); }
|
||||
|
||||
|
||||
/// cpu_count() tries to detect the number of CPU cores
|
||||
|
||||
int cpu_count() {
|
||||
|
||||
#ifdef _WIN32
|
||||
SYSTEM_INFO s;
|
||||
GetSystemInfo(&s);
|
||||
return s.dwNumberOfProcessors;
|
||||
#else
|
||||
|
||||
# if defined(_SC_NPROCESSORS_ONLN)
|
||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
||||
# elif defined(__hpux)
|
||||
struct pst_dynamic psd;
|
||||
if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1)
|
||||
return 1;
|
||||
return psd.psd_proc_cnt;
|
||||
# else
|
||||
return 1;
|
||||
# endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// timed_wait() waits for msec milliseconds. It is mainly an helper to wrap
|
||||
/// conversion from milliseconds to struct timespec, as used by pthreads.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user