mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 19:46:55 +08:00
コンパイルエラーを修正した
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#if defined(EVAL_LEARN)
|
||||
|
||||
#include <filesystem>
|
||||
#include <random>
|
||||
|
||||
#include "learn.h"
|
||||
@@ -170,7 +171,7 @@ struct SfenWriter
|
||||
// sfen_buffers_poolに積んでおけばあとはworkerがよきに計らってくれる。
|
||||
|
||||
// sfen_buffers_poolの内容を変更するときはmutexのlockが必要。
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
sfen_buffers_pool.push_back(buf);
|
||||
|
||||
buf = nullptr;
|
||||
@@ -181,7 +182,7 @@ struct SfenWriter
|
||||
// 自分のスレッド用のバッファに残っている分をファイルに書き出すためのバッファに移動させる。
|
||||
void finalize(size_t thread_id)
|
||||
{
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
|
||||
auto& buf = sfen_buffers[thread_id];
|
||||
|
||||
@@ -214,7 +215,7 @@ struct SfenWriter
|
||||
{
|
||||
vector<PSVector*> buffers;
|
||||
{
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
|
||||
// まるごとコピー
|
||||
buffers = sfen_buffers_pool;
|
||||
@@ -299,7 +300,7 @@ private:
|
||||
std::vector<PSVector*> sfen_buffers_pool;
|
||||
|
||||
// sfen_buffers_poolにアクセスするときに必要なmutex
|
||||
Mutex mutex;
|
||||
std::mutex mutex;
|
||||
|
||||
// 書きだした局面の数
|
||||
uint64_t sfen_write_count = 0;
|
||||
@@ -1293,7 +1294,7 @@ struct SfenReader
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
// ファイルバッファから充填できたなら、それで良し。
|
||||
if (packed_sfens_pool.size() != 0)
|
||||
{
|
||||
@@ -1410,7 +1411,7 @@ struct SfenReader
|
||||
|
||||
// sfensの用意が出来たので、折を見てコピー
|
||||
{
|
||||
std::unique_lock<Mutex> lk(mutex);
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
|
||||
// ポインタをコピーするだけなのでこの時間は無視できるはず…。
|
||||
// packed_sfens_poolの内容を変更するのでmutexのlockが必要。
|
||||
@@ -1479,7 +1480,7 @@ protected:
|
||||
std::vector<PSVector*> packed_sfens;
|
||||
|
||||
// packed_sfens_poolにアクセスするときのmutex
|
||||
Mutex mutex;
|
||||
std::mutex mutex;
|
||||
|
||||
// sfenのpool。fileから読み込むworker threadはここに補充する。
|
||||
// 各worker threadはここから自分のpacked_sfens[thread_id]に充填する。
|
||||
@@ -2704,7 +2705,7 @@ void learn(Position&, istringstream& is)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
namespace sys = std::tr2::sys;
|
||||
namespace sys = std::filesystem;
|
||||
sys::path p(kif_base_dir); // 列挙の起点
|
||||
std::for_each(sys::directory_iterator(p), sys::directory_iterator(),
|
||||
[&](const sys::path& p) {
|
||||
|
||||
@@ -59,7 +59,7 @@ struct MultiThink
|
||||
// 局面を生成する場合などは、局面を生成するタイミングでこの関数を呼び出すようにしないと、
|
||||
// 生成した局面数と、カウンターの値が一致しなくなってしまうので注意すること。
|
||||
uint64_t get_next_loop_count() {
|
||||
std::unique_lock<Mutex> lk(loop_mutex);
|
||||
std::unique_lock<std::mutex> lk(loop_mutex);
|
||||
if (loop_count >= loop_max)
|
||||
return UINT64_MAX;
|
||||
return loop_count++;
|
||||
@@ -67,12 +67,12 @@ struct MultiThink
|
||||
|
||||
// [ASYNC] 処理した個数を返す用。呼び出されるごとにインクリメントされたカウンターが返る。
|
||||
uint64_t get_done_count() {
|
||||
std::unique_lock<Mutex> lk(loop_mutex);
|
||||
std::unique_lock<std::mutex> lk(loop_mutex);
|
||||
return ++done_count;
|
||||
}
|
||||
|
||||
// worker threadがI/Oにアクセスするときのmutex
|
||||
Mutex io_mutex;
|
||||
std::mutex io_mutex;
|
||||
|
||||
protected:
|
||||
// 乱数発生器本体
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
std::atomic<uint64_t> done_count;
|
||||
|
||||
// ↑の変数を変更するときのmutex
|
||||
Mutex loop_mutex;
|
||||
std::mutex loop_mutex;
|
||||
|
||||
// スレッドの終了フラグ。
|
||||
// vector<bool>にすると複数スレッドから書き換えようとしたときに正しく反映されないことがある…はず。
|
||||
@@ -117,7 +117,7 @@ struct TaskDispatcher
|
||||
// [ASYNC] taskを一つ積む。
|
||||
void push_task_async(Task task)
|
||||
{
|
||||
std::unique_lock<Mutex> lk(task_mutex);
|
||||
std::unique_lock<std::mutex> lk(task_mutex);
|
||||
tasks.push_back(task);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ protected:
|
||||
// [ASYNC] taskを一つ取り出す。on_idle()から呼び出される。
|
||||
Task get_task_async()
|
||||
{
|
||||
std::unique_lock<Mutex> lk(task_mutex);
|
||||
std::unique_lock<std::mutex> lk(task_mutex);
|
||||
if (tasks.size() == 0)
|
||||
return nullptr;
|
||||
Task task = *tasks.rbegin();
|
||||
@@ -143,7 +143,7 @@ protected:
|
||||
}
|
||||
|
||||
// tasksにアクセスするとき用のmutex
|
||||
Mutex task_mutex;
|
||||
std::mutex task_mutex;
|
||||
};
|
||||
|
||||
#endif // defined(EVAL_LEARN) && defined(YANEURAOU_2018_OTAFUKU_ENGINE)
|
||||
|
||||
Reference in New Issue
Block a user