From 6db0ff5b4bb49f834c7caa532a7feab228df10f9 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 5 Jan 2018 10:59:12 +0000 Subject: COMPMID-771 Allow examples to be profiled Change-Id: I180281e796e1670b9ad391d82d66ecde0119ef78 Note: this is for internal use only which is why I think the hackiness of RunExample.cpp is acceptable. Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/115154 Tested-by: Jenkins Reviewed-by: Pablo Tello Reviewed-by: Georgios Pinitas --- arm_compute/runtime/CL/CLScheduler.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'arm_compute/runtime/CL/CLScheduler.h') diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h index 3985829a49..c76ee3f273 100644 --- a/arm_compute/runtime/CL/CLScheduler.h +++ b/arm_compute/runtime/CL/CLScheduler.h @@ -72,23 +72,30 @@ public: */ void default_init(ICLTuner *cl_tuner = nullptr) { -#if defined(ARM_COMPUTE_DEBUG_ENABLED) - // Create a cl_context with a printf_callback and user specified buffer size. - cl_context_properties properties[] = + if(!_is_initialised) { - // Enable a printf callback function for this context. - CL_PRINTF_CALLBACK_ARM, reinterpret_cast(printf_callback), - // Request a minimum printf buffer size of 4MB for devices in the - // context that support this extension. - CL_PRINTF_BUFFERSIZE_ARM, static_cast(0x100000), - CL_CONTEXT_PLATFORM, reinterpret_cast(cl::Platform::get()()), - 0 - }; - cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT, properties)); +#if defined(ARM_COMPUTE_DEBUG_ENABLED) + // Create a cl_context with a printf_callback and user specified buffer size. + cl_context_properties properties[] = + { + // Enable a printf callback function for this context. + CL_PRINTF_CALLBACK_ARM, reinterpret_cast(printf_callback), + // Request a minimum printf buffer size of 4MB for devices in the + // context that support this extension. + CL_PRINTF_BUFFERSIZE_ARM, static_cast(0x100000), + CL_CONTEXT_PLATFORM, reinterpret_cast(cl::Platform::get()()), + 0 + }; + cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT, properties)); #endif // defined(ARM_COMPUTE_DEBUG_ENABLED) - CLKernelLibrary::get().init("./cl_kernels/", cl::Context::getDefault(), cl::Device::getDefault()); - init(cl::Context::getDefault(), cl::CommandQueue::getDefault(), cl::Device::getDefault(), cl_tuner); + CLKernelLibrary::get().init("./cl_kernels/", cl::Context::getDefault(), cl::Device::getDefault()); + init(cl::Context::getDefault(), cl::CommandQueue::getDefault(), cl::Device::getDefault(), cl_tuner); + } + else + { + _cl_tuner = cl_tuner; + } } /** Schedule the execution of the passed kernel if possible. * -- cgit v1.2.1