From d30ed1149da417a5a0c76a48ca08c18a0006be52 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Wed, 16 May 2018 12:01:14 +0100 Subject: COMPMID-1119 - Bugfix SIGKILL The problem seems caused by the OpenCL driver that does not release the allocated memory. In order to solve this problem the OpenCL context is destroyed every 5000 tests to force the release of the memory Change-Id: I2135f49d7ff92c7761ec8dba6819db1590e19691 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/131459 Reviewed-by: Georgios Pinitas Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/framework/Framework.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tests/framework/Framework.cpp') diff --git a/tests/framework/Framework.cpp b/tests/framework/Framework.cpp index 81e16c8fb7..fd0afe9d7f 100644 --- a/tests/framework/Framework.cpp +++ b/tests/framework/Framework.cpp @@ -24,6 +24,9 @@ #include "Framework.h" #include "support/ToolchainSupport.h" +#ifdef ARM_COMPUTE_CL +#include "arm_compute/runtime/CL/CLScheduler.h" +#endif /* ARM_COMPUTE_CL */ #include #include @@ -517,7 +520,8 @@ bool Framework::run() const std::chrono::time_point start = std::chrono::high_resolution_clock::now(); - int id = 0; + int id = 0; + int id_run_test = 0; for(auto &test_factory : _test_factories) { @@ -526,7 +530,21 @@ bool Framework::run() if(_test_filter.is_selected(test_info)) { +#ifdef ARM_COMPUTE_CL + // Every 5000 tests, reset the OpenCL context to release the allocated memory + if((id_run_test % 5000) == 0) + { + cl::Context::setDefault(cl::Context()); + CLScheduler::get().set_context(cl::Context()); + CLKernelLibrary::get().clear_programs_cache(); + + cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT)); + CLScheduler::get().set_context(cl::Context::getDefault()); + } +#endif // ARM_COMPUTE_CL run_test(test_info, *test_factory); + + ++id_run_test; } ++id; -- cgit v1.2.1