COMPMID-797: Switch to new graph.
- Cleaned up build system
Change-Id: If2faa27ee5b31fa8b972836960ab3ef671059c8d
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126435
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
diff --git a/examples/SConscript b/examples/SConscript
index 80bce57..7f7df3e 100644
--- a/examples/SConscript
+++ b/examples/SConscript
@@ -24,70 +24,57 @@
Import('env')
-if env['opencl']:
- Import('opencl')
-
-if env['gles_compute'] and env['os'] != 'android':
- Import('egl')
- Import('glesv2')
-
examples_env = env.Clone()
examples_env.Append(CPPPATH = ["#"])
-examples_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']])
# Build examples
utils = examples_env.Object("../utils/Utils.cpp")
if env['os'] in ['android', 'bare_metal'] or env['standalone']:
+ Import('arm_compute_graph_a')
Import('arm_compute_a')
Import('arm_compute_core_a')
arm_compute_libs = [ arm_compute_a, arm_compute_core_a ]
arm_compute_dependency = arm_compute_a
+ graph_dependency = [arm_compute_graph_a]
else:
+ Import('arm_compute_graph_so')
Import('arm_compute_so')
- arm_compute_libs = ["arm_compute", "arm_compute_core"]
+ arm_compute_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
arm_compute_dependency = arm_compute_so
+ graph_dependency = [arm_compute_graph_so]
-if env['opencl'] and env['neon']:
+# Build graph examples
+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 = None
+ arm_compute_graph_libs = arm_compute_libs
+
+ if env['os'] == 'android':
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
+ Depends(prog, graph_dependency)
+ else:
+ #-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)
+
+if env['opencl'] and env['neon']:
for file in Glob("./neoncl_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs +["OpenCL"])
- Depends(prog, [arm_compute_dependency, opencl])
- alias = examples_env.Alias(example, prog)
- Default(alias)
- if env['os'] == 'android':
- Import('arm_compute_graph2_a')
- Import('arm_compute_graph_a')
- Import('arm_compute_core_a')
- Import('arm_compute_a')
- arm_compute_graph_libs = [ arm_compute_a, arm_compute_core_a, "OpenCL"]
- graph_dependency = [arm_compute_graph_a, arm_compute_graph2_a]
- else:
- Import('arm_compute_graph2_so')
- Import('arm_compute_graph_so')
- arm_compute_graph_libs = ["arm_compute_graph2", "arm_compute_graph", "arm_compute", "arm_compute_core"]
- graph_dependency = [arm_compute_graph_so, arm_compute_graph2_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 = None
- if env['os'] == 'android':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs + ["OpenCL"], LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
- Depends(prog, [graph_dependency, opencl])
- else:
- #-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)
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
alias = examples_env.Alias(example, prog)
Default(alias)
if env['opencl']:
for file in Glob("./cl_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs +["OpenCL"])
- Depends(prog, [arm_compute_dependency, opencl])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
alias = examples_env.Alias(example, prog)
Default(alias)
@@ -103,13 +90,13 @@
for file in Glob("./gc_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
if env['os'] != 'android':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv2"])
- Depends(prog, [arm_compute_dependency, egl, glesv2])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
else:
if env['arch'] != 'armv7a':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv3"])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
else:
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv2"])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
Depends(prog, [arm_compute_dependency])
alias = examples_env.Alias(example, prog)
Default(alias)
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp
index 418d1ea..6a3c14b 100644
--- a/examples/graph_alexnet.cpp
+++ b/examples/graph_alexnet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -31,7 +31,7 @@
#include <memory>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement AlexNet's network using the Compute Library's graph API
@@ -54,7 +54,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// TODO (geopin01) : Get GPU target somehow and set gemm also for midgard ?
const bool is_gemm_convolution5x5 = (target_hint == Target::NEON);
diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp
index d6e76fd..6c3fac4 100644
--- a/examples/graph_googlenet.cpp
+++ b/examples/graph_googlenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement Googlenet's network using the Compute Library's graph API
@@ -53,7 +53,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
// Parse arguments
diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp
index 5f049d0..22e6f6e 100644
--- a/examples/graph_inception_v3.cpp
+++ b/examples/graph_inception_v3.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement InceptionV3's network using the Compute Library's graph API
@@ -52,7 +52,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp
index 847c5b8..1f78751 100644
--- a/examples/graph_inception_v4.cpp
+++ b/examples/graph_inception_v4.cpp
@@ -21,8 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/core/Error.h"
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -31,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement InceptionV4's network using the Compute Library's graph API
@@ -56,7 +55,7 @@
// Set target. 0 (NEON), 1 (OpenCL). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp
index 3803da9..8aca0fa 100644
--- a/examples/graph_lenet.cpp
+++ b/examples/graph_lenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
@@ -30,7 +30,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement LeNet's network using the Compute Library's graph API
@@ -48,7 +48,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// Parse arguments
if(argc < 2)
diff --git a/examples/graph_mobilenet.cpp b/examples/graph_mobilenet.cpp
index bd25b92..055f289 100644
--- a/examples/graph_mobilenet.cpp
+++ b/examples/graph_mobilenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement MobileNet's network using the Compute Library's graph API
@@ -51,7 +51,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = ConvolutionMethod::GEMM;
DepthwiseConvolutionMethod depthwise_convolution_hint = DepthwiseConvolutionMethod::OPTIMIZED_3x3;
diff --git a/examples/graph_mobilenet_qasymm8.cpp b/examples/graph_mobilenet_qasymm8.cpp
index 76b13dd..cb49ffd 100644
--- a/examples/graph_mobilenet_qasymm8.cpp
+++ b/examples/graph_mobilenet_qasymm8.cpp
@@ -21,14 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/Nodes.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
-using namespace arm_compute;
-using namespace arm_compute::graph;
+#include <cstdlib>
+
+using namespace arm_compute::utils;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement QASYMM8 MobileNet's network using the Compute Library's graph API
@@ -36,9 +37,11 @@
* @param[in] argc Number of arguments
* @param[in] argv Arguments ( [optional] Target (0 = NEON, 1 = OpenCL, 2 = OpenCL with Tuner), [optional] Path to the weights folder, [optional] npy_input, [optional] labels )
*/
-class GraphMobileNetQASYMM8Example : public utils::Example
+class GraphMobileNetQASYMM8Example : public Example
{
public:
+ //FIXME: Missing quantization info to the tensor descriptor (Giorgio is working on it)
+#if 0
void do_setup(int argc, char **argv) override
{
std::string data_path; /* Path to the trainable data */
@@ -217,6 +220,8 @@
return BranchLayer(std::move(sg));
}
+#endif /* if 0 */
+ Stream graph { 0, "MobileNetV1_QASYMM8" };
};
/** Main program for MobileNetQASYMM8
*
@@ -225,5 +230,5 @@
*/
int main(int argc, char **argv)
{
- return utils::run_example<GraphMobileNetQASYMM8Example>(argc, argv);
+ return arm_compute::utils::run_example<GraphMobileNetQASYMM8Example>(argc, argv);
}
diff --git a/examples/graph_resnet50.cpp b/examples/graph_resnet50.cpp
index ec447de..eb74a1a 100644
--- a/examples/graph_resnet50.cpp
+++ b/examples/graph_resnet50.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement Microsoft's ResNet50 network using the Compute Library's graph API
@@ -53,7 +53,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp
index ddbe6b4..32be143 100644
--- a/examples/graph_squeezenet.cpp
+++ b/examples/graph_squeezenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
using namespace arm_compute::logging;
@@ -54,7 +54,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp
index faab79f..2bdb00d 100644
--- a/examples/graph_squeezenet_v1_1.cpp
+++ b/examples/graph_squeezenet_v1_1.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
namespace
@@ -57,7 +57,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp
index 23742ed..82be97c 100644
--- a/examples/graph_vgg16.cpp
+++ b/examples/graph_vgg16.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
namespace
@@ -66,7 +66,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// Check if we can use GEMM-based convolutions evaluating if the platform has at least 1.8 GB of available memory
const size_t memory_required = 1932735283L;
diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp
index f282b90..606b0e0 100644
--- a/examples/graph_vgg19.cpp
+++ b/examples/graph_vgg19.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement VGG19's network using the Compute Library's graph API
@@ -52,7 +52,7 @@
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = ConvolutionMethod::DIRECT;
// Parse arguments