mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Advertise USE_PRECOMPILED_HEADERS in CONTRIBUTING.md (#62827)
Summary: This option was added in https://github.com/pytorch/pytorch/issues/61940 and fits with this section's theme of improving build times. I've also changed it to a `cmake_dependent_option` instead of `FATAL_ERROR`ing for older CMake versions. Pull Request resolved: https://github.com/pytorch/pytorch/pull/62827 Reviewed By: astaff Differential Revision: D30342102 Pulled By: malfet fbshipit-source-id: 3095b44b7085aee8a884ec95cba9f8998d4442e7
This commit is contained in:
parent
011fdc3b7e
commit
f70b9ee5de
|
|
@ -241,10 +241,9 @@ option(USE_OBSERVERS "Use observers module." OFF)
|
||||||
option(USE_OPENCL "Use OpenCL" OFF)
|
option(USE_OPENCL "Use OpenCL" OFF)
|
||||||
option(USE_OPENCV "Use OpenCV" OFF)
|
option(USE_OPENCV "Use OpenCV" OFF)
|
||||||
option(USE_OPENMP "Use OpenMP for parallel code" ON)
|
option(USE_OPENMP "Use OpenMP for parallel code" ON)
|
||||||
option(USE_PRECOMPILED_HEADERS "Use pre-compiled headers to accelerate build. Requires cmake >= 3.16." OFF)
|
cmake_dependent_option(
|
||||||
if(USE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS "3.16"))
|
USE_PRECOMPILED_HEADERS "Use pre-compiled headers to accelerate build. Requires cmake >= 3.16." OFF
|
||||||
message(FATAL_ERROR "Precompiled headers require cmake >= 3.16")
|
"CMAKE_VERSION VERSION_LESS \"3.16\"" OFF)
|
||||||
endif()
|
|
||||||
|
|
||||||
option(USE_PROF "Use profiling" OFF)
|
option(USE_PROF "Use profiling" OFF)
|
||||||
option(USE_QNNPACK "Use QNNPACK (quantized 8-bit operators)" ON)
|
option(USE_QNNPACK "Use QNNPACK (quantized 8-bit operators)" ON)
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
- [Use Ninja](#use-ninja)
|
- [Use Ninja](#use-ninja)
|
||||||
- [Use CCache](#use-ccache)
|
- [Use CCache](#use-ccache)
|
||||||
- [Use a faster linker](#use-a-faster-linker)
|
- [Use a faster linker](#use-a-faster-linker)
|
||||||
|
- [Use pre-compiled headers](#use-pre-compiled-headers)
|
||||||
- [C++ frontend development tips](#c-frontend-development-tips)
|
- [C++ frontend development tips](#c-frontend-development-tips)
|
||||||
- [GDB integration](#gdb-integration)
|
- [GDB integration](#gdb-integration)
|
||||||
- [CUDA development tips](#cuda-development-tips)
|
- [CUDA development tips](#cuda-development-tips)
|
||||||
|
|
@ -850,6 +851,27 @@ The easiest way to use `lld` this is download the
|
||||||
ln -s /path/to/downloaded/ld.lld /usr/local/bin/ld
|
ln -s /path/to/downloaded/ld.lld /usr/local/bin/ld
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Use pre-compiled headers
|
||||||
|
|
||||||
|
Sometimes there's no way of getting around rebuilding lots of files, for example
|
||||||
|
editing `native_functions.yaml` usually means 1000+ files being rebuilt. If
|
||||||
|
you're using CMake newer than 3.16, you can enable pre-compiled headers by
|
||||||
|
setting `USE_PRECOMPILED_HEADERS=1` either on first setup, or in the
|
||||||
|
`CMakeCache.txt` file.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
USE_PRECOMPILED_HEADERS=1 python setup.py develop
|
||||||
|
```
|
||||||
|
|
||||||
|
This adds a build step where the compiler takes `<ATen/ATen.h>` and essentially
|
||||||
|
dumps it's internal AST to a file so the compiler can avoid repeating itself for
|
||||||
|
every `.cpp` file.
|
||||||
|
|
||||||
|
One caveat is that when enabled, this header gets included in every file by default.
|
||||||
|
Which may change what code is legal, for example:
|
||||||
|
- internal functions can never alias existing names in `<ATen/ATen.h>`
|
||||||
|
- names in `<ATen/ATen.h>` will work even if you don't explicitly include it.
|
||||||
|
|
||||||
### C++ frontend development tips
|
### C++ frontend development tips
|
||||||
|
|
||||||
We have very extensive tests in the [test/cpp/api](test/cpp/api) folder. The
|
We have very extensive tests in the [test/cpp/api](test/cpp/api) folder. The
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user