From 80bd105d88533fcf58e31c65a1efa62f14f36153 Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Wed, 9 Jun 2021 10:54:55 +0100 Subject: [PATCH 1/2] [CI] [ComputeLibrary] Use pre-built binaries instead of compiled Pre-built Compute Library binaries are now downloaded (credits to @leandorn) instead of on-site compilation. Change-Id: I9fd66ce02141813f02382b95351a382ccf775584 --- docker/Dockerfile.ci_cpu | 6 +- ...buntu_download_arm_compute_lib_binaries.sh | 46 +++++++++++ .../install/ubuntu_install_arm_compute_lib.sh | 78 ------------------- 3 files changed, 49 insertions(+), 81 deletions(-) create mode 100755 docker/install/ubuntu_download_arm_compute_lib_binaries.sh delete mode 100755 docker/install/ubuntu_install_arm_compute_lib.sh diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu index 1ca592f34ab2..4c6a05c34117 100644 --- a/docker/Dockerfile.ci_cpu +++ b/docker/Dockerfile.ci_cpu @@ -87,9 +87,9 @@ RUN bash /install/ubuntu_install_tflite.sh COPY install/ubuntu_install_tensorflow.sh /install/ubuntu_install_tensorflow.sh RUN bash /install/ubuntu_install_tensorflow.sh -# Arm(R) Compute Library -COPY install/ubuntu_install_arm_compute_lib.sh /install/ubuntu_install_arm_compute_lib.sh -RUN bash /install/ubuntu_install_arm_compute_lib.sh +# Compute Library +COPY install/ubuntu_download_arm_compute_lib_binaries.sh /install/ubuntu_download_arm_compute_lib_binaries.sh +RUN bash /install/ubuntu_download_arm_compute_lib_binaries.sh # Caffe deps COPY install/ubuntu_install_caffe.sh /install/ubuntu_install_caffe.sh diff --git a/docker/install/ubuntu_download_arm_compute_lib_binaries.sh b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh new file mode 100755 index 000000000000..40f9b29b2f31 --- /dev/null +++ b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +# Install cross-compiler when not building natively. +# Depending on the architecture selected to compile for, +# you may need to install an alternative cross-compiler. +if [ "$architecture_type" != "aarch64" ]; then + apt-get update && apt-get install -y --no-install-recommends \ + g++-aarch64-linux-gnu \ + gcc-aarch64-linux-gnu +fi + +compute_lib_version="v21.05" +compute_lib_base_url="https://github.com/ARM-software/ComputeLibrary/releases/download/${compute_lib_version}" +compute_lib_file_name="arm_compute-${compute_lib_version}-bin-linux.tar.gz" +compute_lib_download_url="${compute_lib_base_url}/${compute_lib_file_name}" + +target_lib="linux-arm64-v8a-neon" + +# uncomment line below if you need asserts/debug version of the library +# target_lib="${target_lib}-asserts" + +extract_dir="arm_compute-${compute_lib_version}-bin-linux" +install_path="/opt/arm/acl" + +tmpdir=$(mktemp -d) + +cleanup() +{ + rm -rf "$tmpdir" +} + +trap cleanup 0 + +cd "$tmpdir" + +curl -sL "${compute_lib_download_url}" -o "${compute_lib_file_name}" +tar xzf "${compute_lib_file_name}" + +mkdir -p "${install_path}" +cp -r "${extract_dir}/include" "${install_path}/" +cp -r "${extract_dir}/arm_compute" "${install_path}/include/" +cp -r "${extract_dir}/support" "${install_path}/include/" +cp -r "${extract_dir}/utils" "${install_path}/include/" +cp -r "${extract_dir}/lib/${target_lib}" "${install_path}/lib" diff --git a/docker/install/ubuntu_install_arm_compute_lib.sh b/docker/install/ubuntu_install_arm_compute_lib.sh deleted file mode 100755 index c09bb1290a63..000000000000 --- a/docker/install/ubuntu_install_arm_compute_lib.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -set -e -set -u -set -o pipefail - -repo_url="https://github.com/ARM-software/ComputeLibrary.git" -repo_dir="acl" -install_path="/opt/$repo_dir" -architecture_type=$(uname -i) -target_arch="arm64-v8a" # arm64-v8a / arm64-v8.2-a / armv7a -build_type="native" - -tmpdir=$(mktemp -d) - -cleanup() -{ - rm -rf "$tmpdir" -} - -trap cleanup 0 - -apt-get update && \ -apt-get install -y --no-install-recommends \ - git \ - scons \ - bsdmainutils \ - build-essential - -# Install cross-compiler when not building natively. -# Depending on the architecture selected to compile for, -# you may need to install an alternative cross-compiler. -if [ "$architecture_type" != "aarch64" ]; then - apt-get install -y --no-install-recommends \ - g++-aarch64-linux-gnu \ - gcc-aarch64-linux-gnu -fi - -cd "$tmpdir" - -git clone "$repo_url" "$repo_dir" - -cd "$repo_dir" - -# pin version to v21.02 -git checkout "v21.02" - -if [ "$architecture_type" != "aarch64" ]; then - build_type="cross_compile" -fi - -scons \ - install_dir="$install_path" \ - Werror=1 \ - -j8 \ - debug=0 \ - asserts=0 \ - neon=1 \ - opencl=0 \ - os=linux \ - arch="$target_arch" \ - build="$build_type" From 73128aac355d45f64464efd4ce6b5546e53a1fbb Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Fri, 11 Jun 2021 16:29:38 +0100 Subject: [PATCH 2/2] Added Apache 2.0 License Change-Id: I3c2af1a86984f81c4ee9408925af9c51510a978f --- .../ubuntu_download_arm_compute_lib_binaries.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docker/install/ubuntu_download_arm_compute_lib_binaries.sh b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh index 40f9b29b2f31..ff8ad0eb9073 100755 --- a/docker/install/ubuntu_download_arm_compute_lib_binaries.sh +++ b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh @@ -1,4 +1,20 @@ #!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. set -e