2021-06-02 04:21:41 +00:00
---
title: Enabling NNAPI or CoreML Execution Providers
parent: Deploy ONNX Runtime Mobile
2021-09-15 21:23:42 +00:00
grand_parent: Tutorials
2021-06-02 04:21:41 +00:00
nav_order: 6
---
2021-11-18 19:00:48 +00:00
# Using NNAPI and CoreML with ONNX Runtime Mobile
2021-06-02 04:21:41 +00:00
- Usage of NNAPI on Android platforms is via the NNAPI Execution Provider (EP).
2021-10-04 22:48:53 +00:00
- See the [NNAPI Execution Provider ](../../execution-providers/NNAPI-ExecutionProvider.md ) documentation for more details.
2021-06-02 04:21:41 +00:00
- Usage of CoreML on iOS and macOS platforms is via the CoreML EP.
2021-10-04 22:48:53 +00:00
- See the [CoreML Execution Provider ](../../execution-providers/CoreML-ExecutionProvider.md ) documentation for more details.
2021-06-02 04:21:41 +00:00
The pre-built ONNX Runtime Mobile package includes the NNAPI EP on Android, and the CoreML EP on iOS.
If performing a custom build of ONNX Runtime, support for the NNAPI EP or CoreML EP must be enabled when building.
### Create a minimal build with NNAPI EP or CoreML EP support
2021-11-18 19:00:48 +00:00
Please see [Build for Android ](../../build/android.md ) and [Build for iOS ](../../build/ios.md ) for setting up the Android or iOS environment required to build. The Android build can be cross-compiled on Windows or Linux. The iOS/macOS build must be performed on a mac machine.
2021-06-02 04:21:41 +00:00
2021-10-04 22:48:53 +00:00
Once you have all the necessary components setup, follow the instructions to [create the custom build ](./custom-build.md ), with the following changes:
2021-06-02 04:21:41 +00:00
- Replace `--minimal_build` with `--minimal_build extended` to enable support for execution providers that dynamically create kernels at runtime, which is required by the NNAPI EP and CoreML EP.
- Add `--use_nnapi` to include the NNAPI EP in the build
- Add `--use_coreml` to include the CoreML EP in the build
##### Example build commands with the NNAPI EP enabled:
- Windows example:
`<ONNX Runtime repository root>.\build.bat --config MinSizeRel --android --android_sdk_path D:\Android --android_ndk_path D:\Android\ndk\21.1.6352462\ --android_abi arm64-v8a --android_api 29 --cmake_generator Ninja --minimal_build extended --use_nnapi --disable_ml_ops --disable_exceptions --build_shared_lib --skip_tests --include_ops_by_config <config file from model conversion>`
- Linux example:
`<ONNX Runtime repository root>./build.sh --config MinSizeRel --android --android_sdk_path /Android --android_ndk_path /Android/ndk/21.1.6352462/ --android_abi arm64-v8a --android_api 29 --minimal_build extended --use_nnapi --disable_ml_ops --disable_exceptions --build_shared_lib --skip_tests --include_ops_by_config <config file from model conversion>`
-------
2021-10-04 22:48:53 +00:00
Next: [Limitations ](./limitations.md )