Skip to content

Cleanup build from source page #9045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2025
Merged
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
30 changes: 12 additions & 18 deletions docs/source/using-executorch-building-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ portability details.
conda activate executorch
```

### Clone and install ExecuTorch requirements
### Clone ExecuTorch

```bash
# Clone the ExecuTorch repo from GitHub
Expand All @@ -57,14 +57,17 @@ portability details.
# Update and pull submodules
git submodule sync
git submodule update --init
```

## Install ExecuTorch pip package from Source
```bash
# Install ExecuTorch pip package and its dependencies, as well as
# development tools like CMake.
# If developing on a Mac, make sure to install the Xcode Command Line Tools first.
./install_executorch.sh
```

Use the [`--pybind` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh#L26-L29) to install with pybindings and dependencies for other backends.
Use the [`--pybind` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh#L26-L29) to install with pybindings and dependencies for other backends.
```bash
./install_executorch.sh --pybind <coreml | mps | xnnpack>

Expand All @@ -80,7 +83,7 @@ portability details.
./install_executorch.sh --pybind off
```

For development, install the package in `--editable` mode, which allows to modify Python source code and see changes reflected immediately.
For development mode, run the command with `--editable`, which allows us to modify Python source code and see changes reflected immediately.
```bash
./install_executorch.sh --editable [--pybind xnnpack]

Expand All @@ -105,7 +108,7 @@ portability details.
> git submodule update --init
> ```

## Targets Built by the CMake Build System
## Build ExecuTorch C++ runtime from source

ExecuTorch's CMake build system covers the pieces of the runtime that are
likely to be useful to embedded systems users.
Expand All @@ -125,17 +128,8 @@ likely to be useful to embedded systems users.
`libportable_kernels.a`, so the program may use any of the operators it
implements.

## One-time setup to prepare for CMake Build

Follow the steps below to have the tools ready before using CMake to build on your machine.

1. If your system's version of python3 is older than 3.11:
- Run `pip install tomli`
3. Install CMake version 3.19 or later:
- Run `conda install cmake` or `pip install cmake`.


## Configure the CMake Build
### Configure the CMake build

Follow these steps after cloning or pulling the upstream repo, since the build
dependencies may have changed.
Expand All @@ -152,7 +146,7 @@ cd executorch

Once this is done, you don't need to do it again until you pull from the upstream repo again, or if you modify any CMake-related files.

### CMake Build Options
### CMake build options

The release build offers optimizations intended to improve performance and reduce binary size. It disables program verification and executorch logging, and adds optimizations flags.
```bash
Expand All @@ -167,7 +161,7 @@ To further optimize the release build for size, use both:

See [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/CMakeLists.txt)

## Build the runtime components
### Build the runtime components

Build all targets with

Expand All @@ -184,7 +178,7 @@ cd executorch
cmake --build cmake-out -j9
```

## Use an example app `executor_runner` to execute a .pte file
## Use an example binary `executor_runner` to execute a .pte file

First, generate an `add.pte` or other ExecuTorch program file using the
instructions as described in
Expand All @@ -196,7 +190,7 @@ Then, pass it to the command line tool:
./cmake-out/executor_runner --model_path path/to/model.pte
```

If it worked, you should see the message "Model executed successfully" followed
You should see the message "Model executed successfully" followed
by the output values.

```
Expand Down
Loading