Skip to content

Commit

Permalink
Merge Pull Request #10835 from trilinos/Trilinos/master_merge_2022080…
Browse files Browse the repository at this point in the history
…4_193812

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20220804_193812 branch to master
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester committed Aug 8, 2022
2 parents 171b69a + 53fce55 commit e95cb00
Show file tree
Hide file tree
Showing 185 changed files with 3,242 additions and 14,389 deletions.
Expand Up @@ -91,6 +91,7 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET( EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DBUILD_SHARED_LIBS:BOOL=ON"
"-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"
"-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
"-DCMAKE_AR=/usr/bin/ar"

Expand Down
Expand Up @@ -83,7 +83,8 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET_DEFAULT(Trilinos_EXCLUDE_PACKAGES ${EXTRA_EXCLUDE_PACKAGES} TriKota Optika Pamgen)

SET(EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE}"
"-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"

"-DTrilinos_ENABLE_COMPLEX:BOOL=OFF"
"-DCMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL=OFF"
Expand Down
Expand Up @@ -86,6 +86,7 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-DCMAKE_CXX_STANDARD=17"

"-DTrilinos_ENABLE_COMPLEX:BOOL=OFF"

Expand Down
Expand Up @@ -85,9 +85,10 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET(EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"
"-DCMAKE_VERBOSE_MAKEFILE=ON"


"-DTrilinos_ENABLE_Fortran=OFF"

"-DSuperLU_INCLUDE_DIRS=$ENV{SUPERLU_INC}"
Expand Down
Expand Up @@ -83,6 +83,7 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET(EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"
"-DCMAKE_VERBOSE_MAKEFILE=ON"

"-DTrilinos_ENABLE_COMPLEX:BOOL=OFF"
Expand Down
Expand Up @@ -78,6 +78,7 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET(EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"
"-DCMAKE_VERBOSE_MAKEFILE=ON"

"-DTrilinos_ENABLE_COMPLEX:BOOL=ON"
Expand Down
Expand Up @@ -78,6 +78,7 @@ MACRO(TRILINOS_SYSTEM_SPECIFIC_CTEST_DRIVER)
SET(EXTRA_SYSTEM_CONFIGURE_OPTIONS
"-DBUILD_SHARED_LIBS=ON"
"-DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
"-DCMAKE_CXX_STANDARD=17"
"-DCMAKE_VERBOSE_MAKEFILE=ON"

"-DSuperLU_INCLUDE_DIRS=$ENV{SUPERLU_INC}"
Expand Down
7 changes: 4 additions & 3 deletions packages/amesos2/src/Amesos2_ShyLUBasker.cpp
Expand Up @@ -41,21 +41,19 @@
//
// @HEADER
#include "Amesos2_config.h"
#include "Amesos2_ShyLUBasker_decl.hpp"

#ifdef HAVE_AMESOS2_EXPLICIT_INSTANTIATION

#include "Amesos2_ShyLUBasker_decl.hpp"
#include "Amesos2_ShyLUBasker_def.hpp"
#include "Amesos2_ExplicitInstantiationHelpers.hpp"
#include "TpetraCore_ETIHelperMacros.h"


namespace Amesos2 {

#ifdef HAVE_AMESOS2_EPETRA
AMESOS2_SOLVER_EPETRA_INST(ShyLUBasker);
#endif
}

#define AMESOS2_SHYLUBASKER_LOCAL_INSTANT(S,LO,GO,N) \
template class Amesos2::ShyLUBasker<Tpetra::CrsMatrix<S, LO, GO, N>, \
Expand All @@ -65,4 +63,7 @@ TPETRA_ETI_MANGLING_TYPEDEFS()

TPETRA_INSTANTIATE_SLGN_NO_ORDINAL_SCALAR(AMESOS2_SHYLUBASKER_LOCAL_INSTANT)

#define AMESOS2_KOKKOS_IMPL_SOLVER_NAME ShyLUBasker
#include "Amesos2_Kokkos_Impl.hpp"
}
#endif // HAVE_AMESOS2_EXPLICIT_INSTANTIATION
20 changes: 19 additions & 1 deletion packages/amesos2/src/Amesos2_ShyLUBasker_FunctionMap.hpp
Expand Up @@ -75,7 +75,25 @@ namespace Amesos2 {
* \brief Pass function calls to ShyLUBasker based on data type.
*/
// TODO : Do we need the specializations for ShyLUBasker ??
#ifdef HAVE_TEUCHOS_COMPLEX
template <>
struct FunctionMap<ShyLUBasker,Kokkos::complex<double>>
{
static std::complex<double> * convert_scalar(Kokkos::complex<double> * pData) {
return reinterpret_cast<std::complex<double> *>(pData);
}
};

#endif // HAVE_TEUCHOS_COMPLEX

// if not specialized, then assume generic conversion is fine
template <typename scalar_t>
struct FunctionMap<ShyLUBasker,scalar_t>
{
static scalar_t * convert_scalar(scalar_t * pData) {
return pData; // no conversion necessary
}
};


/* \endcond ShyLUBasker_function_specializations */
Expand Down
102 changes: 19 additions & 83 deletions packages/amesos2/src/Amesos2_ShyLUBasker_TypeMap.hpp
Expand Up @@ -67,77 +67,6 @@

#include "Amesos2_TypeMap.hpp"


#ifdef HAVE_TEUCHOS_COMPLEX

/* ==================== Conversion ==================== */
namespace Teuchos {

/**
* \defgroup slu_conversion Conversion definitions for SLU types.
*
* Define specializations of Teuchos::as<> for the SLU types.
*
* These specializations are meant to work with any complex data type that
* implements the same interface as the STL complex type.
*
* @{
*/

#ifndef HAVE_AMESOS2_KLU2

template <>
class ValueTypeConversionTraits<std::complex<double>, std::complex<float> >
{
public:
static std::complex<double> convert( const std::complex<float> t )
{
std::complex<double> ret(Teuchos::as<double>(t.real()),
Teuchos::as<double>(t.imag()));
return( ret );
}

static std::complex<double> safeConvert( const std::complex<float> t )
{
std::complex<double> ret(Teuchos::as<double>(t.real()),
Teuchos::as<double>(t.imag()));
return( ret );
}
};


template <>
class ValueTypeConversionTraits<std::complex<float> , std::complex<double> >
{
public:
static std::complex<float> convert( const std::complex<double> t )
{
float ret_r = Teuchos::as<float>( t.real() );
float ret_i = Teuchos::as<float>( t.imag() );
std::complex<float> ret (ret_r, ret_i);
return (ret);
}

// No special checks for safe Convert
static std::complex<float> safeConvert( const std::complex<double> t )
{
float ret_r = Teuchos::as<float>( t.real() );
float ret_i = Teuchos::as<float>( t.imag() );
std::complex<float> ret (ret_r, ret_i);
return (ret);
}
};


#endif
//@} End Conversion group


} // end namespace Teuchos

#endif // HAVE_TEUCHOS_COMPLEX


namespace Amesos2 {

template <class, class> class ShyLUBasker;
Expand All @@ -151,18 +80,15 @@ template <class, class> class ShyLUBasker;
template <>
struct TypeMap<ShyLUBasker,float>
{
static float dtype;
typedef float dtype;
typedef float type;
typedef float magnitude_type;
};


template <>
struct TypeMap<ShyLUBasker,double>
{
static double dtype;
typedef double dtype;
typedef double type;
typedef double magnitude_type;
};


Expand All @@ -171,20 +97,30 @@ struct TypeMap<ShyLUBasker,double>
template <>
struct TypeMap<ShyLUBasker,std::complex<float> >
{
static std::complex<double> dtype;
typedef std::complex<double> type;
typedef double magnitude_type;
typedef std::complex<double> dtype;
typedef Kokkos::complex<double> type;
};


template <>
struct TypeMap<ShyLUBasker,std::complex<double> >
{
static std::complex<double> dtype;
typedef std::complex<double> type;
typedef double magnitude_type;
typedef std::complex<double> dtype;
typedef Kokkos::complex<double> type;
};

template <>
struct TypeMap<ShyLUBasker,Kokkos::complex<float> >
{
typedef std::complex<double> dtype;
typedef Kokkos::complex<double> type;
};

template <>
struct TypeMap<ShyLUBasker,Kokkos::complex<double> >
{
typedef std::complex<double> dtype;
typedef Kokkos::complex<double> type;
};

#endif // HAVE_TEUCHOS_COMPLEX

Expand Down
70 changes: 48 additions & 22 deletions packages/amesos2/src/Amesos2_ShyLUBasker_decl.hpp
Expand Up @@ -84,26 +84,32 @@ class ShyLUBasker : public SolverCore<Amesos2::ShyLUBasker, Matrix, Vector>
static const char* name; // declaration. Initialization outside.


typedef ShyLUBasker<Matrix,Vector> type;
typedef ShyLUBasker<Matrix,Vector> type;

typedef SolverCore<Amesos2::ShyLUBasker,Matrix,Vector> super_type;
typedef SolverCore<Amesos2::ShyLUBasker,Matrix,Vector> super_type;

// Since typedef's are not inheritted, go grab them
typedef typename super_type::scalar_type scalar_type;
typedef typename super_type::local_ordinal_type local_ordinal_type;
typedef typename super_type::global_ordinal_type global_ordinal_type;
typedef typename super_type::global_size_type global_size_type;
typedef typename super_type::node_type node_type;
typedef typename super_type::scalar_type scalar_type;
typedef typename super_type::local_ordinal_type local_ordinal_type;
typedef typename super_type::global_ordinal_type global_ordinal_type;
typedef typename super_type::global_size_type global_size_type;
typedef typename super_type::node_type node_type;

typedef TypeMap<Amesos2::ShyLUBasker,scalar_type> type_map;
typedef TypeMap<Amesos2::ShyLUBasker,scalar_type> type_map;
typedef typename type_map::type shylubasker_type;
typedef typename type_map::dtype shylubasker_dtype;

typedef typename type_map::type slu_type;
typedef typename type_map::magnitude_type magnitude_type;
typedef typename type_map::type slu_type;

typedef FunctionMap<Amesos2::ShyLUBasker,slu_type> function_map;
typedef FunctionMap<Amesos2::ShyLUBasker,shylubasker_type> function_map;

typedef Matrix matrix_type;
typedef MatrixAdapter<matrix_type> matrix_adapter_type;
typedef Matrix matrix_type;
typedef MatrixAdapter<matrix_type> matrix_adapter_type;

typedef Kokkos::DefaultHostExecutionSpace HostExecSpaceType;
// typedef Kokkos::View<local_ordinal_type*, HostExecSpaceType> host_size_type_array;
typedef Kokkos::View<local_ordinal_type*, HostExecSpaceType> host_ordinal_type_array;
typedef Kokkos::View<shylubasker_type*, HostExecSpaceType> host_value_type_array;


ShyLUBasker( Teuchos::RCP<const Matrix> A,
Expand Down Expand Up @@ -188,21 +194,27 @@ class ShyLUBasker : public SolverCore<Amesos2::ShyLUBasker, Matrix, Vector>
// Members
int num_threads;

// The following Arrays are persisting storage arrays for A, X, and B
/// Stores the values of the nonzero entries for ShyLUBasker
Teuchos::Array<slu_type> nzvals_;
// The following Kokkos::View's are persisting storage for A's CCS arrays
/// Stores the values of the nonzero entries for Umfpack
host_value_type_array nzvals_view_;
/// Stores the location in \c Ai_ and Aval_ that starts row j
Teuchos::Array<local_ordinal_type> rowind_;
host_ordinal_type_array rowind_view_;
/// Stores the row indices of the nonzero entries
Teuchos::Array<local_ordinal_type> colptr_;
host_ordinal_type_array colptr_view_;


bool is_contiguous_;

typedef typename Kokkos::View<shylubasker_type**, Kokkos::LayoutLeft,
typename HostExecSpaceType::memory_space> host_solve_array_t;

/// Persisting 1D store for X
mutable Teuchos::Array<slu_type> xvals_; local_ordinal_type ldx_;
mutable host_solve_array_t xValues_;
int ldx_;

/// Persisting 1D store for B
mutable Teuchos::Array<slu_type> bvals_; local_ordinal_type ldb_;
mutable host_solve_array_t bValues_;
int ldb_;

/*Handle for ShyLUBasker object*/

Expand All @@ -215,9 +227,9 @@ class ShyLUBasker : public SolverCore<Amesos2::ShyLUBasker, Matrix, Vector>
*/
typedef Kokkos::OpenMP Exe_Space;
// Instance for non-transpose solves
::BaskerNS::BaskerTrilinosInterface<local_ordinal_type, slu_type, Exe_Space> *ShyLUbasker;
::BaskerNS::BaskerTrilinosInterface<local_ordinal_type, shylubasker_dtype, Exe_Space> *ShyLUbasker;
// Instance for transpose solves
::BaskerNS::BaskerTrilinosInterface<local_ordinal_type, slu_type, Exe_Space> *ShyLUbaskerTr;
::BaskerNS::BaskerTrilinosInterface<local_ordinal_type, shylubasker_dtype, Exe_Space> *ShyLUbaskerTr;
#else
#pragma message("Amesos_ShyLUBasker_decl Error: ENABLED SHYLU_NODEBASKER BUT NOT KOKKOS or NOT OPENMP!")
#endif
Expand All @@ -231,15 +243,29 @@ class ShyLUBasker : public SolverCore<Amesos2::ShyLUBasker, Matrix, Vector>
template <>
struct solver_traits<ShyLUBasker> {
#ifdef HAVE_TEUCHOS_COMPLEX
/*
typedef Meta::make_list4<float,
double,
std::complex<float>,
std::complex<double> > supported_scalars;
*/
typedef Meta::make_list6<float,
double,
Kokkos::complex<float>,
Kokkos::complex<double>,
std::complex<float>,
std::complex<double> > supported_scalars;
#else
typedef Meta::make_list2<float, double> supported_scalars;
#endif
};

template <typename Scalar, typename LocalOrdinal, typename ExecutionSpace>
struct solver_supports_matrix<ShyLUBasker,
KokkosSparse::CrsMatrix<Scalar, LocalOrdinal, ExecutionSpace>> {
static const bool value = true;
};

} // end namespace Amesos2

#endif // AMESOS2_SHYLUBASKER_DECL_HPP

0 comments on commit e95cb00

Please sign in to comment.