mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 21:52:49 +00:00
cuDNNのアルゴリズムデータ保存パスが意図しない物になることがあるのを修正
This commit is contained in:
parent
da104e7f3b
commit
d8e7f26e6f
@ -561,42 +561,62 @@ 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);
|
||||||
|
|
||||||
bool isOK = false;
|
if (!boost::filesystem::is_directory(cudnn_data_base_dir_path))
|
||||||
if (boost::filesystem::exists(cudnn_data_dir_path))
|
cudnn_data_base_dir_path = cudnn_data_base_dir_path.branch_path();
|
||||||
isOK = true;
|
|
||||||
|
|
||||||
if (!isOK)
|
if (!boost::filesystem::exists(cudnn_data_base_dir_path))
|
||||||
{
|
{
|
||||||
boost::system::error_code error;
|
// exeのディレクトリが取得できなければカレントディレクトリに保存
|
||||||
const bool result = boost::filesystem::create_directory(cudnn_data_dir_path, error);
|
|
||||||
if (result && !error)
|
cudnn_data_base_dir_path = boost::filesystem::current_path();
|
||||||
isOK = true;
|
|
||||||
|
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(isOK)
|
if (boost::filesystem::exists(cudnn_data_base_dir_path))
|
||||||
{
|
{
|
||||||
cudaDeviceProp prop;
|
const boost::filesystem::path cudnn_data_dir_path(cudnn_data_base_dir_path / "cudnn_data");
|
||||||
if (cudaGetDeviceProperties(&prop, mGPUNo) == cudaSuccess)
|
|
||||||
|
bool isOK = false;
|
||||||
|
if (boost::filesystem::exists(cudnn_data_dir_path))
|
||||||
|
isOK = true;
|
||||||
|
|
||||||
|
if (!isOK)
|
||||||
{
|
{
|
||||||
std::string conv_filename(prop.name);
|
boost::system::error_code error;
|
||||||
conv_filename += " conv ";
|
const bool result = boost::filesystem::create_directory(cudnn_data_dir_path, error);
|
||||||
|
if (result && !error)
|
||||||
|
isOK = true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string deconv_filename(prop.name);
|
if (isOK)
|
||||||
deconv_filename += " deconv ";
|
{
|
||||||
|
cudaDeviceProp prop;
|
||||||
|
if (cudaGetDeviceProperties(&prop, mGPUNo) == cudaSuccess)
|
||||||
|
{
|
||||||
|
std::string conv_filename(prop.name);
|
||||||
|
conv_filename += " conv ";
|
||||||
|
|
||||||
const boost::filesystem::path conv_data_path = cudnn_data_dir_path / conv_filename;
|
std::string deconv_filename(prop.name);
|
||||||
const boost::filesystem::path deconv_data_path = cudnn_data_dir_path / deconv_filename;
|
deconv_filename += " deconv ";
|
||||||
|
|
||||||
g_ConvCcuDNNAlgorithm.SetDataPath(conv_data_path.string());
|
const boost::filesystem::path conv_data_path = cudnn_data_dir_path / conv_filename;
|
||||||
g_DeconvCcuDNNAlgorithm.SetDataPath(deconv_data_path.string());
|
const boost::filesystem::path deconv_data_path = cudnn_data_dir_path / deconv_filename;
|
||||||
|
|
||||||
|
g_ConvCcuDNNAlgorithm.SetDataPath(conv_data_path.string());
|
||||||
|
g_DeconvCcuDNNAlgorithm.SetDataPath(deconv_data_path.string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user