From f584735224a6bf84bb617c02e3539f748c53c480 Mon Sep 17 00:00:00 2001 From: Geoffrey C Danielson Date: Fri, 26 Oct 2018 10:56:58 -0600 Subject: [PATCH 1/3] add deprecation argument to CMakeLists to support macro disabling ordinal template parameters --- packages/tpetra/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/tpetra/CMakeLists.txt b/packages/tpetra/CMakeLists.txt index c62e635ab7cb..ec1c822e937f 100644 --- a/packages/tpetra/CMakeLists.txt +++ b/packages/tpetra/CMakeLists.txt @@ -13,6 +13,21 @@ TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION() TRIBITS_SET_ST_FOR_DEV_MODE(ST_FOR_DEV_PT_FOR_RELEASE) +# gcd 26 Oct 2018: Part of the great de-templating effort, +# allows users to switch at CMake time between using the old template +# parameters, using Tpetra_DISABLE_DEPRECATED_CODE. By default, +# this will be set to "ON", to keep old behaviors. + +SET (Tpetra_DISABLE_DEPRECATED_CODE_DEFAULT OFF) +MESSAGE (STATUS "Determine whether Tpetra will enable ordinal template arguments.") + +IF (Tpetra_DISABLE_DEPRECATED_CODE) + MESSAGE (STATUS " - Tpetra_DISABLE_DEPRECATED_CODE is ON, so Tpetra will assume you do not want the old template behavior.") + SET (Tpetra_DISABLE_DEPRECATED_CODE_DEFAULT ON) +ELSE() + MESSAGE (STATUS " - Tpetra_DISABLE_DEPRECATED_CODE is OFF, so Tpetra will assume you want the old template behavior.") +ENDIF() + # mfh 06 Nov 2017: Do users want to build Tpetra with CUDA enabled? # This doesn't meant that users actually want to instantiate Tpetra # objects for CUDA. See Trilinos GitHub issue #1939. From f65365f3cd4c3ab3adfb0934e3c77370b8c6b682 Mon Sep 17 00:00:00 2001 From: Geoffrey C Danielson Date: Fri, 2 Nov 2018 11:08:00 -0600 Subject: [PATCH 2/3] added tribits support for switching, added descriptive default message, added config support --- packages/tpetra/CMakeLists.txt | 13 +++---------- packages/tpetra/core/CMakeLists.txt | 8 ++++++++ packages/tpetra/core/cmake/TpetraCore_config.h.in | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/tpetra/CMakeLists.txt b/packages/tpetra/CMakeLists.txt index ec1c822e937f..e4d768c25fcd 100644 --- a/packages/tpetra/CMakeLists.txt +++ b/packages/tpetra/CMakeLists.txt @@ -15,18 +15,11 @@ TRIBITS_SET_ST_FOR_DEV_MODE(ST_FOR_DEV_PT_FOR_RELEASE) # gcd 26 Oct 2018: Part of the great de-templating effort, # allows users to switch at CMake time between using the old template -# parameters, using Tpetra_DISABLE_DEPRECATED_CODE. By default, +# parameters, using Tpetra_ENABLE_DEPRECATED_CODE. By default, # this will be set to "ON", to keep old behaviors. -SET (Tpetra_DISABLE_DEPRECATED_CODE_DEFAULT OFF) -MESSAGE (STATUS "Determine whether Tpetra will enable ordinal template arguments.") - -IF (Tpetra_DISABLE_DEPRECATED_CODE) - MESSAGE (STATUS " - Tpetra_DISABLE_DEPRECATED_CODE is ON, so Tpetra will assume you do not want the old template behavior.") - SET (Tpetra_DISABLE_DEPRECATED_CODE_DEFAULT ON) -ELSE() - MESSAGE (STATUS " - Tpetra_DISABLE_DEPRECATED_CODE is OFF, so Tpetra will assume you want the old template behavior.") -ENDIF() +SET (Tpetra_ENABLE_DEPRECATED_CODE_DEFAULT ON) +MESSAGE (STATUS "Determine whether Tpetra will enable ordinal template arguments and dynamic allocation. By default, this will be ON.") # mfh 06 Nov 2017: Do users want to build Tpetra with CUDA enabled? # This doesn't meant that users actually want to instantiate Tpetra diff --git a/packages/tpetra/core/CMakeLists.txt b/packages/tpetra/core/CMakeLists.txt index d8488f34c1dc..7ecd90c5742c 100644 --- a/packages/tpetra/core/CMakeLists.txt +++ b/packages/tpetra/core/CMakeLists.txt @@ -14,6 +14,14 @@ TRIBITS_ADD_EXPLICIT_INSTANTIATION_OPTION() # template instantiation (ETI). TRIBITS_ADD_ETI_SUPPORT() +# adding macro for deprecated code (templated L0 and G0, and dynamic allocation) +TRIBITS_ADD_OPTION_AND_DEFINE( + Tpetra_ENABLE_DEPRECATED_CODE + TPETRA_ENABLE_DEPRECATED_CODE + "Disable Tpetra deprecated code (templated ordinal types and dynamic graph/matrix allocation)" + Tpetra_ENABLE_DEPRECATED_CODE_DEFAULT +) + ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION) # FIXME (mfh 17 Dec 2014) We really just want a macro, not a CMake option. # This is mainly just for backwards compatibility. diff --git a/packages/tpetra/core/cmake/TpetraCore_config.h.in b/packages/tpetra/core/cmake/TpetraCore_config.h.in index 1c2ebd802a16..6177fd351a4f 100644 --- a/packages/tpetra/core/cmake/TpetraCore_config.h.in +++ b/packages/tpetra/core/cmake/TpetraCore_config.h.in @@ -2,6 +2,9 @@ #define TPETRACORE_CONFIG_H /* CMake uses this file to generate TpetraCore_config.h automatically */ +/* define if user is using the deprecated codebase (templated ordinals, dynamicprofile) or not */ +#cmakedefine TPETRA_ENABLE_DEPRECATED_CODE + /* define if new form of std::count is supported */ #cmakedefine HAVE_STD_NEW_COUNT_SYNTAX From 45c850aab607dee88c3795413ecabbccc4c68867 Mon Sep 17 00:00:00 2001 From: Geoffrey C Danielson Date: Fri, 2 Nov 2018 15:51:10 -0600 Subject: [PATCH 3/3] revise verbiage on deprecation and correct a cmake error --- packages/tpetra/CMakeLists.txt | 2 +- packages/tpetra/core/CMakeLists.txt | 4 ++-- packages/tpetra/core/cmake/TpetraCore_config.h.in | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/tpetra/CMakeLists.txt b/packages/tpetra/CMakeLists.txt index e4d768c25fcd..1d69c10d891d 100644 --- a/packages/tpetra/CMakeLists.txt +++ b/packages/tpetra/CMakeLists.txt @@ -19,7 +19,7 @@ TRIBITS_SET_ST_FOR_DEV_MODE(ST_FOR_DEV_PT_FOR_RELEASE) # this will be set to "ON", to keep old behaviors. SET (Tpetra_ENABLE_DEPRECATED_CODE_DEFAULT ON) -MESSAGE (STATUS "Determine whether Tpetra will enable ordinal template arguments and dynamic allocation. By default, this will be ON.") +MESSAGE (STATUS "Whether Tpetra enables deprecated code at compile time. Default is ON (deprecated code enabled).") # mfh 06 Nov 2017: Do users want to build Tpetra with CUDA enabled? # This doesn't meant that users actually want to instantiate Tpetra diff --git a/packages/tpetra/core/CMakeLists.txt b/packages/tpetra/core/CMakeLists.txt index 7ecd90c5742c..b3e2de39caed 100644 --- a/packages/tpetra/core/CMakeLists.txt +++ b/packages/tpetra/core/CMakeLists.txt @@ -18,8 +18,8 @@ TRIBITS_ADD_ETI_SUPPORT() TRIBITS_ADD_OPTION_AND_DEFINE( Tpetra_ENABLE_DEPRECATED_CODE TPETRA_ENABLE_DEPRECATED_CODE - "Disable Tpetra deprecated code (templated ordinal types and dynamic graph/matrix allocation)" - Tpetra_ENABLE_DEPRECATED_CODE_DEFAULT + "Whether Tpetra enables deprecated code at compile time. Default is ON (deprecated code enabled)." + ${Tpetra_ENABLE_DEPRECATED_CODE_DEFAULT} ) ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION) diff --git a/packages/tpetra/core/cmake/TpetraCore_config.h.in b/packages/tpetra/core/cmake/TpetraCore_config.h.in index 6177fd351a4f..11d60928e536 100644 --- a/packages/tpetra/core/cmake/TpetraCore_config.h.in +++ b/packages/tpetra/core/cmake/TpetraCore_config.h.in @@ -2,7 +2,7 @@ #define TPETRACORE_CONFIG_H /* CMake uses this file to generate TpetraCore_config.h automatically */ -/* define if user is using the deprecated codebase (templated ordinals, dynamicprofile) or not */ +/* Define whether Tpetra enables deprecated code at compile time. */ #cmakedefine TPETRA_ENABLE_DEPRECATED_CODE /* define if new form of std::count is supported */