mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
[cluster] Make bench compatible
Fix one TODO. Takes care of output from bench. Sum nodes over ranks.
This commit is contained in:
parent
9cd2c817db
commit
e526c5aa52
3 changed files with 16 additions and 7 deletions
|
@ -266,6 +266,12 @@ void pick_moves(MoveInfo& mi) {
|
||||||
MPI_Bcast(&mi, 1, MIDatatype, 0, MoveComm);
|
MPI_Bcast(&mi, 1, MIDatatype, 0, MoveComm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sum(uint64_t& val) {
|
||||||
|
|
||||||
|
const uint64_t send = val;
|
||||||
|
MPI_Reduce(&send, &val, 1, MPI_UINT64_T, MPI_SUM, 0, MoveComm);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_MPI
|
#endif // USE_MPI
|
||||||
|
|
|
@ -74,6 +74,7 @@ int rank();
|
||||||
inline bool is_root() { return rank() == 0; }
|
inline bool is_root() { return rank() == 0; }
|
||||||
void save(Thread* thread, TTEntry* tte, Key k, Value v, Bound b, Depth d, Move m, Value ev);
|
void save(Thread* thread, TTEntry* tte, Key k, Value v, Bound b, Depth d, Move m, Value ev);
|
||||||
void pick_moves(MoveInfo& mi);
|
void pick_moves(MoveInfo& mi);
|
||||||
|
void sum(uint64_t& val);
|
||||||
void sync_start();
|
void sync_start();
|
||||||
void sync_stop();
|
void sync_stop();
|
||||||
|
|
||||||
|
@ -94,6 +95,7 @@ inline void save(Thread* thread, TTEntry* tte, Key k, Value v, Bound b, Depth d,
|
||||||
tte->save(k, v, b, d, m, ev);
|
tte->save(k, v, b, d, m, ev);
|
||||||
}
|
}
|
||||||
inline void pick_moves(MoveInfo&) { }
|
inline void pick_moves(MoveInfo&) { }
|
||||||
|
void sum(uint64_t& val) { }
|
||||||
inline void sync_start() { }
|
inline void sync_start() { }
|
||||||
inline void sync_stop() { }
|
inline void sync_stop() { }
|
||||||
|
|
||||||
|
|
15
src/uci.cpp
15
src/uci.cpp
|
@ -141,8 +141,6 @@ namespace {
|
||||||
// a list of UCI commands is setup according to bench parameters, then
|
// a list of UCI commands is setup according to bench parameters, then
|
||||||
// it is run one by one printing a summary at the end.
|
// it is run one by one printing a summary at the end.
|
||||||
|
|
||||||
// TODO make (output?) cluster compatible
|
|
||||||
|
|
||||||
void bench(Position& pos, istream& args, StateListPtr& states) {
|
void bench(Position& pos, istream& args, StateListPtr& states) {
|
||||||
|
|
||||||
string token;
|
string token;
|
||||||
|
@ -160,7 +158,8 @@ namespace {
|
||||||
|
|
||||||
if (token == "go")
|
if (token == "go")
|
||||||
{
|
{
|
||||||
cerr << "\nPosition: " << cnt++ << '/' << num << endl;
|
if (Cluster::is_root())
|
||||||
|
cerr << "\nPosition: " << cnt++ << '/' << num << endl;
|
||||||
go(pos, is, states);
|
go(pos, is, states);
|
||||||
Threads.main()->wait_for_search_finished();
|
Threads.main()->wait_for_search_finished();
|
||||||
nodes += Threads.nodes_searched();
|
nodes += Threads.nodes_searched();
|
||||||
|
@ -174,10 +173,12 @@ namespace {
|
||||||
|
|
||||||
dbg_print(); // Just before exiting
|
dbg_print(); // Just before exiting
|
||||||
|
|
||||||
cerr << "\n==========================="
|
Cluster::sum(nodes);
|
||||||
<< "\nTotal time (ms) : " << elapsed
|
if (Cluster::is_root())
|
||||||
<< "\nNodes searched : " << nodes
|
cerr << "\n==========================="
|
||||||
<< "\nNodes/second : " << 1000 * nodes / elapsed << endl;
|
<< "\nTotal time (ms) : " << elapsed
|
||||||
|
<< "\nNodes searched : " << nodes
|
||||||
|
<< "\nNodes/second : " << 1000 * nodes / elapsed << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue