aboutsummaryrefslogtreecommitdiff
path: root/tests/benchmark_examples
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2019-01-22 12:59:26 +0000
committerPablo Marquez <pablo.tello@arm.com>2019-02-01 17:01:34 +0000
commitb7c308a1ad32af4198dcc7eaa73f44fef27dc8fc (patch)
tree91e72925dcdaa8354be1b4a7e9cf2c0b16a43934 /tests/benchmark_examples
parentf8b652052960e19d2d2d858600780b594d108cc8 (diff)
downloadComputeLibrary-b7c308a1ad32af4198dcc7eaa73f44fef27dc8fc.tar.gz
COMPMID-1887: Fixed segfault in validation tests.
Added the option to initialise the CLScheduler with an external cl::Context. This allows more control over the order of destruction of the static members which caused the suite to segfault. Change-Id: I0a90f12cc39daf1fd5ab842a5584986785694b35 Reviewed-on: https://review.mlplatform.org/550 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Diffstat (limited to 'tests/benchmark_examples')
-rw-r--r--tests/benchmark_examples/RunExample.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/benchmark_examples/RunExample.cpp b/tests/benchmark_examples/RunExample.cpp
index 9bc0e4380a..a7a8be01cc 100644
--- a/tests/benchmark_examples/RunExample.cpp
+++ b/tests/benchmark_examples/RunExample.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -35,6 +35,7 @@
#include "utils/command_line/CommandLineParser.h"
#ifdef ARM_COMPUTE_CL
+#include "arm_compute/runtime/CL/CLHelpers.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
#endif /* ARM_COMPUTE_CL */
#ifdef ARM_COMPUTE_GC
@@ -126,6 +127,16 @@ int run_example(int argc, char **argv, std::unique_ptr<Example> example)
}
}
+#ifdef ARM_COMPUTE_CL
+ if(opencl_is_available())
+ {
+ auto ctx_dev_err = create_opencl_context_and_device();
+ ARM_COMPUTE_ERROR_ON_MSG(std::get<2>(ctx_dev_err) != CL_SUCCESS, "Failed to create OpenCL context");
+ CLScheduler::get()
+ .default_init_with_context(std::get<1>(ctx_dev_err), std::get<0>(ctx_dev_err));
+ }
+#endif /* ARM_COMPUTE_CL */
+
if(options.log_level->value() >= framework::LogLevel::CONFIG)
{
for(auto &p : printers)
@@ -135,10 +146,6 @@ int run_example(int argc, char **argv, std::unique_ptr<Example> example)
#ifdef ARM_COMPUTE_CL
if(opencl_is_available())
{
- if(!CLScheduler::get().is_initialised())
- {
- CLScheduler::get().default_init();
- }
p->print_entry("CL_DEVICE_VERSION", CLKernelLibrary::get().get_device_version());
}
else