Stratimikos: Amesos2LinearOpWithSolveFactory adapter may cause link errors if Teuchos_ENABLE_FLOAT=ON but Tpetra_INST_FLOAT=OFF
Created by: mhoemmen
@trilinos/stratimikos @trilinos/thyra @rrdrake
Stratimikos uses the macro TEUCHOS_CLASS_TEMPLATE_INSTANT_REAL_SCALAR_TYPES
to do explicit template instantiation (ETI) for its Amesos2 adapter, Thyra::Amesos2LinearOpWithSolveFactory
. This macro depends on the HAVE_TEUCHOS_FLOAT
macro, which in turn depends on the Teuchos_ENABLE_FLOAT
CMake option. However, whether it's valid to use Tpetra objects with Scalar=float
depends on a different CMake option, Tpetra_INST_FLOAT
.
Tpetra_INST_FLOAT
and Teuchos_ENABLE_FLOAT
both take their default values from the common CMake option Trilinos_ENABLE_FLOAT
. However, #4059 (closed) shows that it's possible to override those defaults and set Teuchos_ENABLE_FLOAT=ON
but Tpetra_INST_FLOAT=OFF
. This will result in link errors in packages that use TEUCHOS_CLASS_TEMPLATE_INSTANT_REAL_SCALAR_TYPES
to instantiate code that uses Tpetra objects.
Possible Solution
At configure time, forbid setting Teuchos_ENABLE_FLOAT=ON
but Tpetra_INST_FLOAT=OFF
. This is most easily done in Tpetra, since Tpetra has a required dependence on Teuchos.
One could fix this in other ways, but I prefer solutions that avoid combinatorial explosion of build options.
Related Issues
- Follows #4059 (closed)
- Related to #4059 (closed), #2009 (closed)