1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

[cluster] Avoid TT saving our own TT entries.

avoid saving to TT the part of the receive buffer that actually originates from the same rank.

Now, on 1 mpi rank, we have the same bench as the non-mpi code on 1 thread.
This commit is contained in:
Joost VandeVondele 2018-12-06 17:28:35 +01:00 committed by Stéphane Nicolet
parent 271181bb31
commit 7af3f4da7a
2 changed files with 17 additions and 8 deletions

View file

@ -362,7 +362,7 @@ ifeq ($(CXX),$(filter $(CXX),mpicxx mpic++ mpiCC mpicxx.mpich))
endif
ifeq ($(mpi),yes)
CXXFLAGS += -DUSE_MPI
CXXFLAGS += -DUSE_MPI -Wno-cast-qual
endif

View file

@ -187,7 +187,8 @@ void save(Thread* thread, TTEntry* tte,
}
// Communicate on main search thread
if (thread == Threads.main()) {
if (thread == Threads.main())
{
static MPI_Request req = MPI_REQUEST_NULL;
static TTSendBuffer<TTSendBufferSize> send_buff = {};
int flag;
@ -198,12 +199,20 @@ void save(Thread* thread, TTEntry* tte,
MPI_Test(&req, &flag, MPI_STATUS_IGNORE);
// Current communication is complete
if (flag) {
// Save all recieved entries
for (auto&& e : TTBuff) {
replace_tte = TT.probe(e.first, found);
replace_tte->save(e.first, e.second.value(), e.second.bound(), e.second.depth(),
e.second.move(), e.second.eval());
if (flag)
{
// Save all received entries (except ours)
for (size_t irank = 0; irank < size_t(size()) ; ++irank)
{
if (irank == size_t(rank()))
continue;
for (size_t i = irank * TTSendBufferSize ; i < (irank + 1) * TTSendBufferSize; ++i)
{
auto&& e = TTBuff[i];
replace_tte = TT.probe(e.first, found);
replace_tte->save(e.first, e.second.value(), e.second.bound(), e.second.depth(),
e.second.move(), e.second.eval());
}
}
// Reset send buffer