mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +00:00
Always flush sfen writer at the end of gensfen and when it is destroyed.
This commit is contained in:
+13
-3
@@ -61,6 +61,8 @@ namespace Learner
|
|||||||
|
|
||||||
~SfenWriter()
|
~SfenWriter()
|
||||||
{
|
{
|
||||||
|
flush();
|
||||||
|
|
||||||
finished = true;
|
finished = true;
|
||||||
file_worker_thread.join();
|
file_worker_thread.join();
|
||||||
output_file_stream.reset();
|
output_file_stream.reset();
|
||||||
@@ -105,8 +107,16 @@ namespace Learner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flush()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < sfen_buffers.size(); ++i)
|
||||||
|
{
|
||||||
|
flush(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Move what remains in the buffer for your thread to a buffer for writing to a file.
|
// Move what remains in the buffer for your thread to a buffer for writing to a file.
|
||||||
void finalize(size_t thread_id)
|
void flush(size_t thread_id)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(mutex);
|
std::unique_lock<std::mutex> lk(mutex);
|
||||||
|
|
||||||
@@ -357,6 +367,8 @@ namespace Learner
|
|||||||
});
|
});
|
||||||
Threads.wait_for_workers_finished();
|
Threads.wait_for_workers_finished();
|
||||||
|
|
||||||
|
sfen_writer.flush();
|
||||||
|
|
||||||
if (limit % REPORT_STATS_EVERY != 0)
|
if (limit % REPORT_STATS_EVERY != 0)
|
||||||
{
|
{
|
||||||
report(limit, limit % REPORT_STATS_EVERY);
|
report(limit, limit % REPORT_STATS_EVERY);
|
||||||
@@ -842,8 +854,6 @@ namespace Learner
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sfen_writer.finalize(th.thread_idx());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_gensfen_search_limits()
|
void set_gensfen_search_limits()
|
||||||
|
|||||||
Reference in New Issue
Block a user