[Reland] Use 3.27 as the minimum CMake version (#154783)
Reland of #153153, which was incidentally closed. Update the minimum CMake version to 3.27 because of it provides more CUDA targets such as CUDA::nvperf_host so that it is possible to remove some of our forked CUDA modules. See https://github.com/pytorch/pytorch/pull/153783. It's also possible to facilitate future third-party updates such as FBGEMM (its current shipped version requires 3.21). Pull Request resolved: https://github.com/pytorch/pytorch/pull/154783 Approved by: https://github.com/ezyang
This commit is contained in:
@@ -31,7 +31,6 @@ elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
|
||||
# Comment out nvidia repositories to prevent them from getting apt-get updated, see https://github.com/pytorch/pytorch/issues/74968
|
||||
# shellcheck disable=SC2046
|
||||
sed -i 's/.*nvidia.*/# &/' $(find /etc/apt/ -type f -name "*.list")
|
||||
|
||||
retry apt-get update
|
||||
retry apt-get -y install zip openssl
|
||||
else
|
||||
@@ -98,6 +97,7 @@ if [[ -z "$PYTORCH_ROOT" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
pushd "$PYTORCH_ROOT"
|
||||
retry pip install -q cmake
|
||||
python setup.py clean
|
||||
retry pip install -qr requirements.txt
|
||||
case ${DESIRED_PYTHON} in
|
||||
|
@@ -92,6 +92,7 @@ if [[ -z "$PYTORCH_ROOT" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
pushd "$PYTORCH_ROOT"
|
||||
retry pip install -q cmake
|
||||
python setup.py clean
|
||||
retry pip install -qr requirements.txt
|
||||
retry pip install -q numpy==2.0.1
|
||||
|
@@ -1,5 +1,5 @@
|
||||
boto3==1.35.42
|
||||
cmake==3.25.*
|
||||
cmake==3.27.*
|
||||
expecttest==0.3.0
|
||||
fbscribelogger==0.1.7
|
||||
filelock==3.6.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
# cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0023 NEW)
|
||||
|
||||
# Use compiler ID "AppleClang" instead of "Clang" for XCode. Not setting this
|
||||
@@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
# one is detected as "AppleClang".
|
||||
cmake_policy(SET CMP0010 NEW)
|
||||
cmake_policy(SET CMP0025 NEW)
|
||||
cmake_policy(SET CMP0126 OLD)
|
||||
|
||||
# Enables CMake to set LTO on compilers other than Intel.
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
@@ -16,6 +17,8 @@ cmake_policy(SET CMP0069 NEW)
|
||||
# we do this (and we don't if cmake is old), but it's nice when it's possible,
|
||||
# and it's possible on our Windows configs.
|
||||
cmake_policy(SET CMP0092 NEW)
|
||||
# Don't remove the FindCUDA module
|
||||
cmake_policy(SET CMP0146 OLD)
|
||||
|
||||
# Prohibit in-source builds
|
||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||
@@ -559,6 +562,10 @@ if(MSVC)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler /Zc:__cplusplus")
|
||||
|
||||
set(CMAKE_NINJA_CMCLDEPS_RC OFF)
|
||||
if(MSVC_Z7_OVERRIDE)
|
||||
# CMake set debug flags to use /Z7
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
|
||||
endif()
|
||||
foreach(
|
||||
flag_var
|
||||
CMAKE_C_FLAGS
|
||||
@@ -571,12 +578,6 @@ if(MSVC)
|
||||
CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
# Replace /Zi and /ZI with /Z7
|
||||
if(MSVC_Z7_OVERRIDE)
|
||||
if(${flag_var} MATCHES "/Z[iI]")
|
||||
string(REGEX REPLACE "/Z[iI]" "/Z7" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/Z[iI]")
|
||||
endif(MSVC_Z7_OVERRIDE)
|
||||
|
||||
if(${CAFFE2_USE_MSVC_STATIC_RUNTIME})
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
|
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
if(NOT MSVC)
|
||||
|
@@ -100,6 +100,7 @@ auto sum(int64_t N, Func f) {
|
||||
}
|
||||
|
||||
template <typename scalar_t, typename opmath_t, typename out_t>
|
||||
__ubsan_ignore_signed_int_overflow__
|
||||
std::enable_if_t<std::is_same_v<scalar_t, opmath_t>, void>
|
||||
gemm_notrans_(
|
||||
int64_t m,
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# This source code is licensed under the BSD-style license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
project(c10 CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested to build this target.")
|
||||
|
@@ -33,25 +33,6 @@ macro(custom_protobuf_find)
|
||||
set(__caffe2_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
if(MSVC)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL)
|
||||
if(${flag_var} MATCHES "/Z[iI7]")
|
||||
string(REGEX REPLACE "/Z[iI7]" "" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
if(MSVC_Z7_OVERRIDE)
|
||||
foreach(flag_var
|
||||
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/Z[iI]")
|
||||
string(REGEX REPLACE "/Z[iI]" "/Z7" ${flag_var} "${${flag_var}}")
|
||||
endif()
|
||||
endforeach(flag_var)
|
||||
endif(MSVC_Z7_OVERRIDE)
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0.0")
|
||||
message(WARNING "Ancient protobuf forces CMake compatibility")
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||
|
@@ -60,12 +60,15 @@ class CMake:
|
||||
cmake3_version = CMake._get_version(which("cmake3"))
|
||||
cmake_version = CMake._get_version(which("cmake"))
|
||||
|
||||
_cmake_min_version = LooseVersion("3.18.0")
|
||||
_cmake_min_version = LooseVersion("3.27.0")
|
||||
if all(
|
||||
ver is None or ver < _cmake_min_version
|
||||
for ver in [cmake_version, cmake3_version]
|
||||
):
|
||||
raise RuntimeError("no cmake or cmake3 with version >= 3.18.0 found")
|
||||
raise RuntimeError(
|
||||
"no cmake or cmake3 with version >= 3.27.0 found:"
|
||||
+ str([cmake_version, cmake3_version])
|
||||
)
|
||||
|
||||
if cmake3_version is None:
|
||||
cmake_command = "cmake"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Now it only builds the Torch python bindings.
|
||||
|
||||
if(NOT CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO)
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
project(torch CXX C)
|
||||
find_package(torch REQUIRED)
|
||||
option(USE_CUDA "Use CUDA" ON)
|
||||
|
@@ -1731,7 +1731,7 @@ class CppBuilder:
|
||||
definitions = " ".join(self._build_option.get_definitions())
|
||||
contents = textwrap.dedent(
|
||||
f"""
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
project(aoti_model LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
project(libshm C CXX)
|
||||
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
|
||||
|
||||
set(TORCH_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../)
|
||||
|
||||
|
Reference in New Issue
Block a user