cuDNNのアルゴリズムデータ保存パスが意図しない物になることがあるのを修正

This commit is contained in:
lltcggie 2016-07-07 01:25:04 +09:00
parent da104e7f3b
commit d8e7f26e6f

View File

@ -561,13 +561,32 @@ Waifu2x::eWaifu2xError Waifu2x::Init(const eWaifu2xModelType mode, const int noi
const auto cuDNNCheckEndTime = std::chrono::system_clock::now(); const auto cuDNNCheckEndTime = std::chrono::system_clock::now();
boost::filesystem::path exe_dir_path(ExeDir); if (Process == "cudnn")
if (exe_dir_path.is_absolute())
exe_dir_path = exe_dir_path.branch_path();
if (Process == "cudnn" && boost::filesystem::exists(exe_dir_path))
{ {
const boost::filesystem::path cudnn_data_dir_path(exe_dir_path / "cudnn_data"); // exeのディレクトリにcuDNNのアルゴリズムデータ保存
boost::filesystem::path cudnn_data_base_dir_path(ExeDir);
if (cudnn_data_base_dir_path.is_relative())
cudnn_data_base_dir_path = boost::filesystem::system_complete(cudnn_data_base_dir_path);
if (!boost::filesystem::is_directory(cudnn_data_base_dir_path))
cudnn_data_base_dir_path = cudnn_data_base_dir_path.branch_path();
if (!boost::filesystem::exists(cudnn_data_base_dir_path))
{
// exeのディレクトリが取得できなければカレントディレクトリに保存
cudnn_data_base_dir_path = boost::filesystem::current_path();
if (cudnn_data_base_dir_path.is_relative())
cudnn_data_base_dir_path = boost::filesystem::system_complete(cudnn_data_base_dir_path);
if (!boost::filesystem::exists(cudnn_data_base_dir_path))
cudnn_data_base_dir_path = "./";
}
if (boost::filesystem::exists(cudnn_data_base_dir_path))
{
const boost::filesystem::path cudnn_data_dir_path(cudnn_data_base_dir_path / "cudnn_data");
bool isOK = false; bool isOK = false;
if (boost::filesystem::exists(cudnn_data_dir_path)) if (boost::filesystem::exists(cudnn_data_dir_path))
@ -600,6 +619,7 @@ Waifu2x::eWaifu2xError Waifu2x::Init(const eWaifu2xModelType mode, const int noi
} }
} }
} }
}
const boost::filesystem::path mode_dir_path(GetModeDirPath(model_dir)); const boost::filesystem::path mode_dir_path(GetModeDirPath(model_dir));
if (!boost::filesystem::exists(mode_dir_path)) if (!boost::filesystem::exists(mode_dir_path))