diff --git a/.ci/manywheel/build_common.sh b/.ci/manywheel/build_common.sh index f70b8df4149c..74ce994207d4 100644 --- a/.ci/manywheel/build_common.sh +++ b/.ci/manywheel/build_common.sh @@ -151,7 +151,7 @@ if [[ "$USE_SPLIT_BUILD" == "true" ]]; then BUILD_LIBTORCH_WHL=0 BUILD_PYTHON_ONLY=1 \ BUILD_LIBTORCH_CPU_WITH_DEBUG=$BUILD_DEBUG_INFO \ USE_NCCL=${USE_NCCL} USE_RCCL=${USE_RCCL} USE_KINETO=${USE_KINETO} \ - python setup.py bdist_wheel -d /tmp/$WHEELHOUSE_DIR --cmake + CMAKE_FRESH=1 python setup.py bdist_wheel -d /tmp/$WHEELHOUSE_DIR echo "Finished setup.py bdist_wheel for split build (BUILD_PYTHON_ONLY)" else time CMAKE_ARGS=${CMAKE_ARGS[@]} \ diff --git a/.ci/wheel/build_wheel.sh b/.ci/wheel/build_wheel.sh index b6b0d978cc23..76206d9937ef 100755 --- a/.ci/wheel/build_wheel.sh +++ b/.ci/wheel/build_wheel.sh @@ -206,7 +206,7 @@ if [[ "$USE_SPLIT_BUILD" == "true" ]]; then BUILD_LIBTORCH_WHL=1 BUILD_PYTHON_ONLY=0 python setup.py bdist_wheel -d "$whl_tmp_dir" echo "Finished setup.py bdist_wheel for split build (BUILD_LIBTORCH_WHL)" echo "Calling setup.py bdist_wheel for split build (BUILD_PYTHON_ONLY)" - BUILD_PYTHON_ONLY=1 BUILD_LIBTORCH_WHL=0 python setup.py bdist_wheel -d "$whl_tmp_dir" --cmake + BUILD_LIBTORCH_WHL=0 BUILD_PYTHON_ONLY=1 CMAKE_FRESH=1 python setup.py bdist_wheel -d "$whl_tmp_dir" echo "Finished setup.py bdist_wheel for split build (BUILD_PYTHON_ONLY)" else python setup.py bdist_wheel -d "$whl_tmp_dir" diff --git a/README.md b/README.md index d5c9d019c518..149b65711656 100644 --- a/README.md +++ b/README.md @@ -384,14 +384,14 @@ with such a step. On Linux ```bash export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}" -python setup.py build --cmake-only +CMAKE_ONLY=1 python setup.py build ccmake build # or cmake-gui build ``` On macOS ```bash export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}" -MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build --cmake-only +MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ CMAKE_ONLY=1 python setup.py build ccmake build # or cmake-gui build ``` diff --git a/benchmarks/sparse/test_csr.sh b/benchmarks/sparse/test_csr.sh index 7bd43d08d901..e22c2df6ee54 100644 --- a/benchmarks/sparse/test_csr.sh +++ b/benchmarks/sparse/test_csr.sh @@ -8,7 +8,7 @@ echo "----- USE_MKL=1 -----" >> $OUTFILE rm -rf build export USE_MKL=1 -python setup.py build --cmake-only +CMAKE_ONLY=1 python setup.py build ccmake build # or cmake-gui build python setup.py install diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index e94401b5ca15..fac87cb3c11b 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -1670,7 +1670,10 @@ if(USE_KINETO) }" EXCEPTIONS_WORK) set(CMAKE_REQUIRED_LINK_OPTIONS "") if(NOT EXCEPTIONS_WORK) - message(FATAL_ERROR "Detected that statically linking against CUPTI causes exceptions to stop working. See https://github.com/pytorch/pytorch/issues/57744 for more details. Perhaps try: USE_CUPTI_SO=1 python setup.py develop --cmake") + message(FATAL_ERROR + "Detected that statically linking against CUPTI causes exceptions to stop working. " + "See https://github.com/pytorch/pytorch/issues/57744 for more details. " + "Perhaps try: USE_CUPTI_SO=1 CMAKE_FRESH=1 python setup.py develop") endif() endif() diff --git a/setup.py b/setup.py index e5ff9a426b53..26bfb0a8fd2f 100644 --- a/setup.py +++ b/setup.py @@ -1162,7 +1162,7 @@ build_update_message = """ To develop locally: $ python setup.py develop To force cmake to re-generate native build files (off by default): - $ python setup.py develop --cmake + $ CMAKE_FRESH=1 python setup.py develop """ diff --git a/test/cpp/tensorexpr/README.md b/test/cpp/tensorexpr/README.md index 055d2201b009..f86a50a65e80 100644 --- a/test/cpp/tensorexpr/README.md +++ b/test/cpp/tensorexpr/README.md @@ -40,8 +40,8 @@ We glob all the test files together in `CMakeLists.txt` so that you don't have to edit it every time you add a test. Unfortunately, this means that in order to get the build to pick up your new test file, you need to re-run cmake: -``` -python setup.py build --cmake +```bash +CMAKE_FRESH=1 python setup.py build ``` ## How do I run the tests? diff --git a/tools/linter/clang_tidy/generate_build_files.py b/tools/linter/clang_tidy/generate_build_files.py index af322e754b87..157b36d2257a 100644 --- a/tools/linter/clang_tidy/generate_build_files.py +++ b/tools/linter/clang_tidy/generate_build_files.py @@ -31,7 +31,8 @@ def gen_compile_commands() -> None: os.environ["USE_PRECOMPILED_HEADERS"] = "1" os.environ["CC"] = "clang" os.environ["CXX"] = "clang++" - run_cmd([sys.executable, "setup.py", "--cmake-only", "build"]) + os.environ["CMAKE_ONLY"] = "1" + run_cmd([sys.executable, "setup.py", "build"]) def run_autogen() -> None: diff --git a/tools/packaging/split_wheel.py b/tools/packaging/split_wheel.py index 1aa77aa5c694..fd52c39a22b0 100644 --- a/tools/packaging/split_wheel.py +++ b/tools/packaging/split_wheel.py @@ -76,11 +76,15 @@ def split_build(cmd: str) -> None: extra_env={"BUILD_LIBTORCH_WHL": "1", "BUILD_PYTHON_ONLY": "0"}, ) logger.info("Running %s for torch wheel", cmd) - # NOTE: Passing --cmake is necessary here since the torch frontend has it's + # NOTE: Passing CMAKE_FRESH=1 is necessary here since the torch frontend has it's # own cmake files that it needs to generate setup_py( - [cmd, "--cmake"], - extra_env={"BUILD_LIBTORCH_WHL": "0", "BUILD_PYTHON_ONLY": "1"}, + [cmd], + extra_env={ + "BUILD_LIBTORCH_WHL": "0", + "BUILD_PYTHON_ONLY": "1", + "CMAKE_FRESH": "1", + }, )