From ed60190b7e2879193922637fde4a4e0df657dab1 Mon Sep 17 00:00:00 2001 From: "cuijiawei14@huawei.com" Date: Tue, 14 Mar 2023 10:42:08 +0800 Subject: [PATCH] =?UTF-8?q?InitOpenCL=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cuijiawei14@huawei.com --- src/opencl_wrapper.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/opencl_wrapper.cpp b/src/opencl_wrapper.cpp index caf523f..edbd453 100644 --- a/src/opencl_wrapper.cpp +++ b/src/opencl_wrapper.cpp @@ -38,15 +38,17 @@ static const std::vector g_opencl_library_paths = { static std::mutex g_initMutex; static bool isInit = false; +static bool loadSuccess = false; static void *handle_{nullptr}; bool InitOpenCL() { std::lock_guard lock(g_initMutex); if (isInit){ - return true; + return loadSuccess; } - isInit = LoadOpenCLLibrary(&handle_); - return isInit; + isInit = true; + loadSuccess = LoadOpenCLLibrary(&handle_); + return loadSuccess; } bool UnLoadOpenCLLibrary(void *handle) { -- Gitee