Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require C++17 for compiling Thrust and CUB #3255

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 0 additions & 136 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@
"CUB_ENABLE_TESTING": true,
"CUB_ENABLE_EXAMPLES": true,
"CUB_SEPARATE_CATCH2": true,
"CUB_ENABLE_DIALECT_CPP11": true,
"CUB_ENABLE_DIALECT_CPP14": true,
"CUB_ENABLE_DIALECT_CPP17": true,
"CUB_ENABLE_DIALECT_CPP20": true,
"THRUST_ENABLE_MULTICONFIG": true,
Expand Down Expand Up @@ -232,30 +230,10 @@
"CUB_ENABLE_TESTING": true,
"CUB_ENABLE_EXAMPLES": true,
"CUB_SEPARATE_CATCH2": true,
"CUB_ENABLE_DIALECT_CPP11": false,
"CUB_ENABLE_DIALECT_CPP14": false,
"CUB_ENABLE_DIALECT_CPP17": false,
"CUB_ENABLE_DIALECT_CPP20": false
}
},
{
"name": "cub-cpp11",
"displayName": "CUB: C++11",
"inherits": "cub-base",
"cacheVariables": {
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
"CUB_ENABLE_DIALECT_CPP11": true
}
},
{
"name": "cub-cpp14",
"displayName": "CUB: C++14",
"inherits": "cub-base",
"cacheVariables": {
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
"CUB_ENABLE_DIALECT_CPP14": true
}
},
{
"name": "cub-cpp17",
"displayName": "CUB: C++17",
Expand Down Expand Up @@ -289,24 +267,6 @@
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP20": false
}
},
{
"name": "thrust-cpp11",
"displayName": "Thrust: C++11",
"inherits": "thrust-base",
"cacheVariables": {
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP11": true
}
},
{
"name": "thrust-cpp14",
"displayName": "Thrust: C++14",
"inherits": "thrust-base",
"cacheVariables": {
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP14": true
}
},
{
"name": "thrust-cpp17",
"displayName": "Thrust: C++17",
Expand Down Expand Up @@ -520,14 +480,6 @@
"libcudacxx-base"
]
},
{
"name": "cub-cpp11",
"configurePreset": "cub-cpp11"
},
{
"name": "cub-cpp14",
"configurePreset": "cub-cpp14"
},
{
"name": "cub-cpp17",
"configurePreset": "cub-cpp17"
Expand All @@ -536,14 +488,6 @@
"name": "cub-cpp20",
"configurePreset": "cub-cpp20"
},
{
"name": "thrust-cpp11",
"configurePreset": "thrust-cpp11"
},
{
"name": "thrust-cpp14",
"configurePreset": "thrust-cpp14"
},
{
"name": "thrust-cpp17",
"configurePreset": "thrust-cpp17"
Expand Down Expand Up @@ -736,16 +680,6 @@
}
}
},
{
"name": "cub-nolid-cpp11",
"configurePreset": "cub-cpp11",
"inherits": "cub-nolid-base"
},
{
"name": "cub-nolid-cpp14",
"configurePreset": "cub-cpp14",
"inherits": "cub-nolid-base"
},
{
"name": "cub-nolid-cpp17",
"configurePreset": "cub-cpp17",
Expand All @@ -756,16 +690,6 @@
"configurePreset": "cub-cpp20",
"inherits": "cub-nolid-base"
},
{
"name": "cub-lid0-cpp11",
"configurePreset": "cub-cpp11",
"inherits": "cub-lid0-base"
},
{
"name": "cub-lid0-cpp14",
"configurePreset": "cub-cpp14",
"inherits": "cub-lid0-base"
},
{
"name": "cub-lid0-cpp17",
"configurePreset": "cub-cpp17",
Expand All @@ -776,16 +700,6 @@
"configurePreset": "cub-cpp20",
"inherits": "cub-lid0-base"
},
{
"name": "cub-lid1-cpp11",
"configurePreset": "cub-cpp11",
"inherits": "cub-lid1-base"
},
{
"name": "cub-lid1-cpp14",
"configurePreset": "cub-cpp14",
"inherits": "cub-lid1-base"
},
{
"name": "cub-lid1-cpp17",
"configurePreset": "cub-cpp17",
Expand All @@ -796,16 +710,6 @@
"configurePreset": "cub-cpp20",
"inherits": "cub-lid1-base"
},
{
"name": "cub-lid2-cpp11",
"configurePreset": "cub-cpp11",
"inherits": "cub-lid2-base"
},
{
"name": "cub-lid2-cpp14",
"configurePreset": "cub-cpp14",
"inherits": "cub-lid2-base"
},
{
"name": "cub-lid2-cpp17",
"configurePreset": "cub-cpp17",
Expand All @@ -816,16 +720,6 @@
"configurePreset": "cub-cpp20",
"inherits": "cub-lid2-base"
},
{
"name": "cub-cpp11",
"configurePreset": "cub-cpp11",
"inherits": "cub-base"
},
{
"name": "cub-cpp14",
"configurePreset": "cub-cpp14",
"inherits": "cub-base"
},
{
"name": "cub-cpp17",
"configurePreset": "cub-cpp17",
Expand Down Expand Up @@ -866,16 +760,6 @@
}
}
},
{
"name": "thrust-gpu-cpp11",
"configurePreset": "thrust-cpp11",
"inherits": "thrust-gpu-base"
},
{
"name": "thrust-gpu-cpp14",
"configurePreset": "thrust-cpp14",
"inherits": "thrust-gpu-base"
},
{
"name": "thrust-gpu-cpp17",
"configurePreset": "thrust-cpp17",
Expand All @@ -886,16 +770,6 @@
"configurePreset": "thrust-cpp20",
"inherits": "thrust-gpu-base"
},
{
"name": "thrust-cpu-cpp11",
"configurePreset": "thrust-cpp11",
"inherits": "thrust-cpu-base"
},
{
"name": "thrust-cpu-cpp14",
"configurePreset": "thrust-cpp14",
"inherits": "thrust-cpu-base"
},
{
"name": "thrust-cpu-cpp17",
"configurePreset": "thrust-cpp17",
Expand All @@ -906,16 +780,6 @@
"configurePreset": "thrust-cpp20",
"inherits": "thrust-cpu-base"
},
{
"name": "thrust-cpp11",
"configurePreset": "thrust-cpp11",
"inherits": "thrust-base"
},
{
"name": "thrust-cpp14",
"configurePreset": "thrust-cpp14",
"inherits": "thrust-base"
},
{
"name": "thrust-cpp17",
"configurePreset": "thrust-cpp17",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ But we will not invest significant time in triaging or fixing issues for older c
In the spirit of "You only support what you test", see our [CI Overview](https://github.com/NVIDIA/cccl/blob/main/ci-overview.md) for more information on exactly what we test.

### C++ Dialects
- C++11 (Deprecated in Thrust/CUB, to be removed in next major version)
- C++14 (Deprecated in Thrust/CUB, to be removed in next major version)
- C++11 (only libcu++)
- C++14 (only libcu++)
- C++17
- C++20

Expand Down
7 changes: 4 additions & 3 deletions ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ workflows:
# Old CTK/compiler
- {jobs: ['build'], std: 'minmax', ctk: '12.0', cxx: ['gcc7', 'gcc9', 'clang9', 'msvc2019']}
# Current CTK build-only
- {jobs: ['build'], std: [11, 14], cxx: ['gcc7', 'clang9']}
- {jobs: ['build'], std: [11, 14], cxx: ['gcc7', 'clang9'], project: 'libcudacxx'}
- {jobs: ['build'], std: [17], cxx: ['gcc7', 'clang9']}
Comment on lines +16 to +17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will spawn an additional libcu++ job for C++17, but @miscco says this is fine since building libcu++ is cheap.

- {jobs: ['build'], std: 'max', cxx: ['gcc8', 'gcc9', 'gcc10', 'gcc11', 'gcc12']}
- {jobs: ['build'], std: 'max', cxx: ['clang10', 'clang11', 'clang12', 'clang13', 'clang14', 'clang15', 'clang16', 'clang17']}
- {jobs: ['build'], std: 'max', cxx: ['msvc2019']}
Expand Down Expand Up @@ -246,11 +247,11 @@ projects:
stds: [11, 14, 17, 20]
cub:
name: 'CUB'
stds: [11, 14, 17, 20]
stds: [17, 20]
job_map: { test: ['test_nolid', 'test_lid0', 'test_lid1', 'test_lid2'] }
thrust:
name: 'Thrust'
stds: [11, 14, 17, 20]
stds: [17, 20]
job_map: { test: ['test_cpu', 'test_gpu'] }
cudax:
stds: [17, 20]
Expand Down
10 changes: 0 additions & 10 deletions cub/cmake/CubBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,6 @@ function(cub_build_target_list)
cmake_minimum_required(VERSION 3.18.3)
endif()

# Supported versions of MSVC do not distinguish between C++11 and C++14.
# Warn the user that they may be generating a ton of redundant targets.
if ("MSVC" STREQUAL "${CMAKE_CXX_COMPILER_ID}" AND
CUB_ENABLE_DIALECT_CPP11)
message(WARNING
"Supported versions of MSVC (2017+) do not distinguish between C++11 "
"and C++14. The requested C++11 targets will be built with C++14."
)
endif()

# Generic config flags:
macro(add_flag_option flag docstring default)
set(opt "CCCL_${flag}")
Expand Down
37 changes: 11 additions & 26 deletions cub/cub/util_cpp_dialect.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,9 @@

// Deprecation warnings may be silenced by defining the following macros. These
// may be combined.
// - CCCL_IGNORE_DEPRECATED_CPP_DIALECT:
// Ignore all deprecated C++ dialects and outdated compilers.
// - CCCL_IGNORE_DEPRECATED_CPP_11:
// Ignore deprecation warnings when compiling with C++11. C++03 and outdated
// compilers will still issue warnings.
// - CCCL_IGNORE_DEPRECATED_CPP_14:
// Ignore deprecation warnings when compiling with C++14. C++03 and outdated
// compilers will still issue warnings.
// - CCCL_IGNORE_DEPRECATED_COMPILER
// Ignore deprecation warnings when using deprecated compilers. Compiling
// with C++03, C++11 and C++14 will still issue warnings.
// with deprecated C++ dialects will still issue warnings.

# define CUB_CPP_DIALECT _CCCL_STD_VER

Expand All @@ -65,19 +57,18 @@
# define CUB_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)
# endif

// Compiler checks:
// clang-format off
# define CUB_COMPILER_DEPRECATION(REQ) \
CUB_COMP_DEPR_IMPL(CUB requires at least REQ. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this message.)

# define CUB_COMPILER_DEPRECATION_SOFT(REQ, CUR) \
CUB_COMP_DEPR_IMPL( \
CUB requires at least REQ. CUR is deprecated but still supported. CUR support will be removed in a \
future release. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
future release. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this message.)
// clang-format on

# ifndef CCCL_IGNORE_DEPRECATED_COMPILER

// Compiler checks:
# if _CCCL_COMPILER(GCC, <, 7)
CUB_COMPILER_DEPRECATION(GCC 7.0);
# elif _CCCL_COMPILER(CLANG, <, 7)
Expand All @@ -89,24 +80,18 @@ CUB_COMPILER_DEPRECATION(MSVC 2019(19.20 / 16.0 / 14.20));
// >=2017, <2019. Soft deprecation message:
CUB_COMPILER_DEPRECATION_SOFT(MSVC 2019(19.20 / 16.0 / 14.20), MSVC 2017);
# endif

# endif // CCCL_IGNORE_DEPRECATED_COMPILER

# if _CCCL_STD_VER < 2011
// <C++11. Hard upgrade message:
CUB_COMPILER_DEPRECATION(C++ 17);
# elif _CCCL_STD_VER == 2011 && !defined(CCCL_IGNORE_DEPRECATED_CPP_11)
// =C++11. Soft upgrade message:
CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 11);
# elif _CCCL_STD_VER == 2014 && !defined(CCCL_IGNORE_DEPRECATED_CPP_14)
// =C++14. Soft upgrade message:
CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 14);
# endif // _CCCL_STD_VER >= 2017

# undef CUB_COMPILER_DEPRECATION_SOFT
# undef CUB_COMPILER_DEPRECATION

// C++17 dialect check:
# ifndef CCCL_IGNORE_DEPRECATED_CPP_DIALECT
# if _CCCL_STD_VER < 2017
CUB_COMP_DEPR_IMPL(CUB requires at least C++ 17. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
# endif // _CCCL_STD_VER >= 2017
# endif

# undef CUB_COMP_DEPR_IMPL
# undef CUB_COMP_DEPR_IMPL0
# undef CUB_COMP_DEPR_IMPL1

#endif // !_CCCL_DOXYGEN_INVOKED
26 changes: 0 additions & 26 deletions lib/cmake/thrust/thrust-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -237,36 +237,10 @@ function(thrust_create_target target_name)
target_compile_definitions(${target_name} INTERFACE "THRUST_FORCE_64_BIT_OFFSET_TYPE")
endif()

# This would be nice to enforce, but breaks when using old cmake + new
# compiler, since cmake doesn't know what features the new compiler version
# supports.
# Leaving this here as a reminder not to add it back. Just let the
# compile-time checks in thrust/detail/config/cpp_dialect.h handle it.
#
# if (NOT TCT_IGNORE_DEPRECATED_CPP_DIALECT)
# if (TCT_IGNORE_DEPRECATED_CPP_11)
# target_compile_features(${target_name} INTERFACE cxx_std_11)
# else()
# target_compile_features(${target_name} INTERFACE cxx_std_14)
# endif()
# endif()

if (TCT_IGNORE_DEPRECATED_CPP_DIALECT OR CCCL_IGNORE_DEPRECATED_CPP_DIALECT)
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_DIALECT")
endif()

if (TCT_IGNORE_DEPRECATED_API OR CCCL_IGNORE_DEPRECATED_API)
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_API")
endif()

if (TCT_IGNORE_DEPRECATED_CPP_11 OR CCCL_IGNORE_DEPRECATED_CPP_11)
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_11")
endif()

if (TCT_IGNORE_DEPRECATED_CPP_14 OR CCCL_IGNORE_DEPRECATED_CPP_14)
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_14")
endif()

if (TCT_IGNORE_DEPRECATED_COMPILER OR CCCL_IGNORE_DEPRECATED_COMPILER)
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_COMPILER")
endif()
Expand Down
Loading
Loading