Skip to content

Commit

Permalink
Merge pull request #12804 from cwpearson/deprecate-epetra
Browse files Browse the repository at this point in the history
Tpetra: deprecate Epetra-related interfaces
  • Loading branch information
cwpearson authored Mar 11, 2024
2 parents 2781117 + b12a533 commit 99d2960
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 15 deletions.
2 changes: 2 additions & 0 deletions packages/tpetra/core/cmake/TpetraCore_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,6 @@

@TPETRA_DEPRECATED_DECLARATIONS@

#cmakedefine TPETRA_DEPRECATED_DECLARATIONS

#endif // TPETRACORE_CONFIG_H
4 changes: 4 additions & 0 deletions packages/tpetra/core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ TRIBITS_SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR})
APPEND_GLOB(HEADERS ${DIR}/*.h)
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)
IF (NOT Tpetra_ENABLE_DEPRECATED_CODE OR NOT TpetraCore_ENABLE_Epetra)
LIST(REMOVE_ITEM SOURCES ${DIR}/Epetra_TsqrMessenger.cpp)
LIST(REMOVE_ITEM SOURCES ${DIR}/Tpetra_EpetraRowMatrix.cpp)
ENDIF()
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${DIR})

# Pull in the Kokkos refactor code.
Expand Down
13 changes: 11 additions & 2 deletions packages/tpetra/core/src/Epetra_TsqrAdaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@

#include "Tpetra_ConfigDefs.hpp"

#if defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)
#if defined(TPETRA_ENABLE_DEPRECATED_CODE)
#if defined(TPETRA_DEPRECATED_DECLARATIONS)
#warning This file is deprecated due to Epetra removal and will be removed
#endif
#else
#error This file is deprecated due to Epetra removal and will be removed
#endif

#if defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)

#include "Tsqr_NodeTsqrFactory.hpp" // create intranode TSQR object
#include "Tsqr.hpp" // full (internode + intranode) TSQR
Expand Down Expand Up @@ -93,6 +101,7 @@ namespace Epetra {
/// \warning The current implementation of this adaptor requires
/// that all Epetra_MultiVector inputs use the same communicator
/// object (that is, the same Epetra_Comm) and map.
TPETRA_DEPRECATED_MSG("epetra removal")
class TsqrAdaptor : public Teuchos::ParameterListAcceptorDefaultBase {
public:
typedef Epetra_MultiVector MV;
Expand Down Expand Up @@ -369,7 +378,7 @@ namespace Epetra {

} // namespace Epetra

#endif // defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)
#endif // defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)

#endif // EPETRA_TSQRADAPTOR_HPP

3 changes: 2 additions & 1 deletion packages/tpetra/core/src/Epetra_TsqrMessenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@
/// time to fix their build systems later.
///

#include <Epetra_TsqrMessenger.hpp>
#include "TpetraCore_config.h"

#if defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)

#include <Epetra_TsqrMessenger.hpp>
#include <Epetra_ConfigDefs.h> // EPETRA_MPI
#include <Teuchos_ConfigDefs.hpp> // HAVE_TEUCHOS_MPI

Expand Down
10 changes: 8 additions & 2 deletions packages/tpetra/core/src/Epetra_TsqrMessenger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@

#include <Tpetra_ConfigDefs.hpp>

#if defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)
#if !defined(TPETRA_ENABLE_DEPRECATED_CODE)
#error This file is deprecated due to Epetra removal and will be removed
#endif

#if defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)

// Include Epetra's MPI wrappers.
#include <Epetra_Comm.h>
Expand All @@ -80,11 +84,13 @@ namespace TSQR {
/// object. Otherwise, return a Teuchos::SerialComm instance. It
/// should be one of these two things, but if it's not, this
/// function throws std::invalid_argument.
TPETRA_DEPRECATED_MSG("epetra removal")
Teuchos::RCP<const Teuchos::Comm<int> >
extractTeuchosComm (const Teuchos::RCP<const Epetra_Comm>& epetraComm);

//! Wrap the given Epetra_Comm in an object that TSQR understands.
template<class Datum>
TPETRA_DEPRECATED_MSG("epetra removal")
Teuchos::RCP<TSQR::MessengerBase<Datum> >
makeTsqrMessenger (const Teuchos::RCP<const Epetra_Comm>& pComm)
{
Expand All @@ -98,7 +104,7 @@ namespace TSQR {
} // namespace Epetra
} // namespace TSQR

#endif // defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)
#endif // defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA) && defined(HAVE_TPETRA_TSQR)

#endif // EPETRA_TSQRMESSENGER_HPP

17 changes: 13 additions & 4 deletions packages/tpetra/core/src/Tpetra_EpetraRowMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@

#include "TpetraCore_config.h"

#if defined(HAVE_TPETRA_EPETRA)
#if !defined(TPETRA_ENABLE_DEPRECATED_CODE)
#error This file is deprecated due to Epetra removal and will be removed
#endif

#if defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA)

#include <Epetra_Comm.h>
#include <Epetra_BasicRowMatrix.h>
Expand All @@ -64,6 +68,7 @@ namespace Details {
// just like std::shared_ptr. We only return
// std::shared_ptr<Epetra_Comm> because Epetra_Comm is an abstract
// base class, so we must return it by pointer.
TPETRA_DEPRECATED_MSG("epetra removal")
std::shared_ptr<Epetra_Comm>
makeEpetraCommFromTeuchosComm (const Teuchos::Comm<int>& teuchosComm);

Expand All @@ -72,7 +77,9 @@ makeEpetraCommFromTeuchosComm (const Teuchos::Comm<int>& teuchosComm);

namespace { // (anonymous)


template<class EpetraGlobalOrdinalType, class TpetraMapType>
TPETRA_DEPRECATED_MSG("epetra removal")
Epetra_Map
tpetraToEpetraMapTmpl (const TpetraMapType& tpetraMap)
{
Expand Down Expand Up @@ -119,9 +126,11 @@ tpetraToEpetraMapTmpl (const TpetraMapType& tpetraMap)
namespace Tpetra {

//! A class for wrapping a Tpetra::RowMatrix object in the Epetra_RowMatrix interface.
template<class TpetraMatrixType>
class EpetraRowMatrix : public Epetra_BasicRowMatrix {
template<class TpetraMatrixType> class
TPETRA_DEPRECATED_MSG("epetra removal")
EpetraRowMatrix : public Epetra_BasicRowMatrix {
public:

EpetraRowMatrix(const Teuchos::RCP<TpetraMatrixType> &mat, const Epetra_Comm &comm);
virtual ~EpetraRowMatrix() {};

Expand Down Expand Up @@ -218,7 +227,7 @@ int EpetraRowMatrix<TpetraMatrixType>::NumMyRowEntries(int MyRow, int & NumEntri

}//namespace Tpetra

#endif // defined(HAVE_TPETRA_EPETRA)
#endif // defined(TPETRA_ENABLE_DEPRECATED_CODE) && defined(HAVE_TPETRA_EPETRA)

//here is the include-guard #endif:

Expand Down
1 change: 0 additions & 1 deletion packages/tpetra/core/test/BasicPerfTest/BasicPerfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL( BasicPerfTest, MatrixAndMultiVector, LO, GO,
//
// nrhs - Number of rhs to generate. (First interface produces vectors, so nrhs is not needed
//
// comm (In) - an Epetra_Comm object describing the parallel machine (numProcs and my proc ID)
// map (Out) - Map<LO,GO> describing distribution of matrix and vectors/multivectors
// A (Out) - CrsMatrix<Scalar,LO,GO> constructed for nx by ny grid using prescribed stencil
// Off-diagonal values are random between 0 and 1. If diagonal is part of stencil,
Expand Down
3 changes: 1 addition & 2 deletions packages/tpetra/core/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ADD_SUBDIRECTORIES(
Tsqr
)

ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_Epetra)
IF (${PACKAGE_NAME}_ENABLE_Epetra)
IF (Tpetra_ENABLE_DEPRECATED_CODE AND ${PACKAGE_NAME}_ENABLE_Epetra)
ADD_SUBDIRECTORY(EpetraRowMatrix)
ENDIF()
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ namespace {
typedef CrsMatrix<Scalar,LO,GO,Node> MAT;
typedef MultiVector<Scalar,LO,GO,Node> MV;
typedef typename ST::magnitudeType Mag;
typedef ScalarTraits<Mag> MT;

// This code is left in in case people want to debug future issues using the Kokkos profiling
// hooks in Tpetra
Expand Down
2 changes: 1 addition & 1 deletion packages/tpetra/core/test/EpetraRowMatrix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
${TEUCHOS_STD_UNIT_TEST_MAIN}
ARGS ""
STANDARD_PASS_OUTPUT
)
)
2 changes: 1 addition & 1 deletion packages/tpetra/core/test/ImportExport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
STANDARD_PASS_OUTPUT
)

IF (${PROJECT_NAME}_ENABLE_Epetra)
IF (Tpetra_ENABLE_DEPRECATED_CODE AND ${PROJECT_NAME}_ENABLE_Epetra)
IF(NOT Trilinos_NO_32BIT_GLOBAL_INDICES AND Tpetra_INST_INT_INT)
# Tpetra bug 5430:
# https://software.sandia.gov/bugzilla/show_bug.cgi?id=5430
Expand Down

0 comments on commit 99d2960

Please sign in to comment.