caffeのスレッド終了関数の呼び出しに対応

This commit is contained in:
lltcggie 2016-07-10 20:09:46 +09:00
parent 1656647163
commit 4bee251c81
4 changed files with 15 additions and 0 deletions

View File

@ -522,8 +522,14 @@ void Waifu2x::quit_liblary()
{ {
g_ConvCcuDNNAlgorithm.Save(); g_ConvCcuDNNAlgorithm.Save();
g_DeconvCcuDNNAlgorithm.Save(); g_DeconvCcuDNNAlgorithm.Save();
caffe::GlobalFinalize();
} }
void Waifu2x::quit_thread_liblary()
{
caffe::ThreadFinalize();
}
Waifu2x::Waifu2x() : mIsInited(false), mNoiseLevel(0), mIsCuda(false), mOutputBlock(nullptr), mOutputBlockSize(0), mGPUNo(0) Waifu2x::Waifu2x() : mIsInited(false), mNoiseLevel(0), mIsCuda(false), mOutputBlock(nullptr), mOutputBlockSize(0), mGPUNo(0)
{} {}

View File

@ -125,6 +125,7 @@ public:
static void init_liblary(int argc, char** argv); static void init_liblary(int argc, char** argv);
static void quit_liblary(); static void quit_liblary();
static void quit_thread_liblary();
// mode: noise or scale or noise_scale or auto_scale // mode: noise or scale or noise_scale or auto_scale
// process: cpu or gpu or cudnn // process: cpu or gpu or cudnn

View File

@ -85,3 +85,9 @@ void Waifu2xDestory(void *waifu2xObj)
delete obj; delete obj;
} }
} }
__declspec(dllexport)
void Waifu2xGlobalDestroy()
{
Waifu2x::quit_liblary();
}

View File

@ -804,6 +804,8 @@ void DialogEvent::ProcessWaifu2x()
} }
} }
Waifu2x::quit_thread_liblary();
const auto ProcessEndTime = std::chrono::system_clock::now(); const auto ProcessEndTime = std::chrono::system_clock::now();
cuDNNCheckTime = cuDNNCheckEndTime - cuDNNCheckStartTime; cuDNNCheckTime = cuDNNCheckEndTime - cuDNNCheckStartTime;