aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/SConscript20
-rw-r--r--examples/graph_alexnet.cpp10
-rw-r--r--examples/graph_googlenet.cpp14
-rw-r--r--examples/graph_lenet.cpp11
-rw-r--r--examples/graph_squeezenet.cpp14
-rw-r--r--examples/graph_vgg16.cpp8
-rw-r--r--examples/graph_vgg19.cpp9
7 files changed, 19 insertions, 67 deletions
diff --git a/examples/SConscript b/examples/SConscript
index 90b271d473..e002d11edd 100644
--- a/examples/SConscript
+++ b/examples/SConscript
@@ -42,7 +42,7 @@ if env['gles_compute'] and env['os'] != 'android':
# Build examples
utils = examples_env.Object("../utils/Utils.cpp")
-if env['os'] in ['android', 'bare_metal'] or env['standalone']:
+if env['os'] in ['bare_metal'] or env['standalone']:
Import('arm_compute_a')
Import('arm_compute_core_a')
arm_compute_libs = [ arm_compute_a, arm_compute_core_a ]
@@ -59,22 +59,16 @@ if env['opencl'] and env['neon']:
Depends(prog, [arm_compute_dependency, opencl])
alias = examples_env.Alias(example, prog)
Default(alias)
- if env['os'] == 'android':
- Import('arm_compute_graph_a')
- Import('arm_compute_core_a')
- Import('arm_compute_a')
- arm_compute_graph_libs = [ arm_compute_graph_a, arm_compute_a, arm_compute_core_a]
- graph_dependency = arm_compute_graph_a
- else:
- Import('arm_compute_graph_so')
- arm_compute_graph_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
- graph_dependency = arm_compute_graph_so
+ Import('arm_compute_graph_so')
+ arm_compute_graph_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
+ graph_dependency = arm_compute_graph_so
graph_utils = examples_env.Object("../utils/GraphUtils.cpp")
for file in Glob("./graph_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_graph_libs + ["OpenCL"])
- Depends(prog, [graph_dependency, opencl])
+ #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
+ Depends(prog, graph_dependency)
alias = examples_env.Alias(example, prog)
Default(alias)
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp
index b2a5be647f..2d2ba6bb11 100644
--- a/examples/graph_alexnet.cpp
+++ b/examples/graph_alexnet.cpp
@@ -21,15 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/CPP/CPPScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -40,7 +34,6 @@
using namespace arm_compute::graph;
using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
/** Example demonstrating how to implement AlexNet's network using the Compute Library's graph API
*
@@ -86,9 +79,8 @@ void main_graph_alexnet(int argc, const char **argv)
// Check if OpenCL is available and initialize the scheduler
TargetHint hint = TargetHint::NEON;
- if(arm_compute::opencl_is_available())
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
hint = TargetHint::OPENCL;
}
diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp
index 354a2a39e4..e116633a02 100644
--- a/examples/graph_googlenet.cpp
+++ b/examples/graph_googlenet.cpp
@@ -21,22 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
#include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
#include <cstdlib>
-#include <iostream>
-#include <memory>
#include <tuple>
using namespace arm_compute::graph;
@@ -141,14 +134,15 @@ void main_graph_googlenet(int argc, const char **argv)
}
// Check if OpenCL is available and initialize the scheduler
- if(arm_compute::opencl_is_available())
+ TargetHint hint = TargetHint::NEON;
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
+ hint = TargetHint::OPENCL;
}
Graph graph;
- graph << TargetHint::OPENCL
+ graph << hint
<< Tensor(TensorInfo(TensorShape(224U, 224U, 3U, 1U), 1, DataType::F32),
get_input_accessor(image, mean_r, mean_g, mean_b))
<< ConvolutionLayer(
diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp
index 53b32d9ab4..f6af14c4cf 100644
--- a/examples/graph_lenet.cpp
+++ b/examples/graph_lenet.cpp
@@ -21,25 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
#include <cstdlib>
-#include <iostream>
-#include <memory>
using namespace arm_compute::graph;
using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
/** Generates appropriate accessor according to the specified path
*
@@ -95,9 +87,8 @@ void main_graph_lenet(int argc, const char **argv)
// Check if OpenCL is available and initialize the scheduler
TargetHint hint = TargetHint::NEON;
- if(arm_compute::opencl_is_available())
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
hint = TargetHint::OPENCL;
}
diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp
index d38cec28c4..51c4de0ec1 100644
--- a/examples/graph_squeezenet.cpp
+++ b/examples/graph_squeezenet.cpp
@@ -21,22 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
#include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
#include <cstdlib>
-#include <iostream>
-#include <memory>
#include <tuple>
using namespace arm_compute::graph;
@@ -109,14 +102,15 @@ void main_graph_squeezenet(int argc, const char **argv)
}
// Check if OpenCL is available and initialize the scheduler
- if(arm_compute::opencl_is_available())
+ TargetHint hint = TargetHint::NEON;
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
+ hint = TargetHint::OPENCL;
}
Graph graph;
- graph << TargetHint::OPENCL
+ graph << hint
<< Tensor(TensorInfo(TensorShape(224U, 224U, 3U, 1U), 1, DataType::F32),
get_input_accessor(image, mean_r, mean_g, mean_b))
<< ConvolutionLayer(
diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp
index ba59503161..44dd1f63e4 100644
--- a/examples/graph_vgg16.cpp
+++ b/examples/graph_vgg16.cpp
@@ -21,13 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
-
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -81,9 +76,8 @@ void main_graph_vgg16(int argc, const char **argv)
// Check if OpenCL is available and initialize the scheduler
TargetHint hint = TargetHint::NEON;
- if(arm_compute::opencl_is_available())
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
hint = TargetHint::OPENCL;
}
diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp
index 74cb65ab69..61bb9a5190 100644
--- a/examples/graph_vgg19.cpp
+++ b/examples/graph_vgg19.cpp
@@ -21,14 +21,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
-#error "This example needs to be built with -DARM_COMPUTE_CL"
-#endif /* ARM_COMPUTE_CL */
#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/Nodes.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/Scheduler.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -37,7 +32,6 @@
using namespace arm_compute::graph;
using namespace arm_compute::graph_utils;
-using namespace arm_compute::logging;
/** Example demonstrating how to implement VGG19's network using the Compute Library's graph API
*
@@ -83,9 +77,8 @@ void main_graph_vgg19(int argc, const char **argv)
// Check if OpenCL is available and initialize the scheduler
TargetHint hint = TargetHint::NEON;
- if(arm_compute::opencl_is_available())
+ if(Graph::opencl_is_available())
{
- arm_compute::CLScheduler::get().default_init();
hint = TargetHint::OPENCL;
}