Skip to content

Commit

Permalink
Turn on Compute library testing in CI for AArch64 (apache#8291)
Browse files Browse the repository at this point in the history
* Turn on Compute library testing in CI.

This pull request turns on compute library testing in CI by

1. Handling import errors in Compute Library Integration.
2. Setting the configuration to the right path for ACL.

This handles import errors for packages in Compute library integration.
This pull request allows for the AArch64 CI to pick up native
compute library testing and tests the operators being offloaded at
runtime.

* Fix typo

* Fix up use of ubuntu_install_arm_compute_lib.sh in Dockerfile.ci_arm

* Move to using pre-built ACL binaries for ci_arm
* Fixup the path for installation to be /opt/acl as it originally was.
* Fix up the issues with paths.

Once this is done ci_arm will need to be rebuilt though will continue
to work seamlessly.
  • Loading branch information
Ramana Radhakrishnan authored and ylc committed Jan 13, 2022
1 parent bd20847 commit 791f26b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docker/Dockerfile.ci_arm
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ COPY install/ubuntu_install_redis.sh /install/ubuntu_install_redis.sh
RUN bash /install/ubuntu_install_redis.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
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
3 changes: 2 additions & 1 deletion docker/install/ubuntu_download_arm_compute_lib_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ target_lib="linux-arm64-v8a-neon"
# target_lib="${target_lib}-asserts"

extract_dir="arm_compute-${compute_lib_version}-bin-linux"
install_path="/opt/arm/acl"
install_path="/opt/acl"

tmpdir=$(mktemp -d)

Expand All @@ -54,6 +54,7 @@ cd "$tmpdir"
curl -sL "${compute_lib_download_url}" -o "${compute_lib_file_name}"
tar xzf "${compute_lib_file_name}"

rm -rf "${install_path}"
mkdir -p "${install_path}"
cp -r "${extract_dir}/include" "${install_path}/"
cp -r "${extract_dir}/arm_compute" "${install_path}/include/"
Expand Down
25 changes: 20 additions & 5 deletions tests/python/contrib/test_arm_compute_lib/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def _build_and_run_network(mod, params, inputs, device, tvm_ops, acl_partitions,

def _get_tflite_model(tflite_model_path, inputs_dict):
"""Convert TFlite graph to relay."""
import tflite.Model
try:
import tflite.Model
except ImportError:
pytest.skip("Missing Tflite support")

with open(tflite_model_path, "rb") as f:
tflite_model_buffer = f.read()
Expand Down Expand Up @@ -92,7 +95,10 @@ def test_vgg16():
device = Device()

def get_model():
from keras.applications import VGG16
try:
from keras.applications import VGG16
except ImportError:
pytest.skip("Missing Keras Package")

vgg16 = VGG16(include_top=True, weights="imagenet", input_shape=(224, 224, 3), classes=1000)
inputs = {vgg16.input_names[0]: ((1, 224, 224, 3), "float32")}
Expand All @@ -113,7 +119,10 @@ def test_mobilenet():
device = Device()

def get_model():
from keras.applications import MobileNet
try:
from keras.applications import MobileNet
except ImportError:
pytest.skip("Missing keras module")

mobilenet = MobileNet(
include_top=True, weights="imagenet", input_shape=(224, 224, 3), classes=1000
Expand All @@ -133,7 +142,10 @@ def test_quantized_mobilenet():
if skip_runtime_test():
return

import tvm.relay.testing.tf as tf_testing
try:
import tvm.relay.testing.tf as tf_testing
except ImportError:
pytest.skip("Missing Tflite support")

device = Device()

Expand All @@ -158,7 +170,10 @@ def test_squeezenet():
if skip_runtime_test():
return

import tvm.relay.testing.tf as tf_testing
try:
import tvm.relay.testing.tf as tf_testing
except ImportError:
pytest.skip("Missing TF Support")

device = Device()

Expand Down
1 change: 1 addition & 0 deletions tests/scripts/task_config_build_arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake
echo set\(USE_VTA_TSIM ON\) >> config.cmake
echo set\(USE_VTA_FSIM ON\) >> config.cmake
echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake
echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/acl"\) >> config.cmake

0 comments on commit 791f26b

Please sign in to comment.