Skip to content

Commit bcb4444

Browse files
r-barnespytorchmergebot
authored andcommitted
PyTorch -> C++17 (pytorch#98209) (pytorch#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: pytorch#100557 Approved by: https://github.com/malfet
1 parent 6f13d68 commit bcb4444

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

aten/conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ requirements:
2626
about:
2727
home: https://github.com/pytorch/pytorch
2828
license: BSD
29-
summary: A TENsor library for C++14
29+
summary: A TENsor library for C++17
3030

3131
extra:
3232
recipe-maintainers:

aten/src/ATen/ATen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#if !defined(_MSC_VER) && __cplusplus < 201402L
4-
#error C++14 or later compatible compiler is required to use ATen.
3+
#if !defined(_MSC_VER) && __cplusplus < 201703L
4+
#error C++17 or later compatible compiler is required to use ATen.
55
#endif
66

77
#include <ATen/Context.h>

aten/src/ATen/cpu/tbb/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ endif()
121121
if(UNIX)
122122
add_definitions(-DUSE_PTHREAD)
123123

124-
check_cxx_compiler_flag("-std=c++14" SUPPORTS_STDCXX14)
125-
if(SUPPORTS_STDCXX14)
126-
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")
124+
check_cxx_compiler_flag("-std=c++17" SUPPORTS_STDCXX17)
125+
if(SUPPORTS_STDCXX17)
126+
set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}")
127127
endif()
128128

129129
check_cxx_compiler_flag("-mrtm -Werror" SUPPORTS_MRTM)

aten/src/ATen/test/test_install/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0)
22
find_package(ATen REQUIRED)
33
include_directories(${ATEN_INCLUDE_DIR})
44

5-
# C++14
5+
# C++17
66
if(not MSVC)
7-
set(CMAKE_CXX_FLAGS "--std=c++14 ${CMAKE_CXX_FLAGS}")
7+
set(CMAKE_CXX_FLAGS "--std=c++17 ${CMAKE_CXX_FLAGS}")
88
endif()
99
add_executable(main main.cpp)
1010
target_link_libraries(main ${ATEN_LIBRARIES})

c10/util/C++17.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
"You're trying to build PyTorch with a too old version of Clang. We need Clang 4 or later."
2323
#endif
2424

25-
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201402L)) || \
26-
(!defined(_MSC_VER) && __cplusplus < 201402L)
27-
#error You need C++14 to compile PyTorch
25+
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \
26+
(!defined(_MSC_VER) && __cplusplus < 201703L)
27+
#error You need C++17 to compile PyTorch
2828
#endif
2929

3030
#if defined(_WIN32) && (defined(min) || defined(max))

caffe2/contrib/aten/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# An ATen operator for Caffe2
22

33
ATen is a simple tensor library thats exposes the Tensor operations in Torch
4-
and PyTorch directly in C++14. This library provides a generated wrapper around the ATen API
4+
and PyTorch directly in C++17. This library provides a generated wrapper around the ATen API
55
that makes these functions available in Caffe2 as an operator. It also makes it accessible using the
66
ToffeeIR.
77

torch/csrc/api/include/torch/all.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#if !defined(_MSC_VER) && __cplusplus < 201402L
4-
#error C++14 or later compatible compiler is required to use PyTorch.
3+
#if !defined(_MSC_VER) && __cplusplus < 201703L
4+
#error C++17 or later compatible compiler is required to use PyTorch.
55
#endif
66

77
#include <torch/autograd.h>

0 commit comments

Comments
 (0)