Discussion:
[meta-arago] [PATCH v4 1/3] armnn-caffe: caffe protobuf files used in building caffe models in armnn.
Qin Su
2018-09-07 19:23:47 UTC
Permalink
Caffe protobuf files built with protobuf version 3.2.0 and used in
building caffe network models in armnn.

Signed-off-by: Qin Su <***@ti.com>
---
.../recipes-support/armnn-caffe/armnn-caffe.bb | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 meta-arago-extras/recipes-support/armnn-caffe/armnn-caffe.bb

diff --git a/meta-arago-extras/recipes-support/armnn-caffe/armnn-caffe.bb b/meta-arago-extras/recipes-support/armnn-caffe/armnn-caffe.bb
new file mode 100644
index 0000000..7fbd478
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn-caffe/armnn-caffe.bb
@@ -0,0 +1,18 @@
+DESCRIPTION = "Caffe protobuf files - used in ARMNN for Caffe network models"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://README.md;md5=01b8fd7c1b9506378a45200f64d6e0d7"
+
+SRC_URI = " \
+ git://git.ti.com/tidl/tidl-utils; \
+"
+
+SRCREV = "3af595c1b67f44c22d4ace7374c42842c0e35af5"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${datadir}/${PN}/caffe/proto/
+ cp ${S}/caffeImport/* ${D}${datadir}/${PN}/caffe/proto/.
+}
+
+
--
1.9.1
Qin Su
2018-09-07 19:23:48 UTC
Permalink
Tensorflow protobuf files built with protobuf version 3.2.0 and used in
building tensorflow network models in armnn.

Signed-off-by: Qin Su <***@ti.com>
---
.../armnn-tensorflow/armnn-tensorflow.bb | 22 +++++++
.../generate_tensorflow_protobuf.sh | 73 ++++++++++++++++++++++
2 files changed, 95 insertions(+)
create mode 100644 meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
create mode 100644 meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh

diff --git a/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
new file mode 100644
index 0000000..514b363
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow.bb
@@ -0,0 +1,22 @@
+DESCRIPTION = "Tensorflow protobuf files - used in ARMNN for Tensorflow network models"
+LICENSE = "Apache"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=01e86893010a1b87e69a213faa753ebd"
+
+SRC_URI = " \
+ git://github.com/tensorflow/tensorflow.git \
+ file://generate_tensorflow_protobuf.sh;subdir=${S} \
+"
+
+SRCREV = "aed8f42bafabf11c5d92ce4109a5e0408b31f9c5"
+
+S = "${WORKDIR}/git"
+
+do_install() {
+ install -d ${D}${datadir}/${PN}
+ chmod +x ${S}/generate_tensorflow_protobuf.sh
+ ${S}/generate_tensorflow_protobuf.sh ${D}${datadir}/${PN}
+}
+
+PACKAGES =+ "${PN}-source"
+FILES_${PN}-source = "${datadir}/${PN}"
+
diff --git a/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh
new file mode 100644
index 0000000..52c1827
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn-tensorflow/armnn-tensorflow/generate_tensorflow_protobuf.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# Copyright © 2017 Arm Ltd. All rights reserved.
+# See LICENSE file in the project root for full license information.
+#
+
+THIS_SCRIPT=$0
+OUTPUT_DIR=$1
+PROTOBUF_INSTALL_DIR=$2
+
+usage()
+{
+ echo
+ echo "Usage: ${THIS_SCRIPT} <OUTPUT_DIR> [PROTOBUF_INSTALL_DIR]"
+ echo
+ echo " <OUTPUT_DIR> is the location where the generated files will be placed"
+ echo " [PROTOBUF_INSTALL_DIR] the location of the protobuf installation"
+ echo
+}
+
+if [ "x$OUTPUT_DIR" = "x" ]
+then
+ usage
+ exit 1
+fi
+
+mkdir -p ${OUTPUT_DIR}
+ERR=$?
+if [ $ERR -ne 0 ]
+then
+ echo
+ echo "Cannot create output dir: ${OUTPUT_DIR}"
+ echo "mkdir returned: $ERR"
+ echo
+ usage
+ exit 1
+fi
+
+
+if [ "x${PROTOBUF_INSTALL_DIR}" = "x" ]
+then
+ PROTOBUF_INSTALL_DIR=/usr/local
+fi
+
+if [ ! -x "${PROTOBUF_INSTALL_DIR}/bin/protoc" ]
+then
+ echo
+ echo "No usable protocol buffer (protoc) compiler found in ${PROTOBUF_INSTALL_DIR}/bin/"
+ echo "You can specify the location of the protobuf installation as the second"
+ echo "argument of ${THIS_SCRIPT}."
+ usage
+ exit 1
+fi
+
+
+TF_PROTO_FILES=tensorflow/contrib/makefile/tf_proto_files.txt
+if [ -r $TF_PROTO_FILES ]
+then
+ OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+ for i in `cat $TF_PROTO_FILES`
+ do
+ LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH:${PROTOBUF_INSTALL_DIR}/lib \
+ $PROTOBUF_INSTALL_DIR/bin/protoc $i \
+ --proto_path=. \
+ --proto_path=${PROTOBUF_INSTALL_DIR}/include \
+ --cpp_out $OUTPUT_DIR
+ done
+else
+ echo "Couldn't find $TF_PROTO_FILES. This script should be run from the"
+ echo "tensorflow source directory."
+ exit 1
+fi
+
--
1.9.1
Qin Su
2018-09-07 19:23:49 UTC
Permalink
Arm NN SDK is a set of open-source Linux software and tools that enables
machine learning workloads on power-efficient devices. Arm NN takes Caffe,
TensorFlow network frameworks, translate them to the internal Arm NN
formatand then, through the Compute Library, deploy them efficiently on
Cortex-A CPUs.

Signed-off-by: Qin Su <***@ti.com>
---
meta-arago-extras/recipes-support/armnn/armnn.bb | 47 ++++++++++++++++++
.../armnn/0001-stdlib-issue-work-around.patch | 55 ++++++++++++++++++++++
2 files changed, 102 insertions(+)
create mode 100644 meta-arago-extras/recipes-support/armnn/armnn.bb
create mode 100644 meta-arago-extras/recipes-support/armnn/armnn/0001-stdlib-issue-work-around.patch

diff --git a/meta-arago-extras/recipes-support/armnn/armnn.bb b/meta-arago-extras/recipes-support/armnn/armnn.bb
new file mode 100644
index 0000000..6ecf633
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn/armnn.bb
@@ -0,0 +1,47 @@
+DESCRIPTION = "Linux software and tools to enable machine learning (Caffe/Tensorflow) workloads on power-efficient devices"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3e14a924c16f7d828b8335a59da64074"
+
+SRCREV = "4c7098bfeab1ffe1cdc77f6c15548d3e73274746"
+
+S = "${WORKDIR}/git"
+
+FILES_${PN}-dev += "{libdir}/cmake/*"
+
+inherit cmake
+
+SRC_URI = " \
+ git://github.com/ARM-software/armnn.git \
+ file://0001-stdlib-issue-work-around.patch \
+"
+
+DEPENDS = " \
+ boost \
+ protobuf \
+ stb \
+ arm-compute-library \
+ armnn-caffe \
+ armnn-tensorflow \
+"
+
+EXTRA_OECMAKE=" \
+ -DBUILD_SHARED_LIBS=ON -DREGISTER_INSTALL_PREFIX=OFF \
+ -DARMCOMPUTE_ROOT=${STAGING_DIR_HOST}${datadir}/arm-compute-library \
+ -DARMCOMPUTE_BUILD_DIR=${STAGING_DIR_HOST}${datadir}/arm-compute-library/build \
+ -DCAFFE_GENERATED_SOURCES=${STAGING_DIR_HOST}${datadir}/armnn-caffe \
+ -DTF_GENERATED_SOURCES=${STAGING_DIR_HOST}${datadir}/armnn-tensorflow \
+ -DBUILD_CAFFE_PARSER=1 -DBUILD_TF_PARSER=1 \
+ -DARMCOMPUTENEON=1 \
+ -DBUILD_TESTS=1 -DPROFILING=1 \
+ -DTHIRD_PARTY_INCLUDE_DIRS=${STAGING_DIR_HOST}${includedir} \
+"
+
+CXXFLAGS += "-fopenmp"
+LIBS += "-larmpl_lp64_mp"
+
+INSANE_SKIP_${PN}-dev = "dev-elf"
+
+PACKAGES =+ "${PN}-bash-completion"
+FILES_${PN}-bash-completion += "${bindir}/armnn_completions.sh"
+RDEPENDS_${PN}-bash-completion = "bash bash-completion"
+
diff --git a/meta-arago-extras/recipes-support/armnn/armnn/0001-stdlib-issue-work-around.patch b/meta-arago-extras/recipes-support/armnn/armnn/0001-stdlib-issue-work-around.patch
new file mode 100644
index 0000000..eab2902
--- /dev/null
+++ b/meta-arago-extras/recipes-support/armnn/armnn/0001-stdlib-issue-work-around.patch
@@ -0,0 +1,55 @@
+From 3691057b51010c1bd979998c460ad7b43f97496f Mon Sep 17 00:00:00 2001
+From: Qin Su <***@ti.com>
+Date: Fri, 10 Aug 2018 11:02:14 -0400
+Subject: [PATCH] stdlib issue work around
+
+Signed-off-by: Qin Su <***@ti.com>
+---
+ cmake/GlobalConfig.cmake | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+ mode change 100644 => 100755 cmake/GlobalConfig.cmake
+
+diff --git a/cmake/GlobalConfig.cmake b/cmake/GlobalConfig.cmake
+old mode 100644
+new mode 100755
+index 2dbeada..2b88c16
+--- a/cmake/GlobalConfig.cmake
++++ b/cmake/GlobalConfig.cmake
+@@ -47,6 +47,34 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP")
+ add_definitions(-DNOMINMAX=1 -DNO_STRICT=1)
+ endif()
++
++# Ensure that the default include system directories are added to the list of CMake implicit includes.
++# This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
++# For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
++macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
++ file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
++ separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
++ execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
++ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
++ ERROR_VARIABLE _gccOutput)
++ file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
++ if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
++ set(${_result} ${CMAKE_MATCH_1})
++ string(REPLACE "\n" " " ${_result} "${${_result}}")
++ separate_arguments(${_result})
++ endif ()
++endmacro()
++
++if (CMAKE_COMPILER_IS_GNUCC)
++ DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
++ set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
++endif ()
++
++if (CMAKE_COMPILER_IS_GNUCXX)
++ DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
++ set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
++endif ()
++
+ if("${CMAKE_SYSTEM_NAME}" STREQUAL Android)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -llog")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -llog")
+--
+1.9.1
+
--
1.9.1
Loading...