Skip to content

Commit

Permalink
Ifpack2: Adds missing cmake logic to address test dependency on Xpetra
Browse files Browse the repository at this point in the history
 The Ifpack2_UnitTestSingleProcessILUT.cpp test has a required dependency
 on Xpetra.  There is an optional dependency on Xpetra for the library,
 but if someone uses a configuration like this:

 cmake \
 -DCMAKE_C_COMPILER=mpicc \
 -DCMAKE_CXX_COMPILER=mpicxx \
 -DCMAKE_Fortran_COMPILER=mpif77 \
 -DCMAKE_CXX_FLAGS="-O3 -fPIC" \
 -DCMAKE_C_FLAGS="-O3 -fPIC" \
 -D Trilinos_ENABLE_Tpetra:BOOL=ON \
 -D Trilinos_ENABLE_Belos:BOOL=ON \
 -D Trilinos_ENABLE_Ifpack2:BOOL=ON \
 -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
 -D Teuchos_ENABLE_COMPLEX:BOOL=OFF \
 -D Trilinos_ENABLE_COMPLEX:BOOL=OFF \
 -D Trilinos_ENABLE_OpenMP:BOOL=OFF \
 -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
 -D Trilinos_ENABLE_EXAMPLES:BOOL=ON \
 -D Trilinos_ENABLE_TESTS:BOOL=ON \
 -DTPL_ENABLE_MPI:BOOL=ON \
 -DTPL_ENABLE_BLAS=ON \
 -DTPL_ENABLE_LAPACK=ON \
 ../../

 Then Xpetra will not be enabled since optional dependencies are off,
 yet the test will fail to build due to the absence of Xpetra.  This
 commit adds logic to the CMakeLists file to conditionally build the
 Ifpack2_UnitTestSingleProcessILUT test if Xpetra and Galeri are enabled.
 Furthermore, it removes the inclusion of Xpetra and Galeri headers in
 the Ifpack2_UnitTestILUT.cpp file, as they are not used.
  • Loading branch information
hkthorn committed Aug 30, 2023
1 parent d163e18 commit f46467a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
4 changes: 4 additions & 0 deletions packages/ifpack2/test/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
STANDARD_PASS_OUTPUT
)

ASSERT_DEFINED (${PACKAGE_NAME}_ENABLE_Xpetra)
ASSERT_DEFINED (${PACKAGE_NAME}_ENABLE_Galeri)
IF(${PACKAGE_NAME}_ENABLE_Xpetra AND ${PACKAGE_NAME}_ENABLE_Galeri)
TRIBITS_ADD_EXECUTABLE_AND_TEST(
ILUTSingleProcessUnitTests
SOURCES
Expand All @@ -162,6 +165,7 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
NUM_MPI_PROCS 1
STANDARD_PASS_OUTPUT
)
ENDIF ()

IF(Tpetra_INST_DOUBLE AND ${PACKAGE_NAME}_ENABLE_Experimental_KokkosKernels_Features)
TRIBITS_ADD_EXECUTABLE_AND_TEST(
Expand Down
17 changes: 0 additions & 17 deletions packages/ifpack2/test/unit_tests/Ifpack2_UnitTestILUT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,6 @@
#include <Teuchos_ConfigDefs.hpp>
#include <Teuchos_UnitTestHarness.hpp>
#include <Ifpack2_ConfigDefs.hpp>

// Xpetra / Galeri
#ifdef HAVE_IFPACK2_XPETRA
#include "Xpetra_ConfigDefs.hpp"
#include "Xpetra_DefaultPlatform.hpp"
#include "Xpetra_Parameters.hpp"
#include "Xpetra_MapFactory.hpp"
#include "Xpetra_TpetraMap.hpp"
#include "Xpetra_CrsMatrix.hpp"
#include "Xpetra_TpetraCrsMatrix.hpp"
#include "Galeri_XpetraProblemFactory.hpp"
#include "Galeri_XpetraMatrixTypes.hpp"
#include "Galeri_XpetraParameters.hpp"
#include "Galeri_XpetraUtils.hpp"
#include "Galeri_XpetraMaps.hpp"
#endif // HAVE_IFPACK2_XPETRA

#include <Ifpack2_Version.hpp>

#include <Ifpack2_UnitTestHelpers.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include <Ifpack2_ConfigDefs.hpp>

// Xpetra / Galeri
#ifdef HAVE_IFPACK2_XPETRA
#include "Xpetra_ConfigDefs.hpp"
#include "Xpetra_DefaultPlatform.hpp"
#include "Xpetra_Parameters.hpp"
Expand All @@ -68,7 +67,6 @@
#include "Galeri_XpetraParameters.hpp"
#include "Galeri_XpetraUtils.hpp"
#include "Galeri_XpetraMaps.hpp"
#endif // HAVE_IFPACK2_XPETRA

#include <Ifpack2_Version.hpp>

Expand Down

0 comments on commit f46467a

Please sign in to comment.