From 4bee251c810898906eac679d155f1566e92b86c8 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Sun, 10 Jul 2016 20:09:46 +0900 Subject: [PATCH] =?UTF-8?q?caffe=E3=81=AE=E3=82=B9=E3=83=AC=E3=83=83?= =?UTF-8?q?=E3=83=89=E7=B5=82=E4=BA=86=E9=96=A2=E6=95=B0=E3=81=AE=E5=91=BC?= =?UTF-8?q?=E3=81=B3=E5=87=BA=E3=81=97=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/waifu2x.cpp | 6 ++++++ common/waifu2x.h | 1 + waifu2x-caffe-dll/Source.cpp | 6 ++++++ waifu2x-caffe-gui/MainDialog.cpp | 2 ++ 4 files changed, 15 insertions(+) diff --git a/common/waifu2x.cpp b/common/waifu2x.cpp index 6e22a1c..d2bb3c9 100644 --- a/common/waifu2x.cpp +++ b/common/waifu2x.cpp @@ -522,8 +522,14 @@ void Waifu2x::quit_liblary() { g_ConvCcuDNNAlgorithm.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) {} diff --git a/common/waifu2x.h b/common/waifu2x.h index eecb5be..6d93080 100644 --- a/common/waifu2x.h +++ b/common/waifu2x.h @@ -125,6 +125,7 @@ public: static void init_liblary(int argc, char** argv); static void quit_liblary(); + static void quit_thread_liblary(); // mode: noise or scale or noise_scale or auto_scale // process: cpu or gpu or cudnn diff --git a/waifu2x-caffe-dll/Source.cpp b/waifu2x-caffe-dll/Source.cpp index b532595..bb4a2ff 100644 --- a/waifu2x-caffe-dll/Source.cpp +++ b/waifu2x-caffe-dll/Source.cpp @@ -85,3 +85,9 @@ void Waifu2xDestory(void *waifu2xObj) delete obj; } } + +__declspec(dllexport) +void Waifu2xGlobalDestroy() +{ + Waifu2x::quit_liblary(); +} diff --git a/waifu2x-caffe-gui/MainDialog.cpp b/waifu2x-caffe-gui/MainDialog.cpp index 3c8a4b1..04691a0 100644 --- a/waifu2x-caffe-gui/MainDialog.cpp +++ b/waifu2x-caffe-gui/MainDialog.cpp @@ -804,6 +804,8 @@ void DialogEvent::ProcessWaifu2x() } } + Waifu2x::quit_thread_liblary(); + const auto ProcessEndTime = std::chrono::system_clock::now(); cuDNNCheckTime = cuDNNCheckEndTime - cuDNNCheckStartTime;