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

Thyra-Ifpack2 Mixed Precision: Deal with complex #9582

Merged
merged 1 commit into from
Aug 19, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
#include <string>


// CAG: This is not entirely ideal, since it disables half-precision
// altogether when we have e.g. double, float and
// complex<double>, but not complex<float>, although a
// double-float preconditioner would be possible.
#if (!defined(HAVE_TPETRA_INST_DOUBLE) || (defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_FLOAT))) && \
(!defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) || (defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) && defined(HAVE_TPETRA_INST_COMPLEX_FLOAT)))
# define THYRA_IFPACK2_ENABLE_HALF_PRECISION
#endif

namespace Thyra {


Expand Down Expand Up @@ -205,7 +214,7 @@ void Ifpack2PreconditionerFactory<MatrixType>::initializePrec(
typedef Ifpack2::Preconditioner<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Ifpack2Prec;
Teuchos::RCP<Ifpack2Prec> concretePrecOp;

#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_FLOAT)
#ifdef THYRA_IFPACK2_ENABLE_HALF_PRECISION
// CAG: There is nothing special about the combination double-float,
// except that I feel somewhat confident that Trilinos builds
// with both scalar types.
Expand All @@ -215,7 +224,7 @@ void Ifpack2PreconditionerFactory<MatrixType>::initializePrec(
#endif

if (useHalfPrecision) {
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_FLOAT)
#ifdef THYRA_IFPACK2_ENABLE_HALF_PRECISION
if (Teuchos::nonnull(out) && Teuchos::includesVerbLevel(verbLevel, Teuchos::VERB_LOW)) {
Teuchos::OSTab(out).o() << "> Creating half precision preconditioner\n";
}
Expand Down Expand Up @@ -244,7 +253,7 @@ void Ifpack2PreconditionerFactory<MatrixType>::initializePrec(
// Initialize and compute the initial preconditioner

if (useHalfPrecision) {
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_FLOAT)
#ifdef THYRA_IFPACK2_ENABLE_HALF_PRECISION
concretePrecOpHalf->setParameters(*packageParamList);
concretePrecOpHalf->initialize();
concretePrecOpHalf->compute();
Expand Down