Skip to content

Commit

Permalink
Merge Pull Request #11915 from uliegecsm/Trilinos/sacado-remove-old-c…
Browse files Browse the repository at this point in the history
…xx11

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: sacado(cleaning): removing old CXX11 related macros
PR Author: romintomasetti
  • Loading branch information
trilinos-autotester authored Jun 8, 2023
2 parents 4becdfe + 69ad15b commit 7e0c759
Show file tree
Hide file tree
Showing 39 changed files with 122 additions and 433 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ MPI_DEBUG/
SERIAL_DEBUG/
SERIAL_RELEASE/

/build
# People usually build Trilinos in a 'build' directory. Ignore it.
build*/

packages/tpetra/test/MatrixMatrix/matrices/*.m

packages/Sundance/Playa/doc/Doxygen/html/
Expand Down
3 changes: 0 additions & 3 deletions packages/sacado/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ int main()
CHECK_CXX_SOURCE_COMPILES("${SOURCE_C99_TR1_CMATH}"
HAS_C99_TR1_CMATH)

# FIXME: Remove this hard-coded setting. We always have C++11 now.
SET(HAVE_SACADO_CXX11 ON)

#
# C) Add the libraries, tests, and examples
#
Expand Down
3 changes: 0 additions & 3 deletions packages/sacado/cmake/Sacado_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@
/* Define if compiler supports c99 tr1 cmath functions */
#cmakedefine HAS_C99_TR1_CMATH

/* Define to enable C++11 support*/
#cmakedefine HAVE_SACADO_CXX11

/* Define to enable hierarchical parallelism support */
#if !defined(SACADO_VIEW_CUDA_HIERARCHICAL) && !defined(SACADO_VIEW_CUDA_HIERARCHICAL_DFAD)
#cmakedefine SACADO_VIEW_CUDA_HIERARCHICAL
Expand Down
3 changes: 0 additions & 3 deletions packages/sacado/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ ENDIF()
#mpl
TRIBITS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/mpl)
SET(HEADERS ${HEADERS}
mpl/Sacado_mpl_is_same.hpp
mpl/Sacado_mpl_is_convertible.hpp
mpl/Sacado_mpl_enable_if.hpp
mpl/Sacado_mpl_disable_if.hpp
mpl/Sacado_mpl_if.hpp
Expand Down Expand Up @@ -283,7 +281,6 @@ SET(HEADERS ${HEADERS}
mpl/Sacado_mpl_type_wrap.hpp
mpl/Sacado_mpl_is_placeholder.hpp
mpl/Sacado_mpl_integral_nonzero_constant.hpp
mpl/Sacado_mpl_void.hpp
mpl/Sacado_mpl_has_equal_to.hpp
)

Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_CacheFad_Ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,10 @@ FAD_UNARYOP_MACRO(atanh,
ATanhOp,
a = value_type(1)/(value_type(1)-v*v),
std::atanh(v))
#ifdef HAVE_SACADO_CXX11
FAD_UNARYOP_MACRO(cbrt,
CbrtOp,
a = value_type(1)/(value_type(3)*std::cbrt(v*v)),
std::cbrt(v))
#endif

#undef FAD_UNARYOP_MACRO

Expand Down
10 changes: 4 additions & 6 deletions packages/sacado/src/Sacado_ConfigDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,12 @@ Questions? Contact David M. Gay ([email protected]) or Eric T. Phipps
/* Determine if the new fad design is supported. Requies C++11,
and if gcc, version 4.8 or greater.
*/
#if defined(HAVE_SACADO_CXX11)
# if defined(__GNUC__) && !defined(__clang__)
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) )
# define SACADO_ENABLE_NEW_DESIGN 1
# endif
# else
#if defined(__GNUC__) && !defined(__clang__)
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) )
# define SACADO_ENABLE_NEW_DESIGN 1
# endif
#else
# define SACADO_ENABLE_NEW_DESIGN 1
#endif

#endif /* SACADO_CONFIGDEFS_H */
3 changes: 0 additions & 3 deletions packages/sacado/src/Sacado_ELRCacheFad_Ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include "Sacado_ELRCacheFad_Expression.hpp"
#include "Sacado_cmath.hpp"
#include "Sacado_mpl_disable_if.hpp"
#include "Sacado_mpl_is_same.hpp"
#include <ostream> // for std::ostream

namespace Sacado {
Expand Down Expand Up @@ -649,12 +648,10 @@ FAD_UNARYOP_MACRO(atanh,
ATanhOp,
a = scalar_type(1.0)/(scalar_type(1.0)-v*v),
std::atanh(v))
#ifdef HAVE_SACADO_CXX11
FAD_UNARYOP_MACRO(cbrt,
CbrtOp,
a = scalar_type(1.0)/(scalar_type(3.0)*std::cbrt(v*v)),
std::cbrt(v))
#endif

#undef FAD_UNARYOP_MACRO

Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_ELRFad_Ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,13 @@ FAD_UNARYOP_MACRO(fabs,
value_type(-expr.dx(i)),
expr.val() >= 0 ? value_type(+expr.fastAccessDx(i)) :
value_type(-expr.fastAccessDx(i)))
#ifdef HAVE_SACADO_CXX11
FAD_UNARYOP_MACRO(cbrt,
CbrtOp,
std::cbrt(expr.val()),
bar/(value_type(3)*std::cbrt(expr.val()*expr.val())),
false,
expr.dx(i)/(value_type(3)*std::cbrt(expr.val()*expr.val())),
expr.fastAccessDx(i)/(value_type(3)*std::cbrt(expr.val()*expr.val())))
#endif

#undef FAD_UNARYOP_MACRO

Expand Down
47 changes: 2 additions & 45 deletions packages/sacado/src/Sacado_Fad_Ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,12 @@ FAD_UNARYOP_MACRO(fabs,
fabs(expr.val()),
if_then_else( expr.val() >= 0, expr.dx(i), value_type(-expr.dx(i)) ),
if_then_else( expr.val() >= 0, expr.fastAccessDx(i), value_type(-expr.fastAccessDx(i)) ) )
#ifdef HAVE_SACADO_CXX11
FAD_UNARYOP_MACRO(cbrt,
CbrtOp,
using std::cbrt;,
cbrt(expr.val()),
expr.dx(i)/(value_type(3)*cbrt(expr.val()*expr.val())),
expr.fastAccessDx(i)/(value_type(3)*cbrt(expr.val()*expr.val())))
#endif

#undef FAD_UNARYOP_MACRO

Expand Down Expand Up @@ -2168,7 +2166,6 @@ namespace Sacado {
// Can't use the above macros because it is a ternary operator (sort of).
// Also, relies on C++11

#ifdef HAVE_SACADO_CXX11

namespace Sacado {
namespace Fad {
Expand Down Expand Up @@ -2461,7 +2458,7 @@ namespace Sacado {
template <typename CondT, typename T>
SACADO_INLINE_FUNCTION
typename mpl::disable_if<
mpl::is_same< typename Expr<T>::value_type,
std::is_same< typename Expr<T>::value_type,
typename Expr<T>::scalar_type>,
Expr< IfThenElseOp< CondT, ConstExpr<typename Expr<T>::scalar_type>,
Expr<T> > >
Expand All @@ -2478,7 +2475,7 @@ namespace Sacado {
template <typename CondT, typename T>
SACADO_INLINE_FUNCTION
typename mpl::disable_if<
mpl::is_same< typename Expr<T>::value_type,
std::is_same< typename Expr<T>::value_type,
typename Expr<T>::scalar_type>,
Expr< IfThenElseOp< CondT, Expr<T>,
ConstExpr<typename Expr<T>::scalar_type> > >
Expand All @@ -2494,12 +2491,8 @@ namespace Sacado {
}
}

#endif

//-------------------------- Relational Operators -----------------------

#ifdef HAVE_SACADO_CXX11

namespace Sacado {
namespace Fad {
template <typename T1, typename T2 = T1>
Expand Down Expand Up @@ -2542,42 +2535,6 @@ namespace Sacado { \
} \
}

#else

#define FAD_RELOP_MACRO(OP) \
namespace Sacado { \
namespace Fad { \
template <typename ExprT1, typename ExprT2> \
SACADO_INLINE_FUNCTION \
bool \
operator OP (const Expr<ExprT1>& expr1, \
const Expr<ExprT2>& expr2) \
{ \
return expr1.val() OP expr2.val(); \
} \
\
template <typename ExprT2> \
SACADO_INLINE_FUNCTION \
bool \
operator OP (const typename Expr<ExprT2>::value_type& a, \
const Expr<ExprT2>& expr2) \
{ \
return a OP expr2.val(); \
} \
\
template <typename ExprT1> \
SACADO_INLINE_FUNCTION \
bool \
operator OP (const Expr<ExprT1>& expr1, \
const typename Expr<ExprT1>::value_type& b) \
{ \
return expr1.val() OP b; \
} \
} \
}

#endif

FAD_RELOP_MACRO(==)
FAD_RELOP_MACRO(!=)
FAD_RELOP_MACRO(<)
Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_Fad_Ops_Fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ namespace Sacado {
template <typename ExprT> class ATanhOp;
template <typename ExprT> class AbsOp;
template <typename ExprT> class FAbsOp;
#ifdef HAVE_SACADO_CXX11
template <typename ExprT> class CbrtOp;
#endif
template <typename ExprT, bool is_simd = IsSimdType<ExprT>::value>
class SafeSqrtOp;

Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_Fad_SimpleFadOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ namespace Sacado {
return SimpleFad<ValueT>(a, t1, t2);
}

#ifdef HAVE_SACADO_CXX11
template <typename ValueT>
SimpleFad<ValueT>
cbrt(const SimpleFad<ValueT>& a) {
ValueT t1 = std::cbrt(a.val());
ValueT t2 = 1.0/(3.0*t1*t1);
return SimpleFad<ValueT>(a, t1, t2);
}
#endif

template <typename ValueT>
SimpleFad<ValueT>
Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_LFad_LogicalSparseOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,9 @@ FAD_UNARYOP_MACRO(abs,
FAD_UNARYOP_MACRO(fabs,
FAbsOp,
std::fabs(expr.val()))
#ifdef HAVE_SACADO_CXX11
FAD_UNARYOP_MACRO(cbrt,
CbrtOp,
std::cbrt(expr.val()))
#endif

#undef FAD_UNARYOP_MACRO

Expand Down
2 changes: 0 additions & 2 deletions packages/sacado/src/Sacado_MathFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ UNARYFUNC_MACRO(asinh, ASinhOp)
UNARYFUNC_MACRO(atanh, ATanhOp)
UNARYFUNC_MACRO(abs, AbsOp)
UNARYFUNC_MACRO(fabs, FAbsOp)
#ifdef HAVE_SACADO_CXX11
UNARYFUNC_MACRO(cbrt, CbrtOp)
#endif

#undef UNARYFUNC_MACRO

Expand Down
20 changes: 10 additions & 10 deletions packages/sacado/src/Sacado_SFINAE_Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
#ifndef SACADO_SFINAE_MACROS_H
#define SACADO_SFINAE_MACROS_H

#include <type_traits>

#include "Sacado_mpl_enable_if.hpp"
#include "Sacado_mpl_disable_if.hpp"
#include "Sacado_mpl_is_same.hpp"
#include "Sacado_mpl_is_convertible.hpp"
#include "Sacado_mpl_type_wrap.hpp"

/* Define some macros useful for disabling template function overloads */
#define SACADO_ENABLE_IF_SAME(TYPE1, TYPE2, RETURN_TYPE) \
typename mpl::enable_if_c<mpl::is_convertible< TYPE1 , TYPE2 >::value && ExprLevel<TYPE1>::value == ExprLevel<TYPE2>::value, RETURN_TYPE >::type
typename mpl::enable_if_c<std::is_convertible< TYPE1 , TYPE2 >::value && ExprLevel<TYPE1>::value == ExprLevel<TYPE2>::value, RETURN_TYPE >::type
#define SACADO_ENABLE_EXPR_FUNC(RETURN_TYPE) \
SACADO_ENABLE_IF_SAME(typename Expr<S>::value_type, value_type, RETURN_TYPE)
#define SACADO_ENABLE_EXPR_CTOR_DEF SACADO_ENABLE_EXPR_FUNC(void*)
Expand All @@ -50,7 +50,7 @@
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, value_type, RETURN_TYPE)
#define SACADO_EXP_ENABLE_EXPR_CTOR_DEF \
typename mpl::enable_if_c< \
mpl::is_convertible< typename Expr<S>::derived_type::value_type , \
std::is_convertible< typename Expr<S>::derived_type::value_type , \
value_type >::value && \
(ExprLevel< typename Expr<S>::derived_type::value_type >::value == \
ExprLevel< value_type >::value) && \
Expand All @@ -60,15 +60,15 @@
SACADO_ENABLE_IF_SAME(typename Expr<S>::derived_type::value_type, typename FAD::value_type, FAD&)

#define SACADO_ENABLE_IF_CONVERTIBLE(TYPE1, TYPE2, RETURN_TYPE) \
typename Sacado::mpl::enable_if<Sacado::mpl::is_convertible< TYPE1 , TYPE2 >, RETURN_TYPE >::type
typename Sacado::mpl::enable_if<std::is_convertible< TYPE1 , TYPE2 >, RETURN_TYPE >::type
#define SACADO_ENABLE_VALUE_FUNC(RETURN_TYPE) \
SACADO_ENABLE_IF_CONVERTIBLE(S, value_type, RETURN_TYPE)
#define SACADO_ENABLE_VALUE_CTOR_DEF SACADO_ENABLE_VALUE_FUNC(void*)
#define SACADO_ENABLE_VALUE_CTOR_DECL SACADO_ENABLE_VALUE_CTOR_DEF = 0

#define SACADO_EXP_ENABLE_VALUE_CTOR_DEF \
typename mpl::enable_if_c< \
Sacado::mpl::is_convertible< S , value_type >::value && \
std::is_convertible< S , value_type >::value && \
!is_view, void* >::type
#define SACADO_EXP_ENABLE_VALUE_CTOR_DECL SACADO_EXP_ENABLE_VALUE_CTOR_DEF = 0

Expand All @@ -83,12 +83,12 @@
OP< typename Expr<T1>::derived_type, typename Expr<T2>::derived_type, false, false, typename T1::expr_spec_type > \
>::type
#define SACADO_FAD_OP_ENABLE_SCALAR_EXPR(OP) \
typename mpl::disable_if<mpl::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< ConstExpr<typename Expr<T>::scalar_type>, Expr<T> > > >::type
typename mpl::disable_if<std::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< ConstExpr<typename Expr<T>::scalar_type>, Expr<T> > > >::type
#define SACADO_FAD_OP_ENABLE_EXPR_SCALAR(OP) \
typename mpl::disable_if<mpl::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< Expr<T>, ConstExpr<typename Expr<T>::scalar_type> > > >::type
typename mpl::disable_if<std::is_same< typename Expr<T>::value_type, typename Expr<T>::scalar_type>, Expr< OP< Expr<T>, ConstExpr<typename Expr<T>::scalar_type> > > >::type
#define SACADO_FAD_EXP_OP_ENABLE_SCALAR_EXPR(OP) \
typename mpl::disable_if<mpl::is_same< typename T::value_type, typename T::scalar_type>, OP< typename T::scalar_type, typename Expr<T>::derived_type, true, false, typename T::expr_spec_type > >::type
typename mpl::disable_if<std::is_same< typename T::value_type, typename T::scalar_type>, OP< typename T::scalar_type, typename Expr<T>::derived_type, true, false, typename T::expr_spec_type > >::type
#define SACADO_FAD_EXP_OP_ENABLE_EXPR_SCALAR(OP) \
typename mpl::disable_if<mpl::is_same< typename T::value_type, typename T::scalar_type>, OP< typename Expr<T>::derived_type, typename T::scalar_type, false, true, typename T::expr_spec_type > >::type
typename mpl::disable_if<std::is_same< typename T::value_type, typename T::scalar_type>, OP< typename Expr<T>::derived_type, typename T::scalar_type, false, true, typename T::expr_spec_type > >::type

#endif // SACADO_SFINAE_MACROS_H
4 changes: 0 additions & 4 deletions packages/sacado/src/Sacado_ScalarFlopCounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ Sacado::FlopCounterPack::FlopCounts::flopCountsNames[] =
,"log"
,"log10"
,"sqrt"
#ifdef HAVE_SACADO_CXX11
,"cbrt"
#endif
,"cos"
,"sin"
,"tan"
Expand Down Expand Up @@ -162,9 +160,7 @@ Sacado::FlopCounterPack::FlopCounts::getSummaryType(Sacado::FlopCounterPack::Flo
case LOG:
case LOG10:
case SQRT:
#ifdef HAVE_SACADO_CXX11
case CBRT:
#endif
case COS:
case SIN:
case TAN:
Expand Down
10 changes: 1 addition & 9 deletions packages/sacado/src/Sacado_ScalarFlopCounter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ namespace Sacado {
class FlopCounts {
public:

#ifdef HAVE_SACADO_CXX11
/// Number of total operation supported up till now
enum { NUM_OPS = 35 };
#else
/// Number of total operation supported up till now
enum { NUM_OPS = 34 };
#endif

/// Enum for operations
enum EFlopType {
ASSIGN
Expand All @@ -75,9 +71,7 @@ namespace Sacado {
,LOG
,LOG10
,SQRT
#ifdef HAVE_SACADO_CXX11
,CBRT
#endif
,COS
,SIN
,TAN
Expand Down Expand Up @@ -458,9 +452,7 @@ namespace Sacado {
SCALAR_FLOP_COUNTER_UNARY_FUNC(log,FlopCounts::LOG)
SCALAR_FLOP_COUNTER_UNARY_FUNC(log10,FlopCounts::LOG10)
SCALAR_FLOP_COUNTER_UNARY_FUNC(sqrt,FlopCounts::SQRT)
#ifdef HAVE_SACADO_CXX11
SCALAR_FLOP_COUNTER_UNARY_FUNC(cbrt,FlopCounts::CBRT)
#endif
SCALAR_FLOP_COUNTER_UNARY_FUNC(cos,FlopCounts::COS)
SCALAR_FLOP_COUNTER_UNARY_FUNC(sin,FlopCounts::SIN)
SCALAR_FLOP_COUNTER_UNARY_FUNC(tan,FlopCounts::TAN)
Expand Down
3 changes: 1 addition & 2 deletions packages/sacado/src/Sacado_Tay_CacheTaylorOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,15 +1613,14 @@ TAYLOR_BINARYOP_MACRO(operator/, DivisionOp)
// can't conflict with the general definition, so we need to use
// Substitution Failure Is Not An Error
#include "Sacado_mpl_disable_if.hpp"
#include "Sacado_mpl_is_same.hpp"

#define TAYLOR_SFINAE_BINARYOP_MACRO(OPNAME,OP) \
namespace Sacado { \
namespace Tay { \
template <typename T1, typename T2> \
inline \
typename \
mpl::disable_if< mpl::is_same<T1,T2>, \
mpl::disable_if< std::is_same<T1,T2>, \
Expr<BinaryExpr<Expr<T1>, Expr<T2>, OP> > >::type \
OPNAME (const Expr<T1>& expr1, const Expr<T2>& expr2) \
{ \
Expand Down
Loading

0 comments on commit 7e0c759

Please sign in to comment.