You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/using-executorch-building-from-source.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ Windows (x86_64)
30
30
*`g++` version 7 or higher, `clang++` version 5 or higher, or another
31
31
C++17-compatible toolchain.
32
32
*`python` version 3.10-3.12
33
+
*`ccache` (optional) - A compiler cache that speeds up recompilation
33
34
34
35
Note that the cross-compilable core runtime code supports a wider range of
35
36
toolchains, down to C++17. See the [Runtime Overview](runtime-overview.md) for
@@ -64,8 +65,8 @@ Or alternatively, [install conda on your machine](https://conda.io/projects/cond
64
65
# Intel-based macOS systems require building PyTorch from source (see below)
65
66
./install_executorch.sh
66
67
```
67
-
68
-
See the [PyTorch instructions](https://github.com/pytorch/pytorch#installation) on how to build PyTorch from source.
68
+
69
+
See the [PyTorch instructions](https://github.com/pytorch/pytorch#installation) on how to build PyTorch from source.
69
70
70
71
Use the [`--use-pt-pinned-commit` flag](../../install_executorch.py) to install ExecuTorch with an existing PyTorch build:
71
72
@@ -119,6 +120,8 @@ Or alternatively, [install conda on your machine](https://conda.io/projects/cond
119
120
> git submodule sync
120
121
> git submodule update --init --recursive
121
122
> ```
123
+
>
124
+
> The `--clean`command removes build artifacts, pip outputs, and also clears the ccache if it's installed, ensuring a completely fresh build environment.
122
125
123
126
## Build ExecuTorch C++ runtime from source
124
127
@@ -171,6 +174,29 @@ To further optimize the release build for size, use both:
171
174
-DEXECUTORCH_OPTIMIZE_SIZE=ON
172
175
```
173
176
177
+
#### Compiler Cache (ccache)
178
+
179
+
ExecuTorch automatically detects and enables [ccache](https://ccache.dev/) if it's installed on your system. This significantly speeds up recompilation by caching previously compiled objects:
180
+
181
+
- If ccache is detected, you'll see: `ccache found and enabled for faster builds`
182
+
- If ccache is not installed, you'll see: `ccache not found, builds will not be cached`
183
+
184
+
To install ccache:
185
+
```bash
186
+
# Ubuntu/Debian
187
+
sudo apt install ccache
188
+
189
+
# macOS
190
+
brew install ccache
191
+
192
+
# CentOS/RHEL
193
+
sudo yum install ccache
194
+
# or
195
+
sudo dnf install ccache
196
+
```
197
+
198
+
No additional configuration is needed - the build system will automatically use ccache when available.
199
+
174
200
See [CMakeLists.txt](https://github.com/pytorch/executorch/blob/main/CMakeLists.txt)
175
201
176
202
### Build the runtime components
@@ -190,6 +216,8 @@ cd executorch
190
216
cmake --build cmake-out -j9
191
217
```
192
218
219
+
>**_TIP:_** For faster rebuilds, consider installing ccache (see [Compiler Cache section](#compiler-cache-ccache) above). On first builds, ccache populates its cache. Subsequent builds with the same compiler flags can be significantly faster.
220
+
193
221
## Use an example binary `executor_runner` to execute a .pte file
194
222
195
223
First, generate a .pte file, either by exporting an example model or following
@@ -243,7 +271,7 @@ Install ClangCL for Windows from the [official website](https://learn.microsoft.
243
271
To check if conda is detected by the powershell prompt, try `conda list` or `conda --version`
244
272
245
273
If conda is not detected, you could run the powershell script for conda named `conda-hook.ps1`.
246
-
To verify that Conda is available in the in the powershell environment, run try `conda list` or `conda --version`.
274
+
To verify that Conda is available in the in the powershell environment, run try `conda list` or `conda --version`.
247
275
If Conda is not available, run conda-hook.ps1 as follows:
0 commit comments