Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,27 @@ onnxruntime_perf_test
onnxruntime_test_all
```

#### Build Instructions(Jetson Nano)

1. Build ACL Library (skip if already built)
```
cd ~
git clone https://github.com/Arm-software/ComputeLibrary.git

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example for someone who wants to build ACL. If they have a pre-built version, they may use it as mentioned above.

cd ComputeLibrary
sudo apt install scons
sudo apt install g++-arm-linux-gnueabihf
scons -j8 arch=arm64-v8a Werror=1 debug=0 asserts=0 neon=1 opencl=1 examples=1 build=native
```
2. Set environment variables to set include directory and shared object library path.
```
export CPATH=~/ComputeLibrary/include/:~/ComputeLibrary/
export LD_LIBRARY_PATH=~/ComputeLibrary/build/
```
3. Build onnxruntime with --use_acl flag
```
./build.sh --use_acl
```

---

## Options
Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ if (onnxruntime_USE_ACL OR onnxruntime_USE_ACL_1902 OR onnxruntime_USE_ACL_1905
endif()
endif()

list(APPEND onnxruntime_EXTERNAL_LIBRARIES arm_compute acl arm_compute_graph arm_compute_core)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES arm_compute arm_compute_graph arm_compute_core)
endif()

# MKLML
Expand Down
1 change: 1 addition & 0 deletions cmake/onnxruntime_providers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ if (onnxruntime_USE_ACL)
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_acl_cc_srcs})
add_library(onnxruntime_providers_acl ${onnxruntime_providers_acl_cc_srcs})
onnxruntime_add_include_to_target(onnxruntime_providers_acl onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
target_link_libraries(onnxruntime_providers_acl -L$ENV{LD_LIBRARY_PATH})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why using LD_LIBRARY_PATH? that's normally used at run time.

@prabhat00155 Prabhat Roy (prabhat00155) Apr 20, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to link the ACL so files. Without this build fails with this error: "Unable to load arm_compute arm_compute_graph arm_compute_core".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was that LD_LIBRARY_PATH should not be used for that purpose.
We should allow user to specify the location of ACL libraries as build option.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if you make user pass ACL library location, the user will still need to set LD_LIBRARY_PATH in order to use onnxruntime_perf_test otherwise get this error: "error while loading shared libraries: libarm_compute.so: cannot open shared object file: No such file or directory."

@jywu-mysoft George Wu (jywu-mysoft) Apr 25, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but LD_LIBRARY_PATH is used at runtime. it's not meant to be used during build time (which is what the cmake files are for)
at build time, the ACL install location can be anywhere and not set in the user's LD_LIBRARY_PATH
the binary could then be deployed to a target where LD_LIBRARY_PATH would need to be set at run time.
besides, LD_LIBRARY_PATH env variable is specific to Linux/Unix.
Many other EP's have dependency on other libs. (e.g. CUDA, OpenVINO) etc.
But you can grep through all our cmake files and you won't find a single reference to LD_LIBRARY_PATH

add_dependencies(onnxruntime_providers_acl ${onnxruntime_EXTERNAL_DEPENDENCIES})
set_target_properties(onnxruntime_providers_acl PROPERTIES FOLDER "ONNXRuntime")
target_include_directories(onnxruntime_providers_acl PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${ACL_INCLUDE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/acl/nn/conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Status Conv<T>::Compute(OpKernelContext* context) const {
if(optimizable) {
//optimized depthwise convolution
#if defined(ACL_1902) || defined(ACL_1905)
auto layer = std::make_shared<arm_compute::NEDepthwiseConvolutionLayer3x3>();
auto layer = std::make_shared<arm_compute::NEDepthwiseConvolutionLayer>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason of this change? NEDepthwiseConvolutionLayer3x3 is an optimized version for depthwise 3x3 which increases the performance significantly for mobilenets and other models.

@jywu-mysoft George Wu (jywu-mysoft) Apr 22, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was accidental.
Prabhat Roy (@prabhat00155) was trying to incorporate some of the changes from #2511
but accidentally reverted changes from
#2774
Prabhat Roy (@prabhat00155) can you please revert this change? thanks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting error(NEDepthwiseConvolutionLayer3x3 not defined) and had to make this change to build. I'll update my ACL repo and retry.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got the issue, this should be only used for ACL_1902. I'll create a new PR to use NEDepthwiseConvolutionLayer3x3 and fix the error.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#endif
#ifdef ACL_1908
auto layer = std::make_shared<arm_compute::NEDepthwiseConvolutionLayerOptimized>();
Expand Down
28 changes: 24 additions & 4 deletions tools/ci_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ def parse_arguments():
parser.add_argument(
"--enable_lto", action='store_true',
help="Enable Link Time Optimization")
parser.add_argument(
"--use_acl", nargs="?", const="ACL_1905",
choices=["ACL_1902", "ACL_1905", "ACL_1908"],
help="Build with ACL for ARM architectures.")
return parser.parse_args()


Expand Down Expand Up @@ -479,7 +483,7 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home,
"OFF" if args.skip_winml_tests else "ON"),
"-Donnxruntime_GENERATE_TEST_REPORTS=ON",
"-Donnxruntime_DEV_MODE=" + (
"OFF" if args.android else "ON"),
"OFF" if args.android or args.use_acl else "ON"),
"-DPYTHON_EXECUTABLE=" + sys.executable,
"-Donnxruntime_USE_CUDA=" + ("ON" if args.use_cuda else "OFF"),
"-Donnxruntime_CUDNN_HOME=" + (cudnn_home if args.use_cuda else ""),
Expand Down Expand Up @@ -551,6 +555,13 @@ def generate_build_tree(cmake_path, source_dir, build_dir, cuda_home,
"-Donnxruntime_USE_TELEMETRY=" + (
"ON" if args.use_telemetry else "OFF"),
"-Donnxruntime_ENABLE_LTO=" + ("ON" if args.enable_lto else "OFF"),
"-Donnxruntime_USE_ACL=" + ("ON" if args.use_acl else "OFF"),
"-Donnxruntime_USE_ACL_1902=" + (
"ON" if args.use_acl == "ACL_1902" else "OFF"),
"-Donnxruntime_USE_ACL_1905=" + (
"ON" if args.use_acl == "ACL_1905" else "OFF"),
"-Donnxruntime_USE_ACL_1908=" + (
"ON" if args.use_acl == "ACL_1908" else "OFF"),
]

if args.winml_root_namespace_override:
Expand Down Expand Up @@ -1165,9 +1176,10 @@ def nuphar_run_python_tests(build_dir, configs):
cwd=cwd, dll_path=dll_path)


def build_python_wheel(source_dir, build_dir, configs, use_cuda, use_ngraph,
use_dnnl, use_tensorrt, use_openvino, use_nuphar,
wheel_name_suffix, nightly_build=False):
def build_python_wheel(
source_dir, build_dir, configs, use_cuda, use_ngraph, use_dnnl,
use_tensorrt, use_openvino, use_nuphar, wheel_name_suffix, use_acl,
nightly_build=False):
for config in configs:
cwd = get_config_build_dir(build_dir, config)
if is_windows():
Expand All @@ -1190,6 +1202,8 @@ def build_python_wheel(source_dir, build_dir, configs, use_cuda, use_ngraph,
args.append('--use_nuphar')
if wheel_name_suffix:
args.append('--wheel_name_suffix={}'.format(wheel_name_suffix))
elif use_acl:
args.append('--use_acl')

run_subprocess(args, cwd=cwd)

Expand Down Expand Up @@ -1483,6 +1497,11 @@ def main():
build_dir, configs, onnx_test_data_dir, 'dml',
args.enable_multi_device_test, False, 1)

if args.use_acl:
run_onnx_tests(
build_dir, configs, onnx_test_data_dir, 'acl',
args.enable_multi_device_test, False, 1, 1)

# Run some models are disabled to keep memory utilization
# under control.
if args.use_dnnl:
Expand Down Expand Up @@ -1516,6 +1535,7 @@ def main():
args.use_openvino,
args.use_nuphar,
args.wheel_name_suffix,
args.use_acl,
nightly_build=nightly_build,
)

Expand Down