PyTorch -> C++17 (#98209) (#100557)

<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 4f0b524</samp>

This pull request updates the codebase and the documentation to use C++17 instead of C++14 as the minimum required C++ standard. This affects the `ATen`, `c10`, and `torch` libraries and their dependencies, as well as the CI system and the `conda` package metadata.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100557
Approved by: https://github.com/malfet
This commit is contained in:
Richard Barnes
2023-05-19 00:49:08 +00:00
committed by PyTorch MergeBot
parent 6f13d6892a
commit bcb4444cec
7 changed files with 14 additions and 14 deletions

View File

@ -26,7 +26,7 @@ requirements:
about: about:
home: https://github.com/pytorch/pytorch home: https://github.com/pytorch/pytorch
license: BSD license: BSD
summary: A TENsor library for C++14 summary: A TENsor library for C++17
extra: extra:
recipe-maintainers: recipe-maintainers:

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#if !defined(_MSC_VER) && __cplusplus < 201402L #if !defined(_MSC_VER) && __cplusplus < 201703L
#error C++14 or later compatible compiler is required to use ATen. #error C++17 or later compatible compiler is required to use ATen.
#endif #endif
#include <ATen/Context.h> #include <ATen/Context.h>

View File

@ -121,9 +121,9 @@ endif()
if(UNIX) if(UNIX)
add_definitions(-DUSE_PTHREAD) add_definitions(-DUSE_PTHREAD)
check_cxx_compiler_flag("-std=c++14" SUPPORTS_STDCXX14) check_cxx_compiler_flag("-std=c++17" SUPPORTS_STDCXX17)
if(SUPPORTS_STDCXX14) if(SUPPORTS_STDCXX17)
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
endif() endif()
check_cxx_compiler_flag("-mrtm -Werror" SUPPORTS_MRTM) check_cxx_compiler_flag("-mrtm -Werror" SUPPORTS_MRTM)

View File

@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0)
find_package(ATen REQUIRED) find_package(ATen REQUIRED)
include_directories(${ATEN_INCLUDE_DIR}) include_directories(${ATEN_INCLUDE_DIR})
# C++14 # C++17
if(not MSVC) if(not MSVC)
set(CMAKE_CXX_FLAGS "--std=c++14 ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "--std=c++17 ${CMAKE_CXX_FLAGS}")
endif() endif()
add_executable(main main.cpp) add_executable(main main.cpp)
target_link_libraries(main ${ATEN_LIBRARIES}) target_link_libraries(main ${ATEN_LIBRARIES})

View File

@ -22,9 +22,9 @@
"You're trying to build PyTorch with a too old version of Clang. We need Clang 4 or later." "You're trying to build PyTorch with a too old version of Clang. We need Clang 4 or later."
#endif #endif
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201402L)) || \ #if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \
(!defined(_MSC_VER) && __cplusplus < 201402L) (!defined(_MSC_VER) && __cplusplus < 201703L)
#error You need C++14 to compile PyTorch #error You need C++17 to compile PyTorch
#endif #endif
#if defined(_WIN32) && (defined(min) || defined(max)) #if defined(_WIN32) && (defined(min) || defined(max))

View File

@ -1,7 +1,7 @@
# An ATen operator for Caffe2 # An ATen operator for Caffe2
ATen is a simple tensor library thats exposes the Tensor operations in Torch ATen is a simple tensor library thats exposes the Tensor operations in Torch
and PyTorch directly in C++14. This library provides a generated wrapper around the ATen API and PyTorch directly in C++17. This library provides a generated wrapper around the ATen API
that makes these functions available in Caffe2 as an operator. It also makes it accessible using the that makes these functions available in Caffe2 as an operator. It also makes it accessible using the
ToffeeIR. ToffeeIR.

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#if !defined(_MSC_VER) && __cplusplus < 201402L #if !defined(_MSC_VER) && __cplusplus < 201703L
#error C++14 or later compatible compiler is required to use PyTorch. #error C++17 or later compatible compiler is required to use PyTorch.
#endif #endif
#include <torch/autograd.h> #include <torch/autograd.h>