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

Remove Epetra #1028

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
36 changes: 0 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ include(CTest)
## Check for some required Trilinos package dependencies (Piro, Phalanx) ##
MESSAGE("Checking Trilinos build for required and optional packages")

OPTION(ENABLE_ALBANY_EPETRA "Flag to turn on building of code depending on Epetra" ON)

OPTION(ENABLE_ALBANY_PYTHON "Flag to turn on building of code depending on Python" OFF)

###############################
Expand Down Expand Up @@ -287,15 +285,6 @@ ELSE()
SET(ALBANY_STOKHOS FALSE)
ENDIF()

# set optional dependency on Belos's Epetra subpackage
IF (EXISTS "${Trilinos_INCLUDE_DIRS}/BelosEpetraAdapter.hpp")
MESSAGE("-- Looking for BelosEpetra ... Found.")
SET(ALBANY_BELOS_EPETRA TRUE)
ELSE ()
MESSAGE("-- Looking for BelosEpetra ... NOT Found.")
SET(ALBANY_BELOS_EPETRA FALSE)
ENDIF()

# set optional dependency on Amesos2, for solving and preconditioning
LIST(FIND Trilinos_PACKAGE_LIST Amesos2 Amesos2_List_ID)
IF (Amesos2_List_ID GREATER -1)
Expand Down Expand Up @@ -459,28 +448,6 @@ IF (DEFINED CMAKE_BUILD_TYPE)
SET(ALBANY_DEBUG_BUILD OFF)
ENDIF()
ENDIF()
# Set optional build of code depending on Epetra.
# Be default, it will be on, so both Tpetra and Epetra capabilities are built.
# Ideally, one should not need Epetra though, since the Tpetra stack in
# Trilinos *should* be a superset of the Epetra one (in terms of capabilities,
# not structures, obviously).

IF (ENABLE_ALBANY_EPETRA)
MESSAGE("-- ALBANY_EPETRA Enabled.")
SET(ALBANY_EPETRA TRUE)

# If Epetra build is requested, the ThyraEpetraAdapter package in Trilinos is required
LIST(FIND Trilinos_PACKAGE_LIST ThyraEpetraAdapters ThyraEpetraAdapters_ID)
IF (ThyraEpetraAdapters_ID GREATER -1)
MESSAGE(" -- Looking for ThyraEpetraAdapters Found.")
ELSE()
MESSAGE(" -- Looking for ThyraEpetraAdapters NOT Found.")
MESSAGE (FATAL_ERROR "ENABLE_ALBANY_EPETRA=ON requires ThyraEpetraAdapters in Trilinos.\n")
ENDIF()
ELSE()
MESSAGE("-- ALBANY_EPETRA NOT Enabled.")
SET(ALBANY_EPETRA FALSE)
ENDIF()

IF (ENABLE_ALBANY_PYTHON)
MESSAGE("-- ALBANY_PYTHON Enabled.")
Expand Down Expand Up @@ -610,9 +577,6 @@ MESSAGE("\nMiscellaneous Albany Options:\n")

# Optional CUDA settings
IF(Kokkos_ENABLE_CUDA)
IF (ENABLE_ALBANY_EPETRA)
MESSAGE(FATAL_ERROR "\nError: Albany with Epetra is not supported with CUDA KokkosNode! Please re-configure w/o Epetra (ENABLE_ALBANY_EPETRA=OFF).")
ENDIF()
SET(KOKKOS_NDEVICES "--kokkos-map-device-id-by=mpi_rank")
IF (ENABLE_CUDA_ERROR_CHECK)
SET(ALBANY_CUDA_ERROR_CHECK ON)
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/examples/extremeEvent/thermal_steady.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Phalanx Graph Visualization Detail: 1
Name: Thermal 2D
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/examples/extremeEvent/thermal_steady_2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Thermal 2D
Solution Method: Steady
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Debug Output: {}
Problem:
Phalanx Graph Visualization Detail: 1
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/examples/paper/input_distributed.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/examples/paper/input_scalar.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/examples/paper/input_scalar_to_update.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
28 changes: 0 additions & 28 deletions pyAlbany/src/Albany_Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,6 @@ PyProblem::PyProblem(std::string filename, Teuchos::RCP<PyParallelEnv> _pyParall

slvrfctry = rcp(new Albany::SolverFactory(filename, comm));

auto const &bt = slvrfctry->getParameters()->get<std::string>("Build Type", "NONE");

if (bt == "Tpetra")
{
// Set the static variable that denotes this as a Tpetra run
static_cast<void>(Albany::build_type(Albany::BuildType::Tpetra));
}
else
{
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidArgument,
"Error! Invalid choice (" + bt + ") for 'BuildType'.\n"
" The only valid choice for PyAlbany is 'Tpetra'.\n");
}

// Make sure all the pb factories are registered *before* the Application
// is created (since in the App ctor the pb factories are queried)
Albany::register_pb_factories();
Expand Down Expand Up @@ -153,20 +139,6 @@ PyProblem::PyProblem(Teuchos::RCP<Teuchos::ParameterList> params, Teuchos::RCP<P

slvrfctry = rcp(new Albany::SolverFactory(params, comm));

auto const &bt = slvrfctry->getParameters()->get<std::string>("Build Type", "NONE");

if (bt == "Tpetra")
{
// Set the static variable that denotes this as a Tpetra run
static_cast<void>(Albany::build_type(Albany::BuildType::Tpetra));
}
else
{
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidArgument,
"Error! Invalid choice (" + bt + ") for 'BuildType'.\n"
" The only valid choice for PyAlbany is 'Tpetra'.\n");
}

// Make sure all the pb factories are registered *before* the Application
// is created (since in the App ctor the pb factories are queried)
Albany::register_pb_factories();
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/tests/extremeEvent/thermal_steady.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Thermal 2D
Solution Method: Steady
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/tests/extremeEvent/thermal_steady_hessian.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Thermal 2D
Solution Method: Steady
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/tests/inputOutput/input.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
1 change: 0 additions & 1 deletion pyAlbany/tests/randCompress/inputT_MueLu.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
%YAML 1.1
---
ANONYMOUS:
Build Type: Tpetra
Problem:
Name: Heat 2D
Compute Sensitivities: true
Expand Down
87 changes: 5 additions & 82 deletions src/Albany_Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ Application::initialSetUp(const RCP<Teuchos::ParameterList>& params)
comm->Barrier();
#endif

#if !defined(ALBANY_EPETRA)
removeEpetraRelatedPLs(params);
#endif

// Create problem object
problemParams = Teuchos::sublist(params, "Problem", true);

Expand Down Expand Up @@ -418,7 +414,6 @@ Application::initialSetUp(const RCP<Teuchos::ParameterList>& params)
Teuchos::sublist(params, "Debug Output", true);
writeToMatrixMarketJac =
debugParams->get("Write Jacobian to MatrixMarket", 0);
computeJacCondNum = debugParams->get("Compute Jacobian Condition Number", 0);
writeToMatrixMarketRes =
debugParams->get("Write Residual to MatrixMarket", 0);
writeToMatrixMarketSoln =
Expand Down Expand Up @@ -476,14 +471,7 @@ Application::initialSetUp(const RCP<Teuchos::ParameterList>& params)
<< "Invalid Parameter Write Solution to Standard Output. "
"Acceptable values are -1, 0, 1, 2, ... \n");
}
if (computeJacCondNum < -1) {
TEUCHOS_TEST_FOR_EXCEPTION(
true,
Teuchos::Exceptions::InvalidParameter,
"\nError in Albany::Application constructor: "
<< "Invalid Parameter Compute Jacobian Condition Number. "
"Acceptable values are -1, 0, 1, 2, ...\n");
}

countJac = 0; // initiate counter that counts instances of Jacobian matrix to
// 0
countRes = 0; // initiate counter that counts instances of residual vector to
Expand Down Expand Up @@ -1593,9 +1581,8 @@ Application::computeGlobalJacobianImpl(
if (!workset.f.is_null()) {
workset.f_kokkos = getNonconstDeviceData(workset.f);
}
if (build_type()!=BuildType::Epetra) {
workset.Jac_kokkos = getNonconstDeviceData(workset.Jac);
}

workset.Jac_kokkos = getNonconstDeviceData(workset.Jac);
#endif
for (int ws = 0; ws < numWorksets; ws++) {
const std::string evalName = PHAL::evalName<EvalT>("FM", wsPhysIndex[ws]);
Expand Down Expand Up @@ -1760,38 +1747,8 @@ Application::computeGlobalJacobian(
describe(jac.getConst(), *out, Teuchos::VERB_EXTREME);
}
}
if (computeJacCondNum !=
0) { // If requesting computation of condition number
#if defined(ALBANY_EPETRA)
if (computeJacCondNum == -1) {
// cout jacobian condition # every time it arises
double condNum = computeConditionNumber(jac);
*out << "Jacobian #" << countJac << " condition number = " << condNum
<< "\n";
} else if (countJac == computeJacCondNum) {
// cout jacobian condition # only at requested count#
double condNum = computeConditionNumber(jac);
*out << "Jacobian #" << countJac << " condition number = " << condNum
<< "\n";
}
#else
TEUCHOS_TEST_FOR_EXCEPTION(
true,
std::logic_error,
"Error in Albany::Application: Compute Jacobian Condition Number debug "
"option "
"currently relies on an Epetra-based routine in AztecOO.\n To use this "
"option, please "
"rebuild Albany with ENABLE_ALBANY_EPETRA=ON.\nYou will then be able "
"to have Albany "
"output the Jacobian condition number when running either the Tpetra "
"or Epetra stack.\n"
"Notice that ENABLE_ALBANY_EPETRA is ON by default, so you must have "
"disabled it explicitly.\n");
#endif
}
if (writeToMatrixMarketJac != 0 || writeToCoutJac != 0 ||
computeJacCondNum != 0) {

if (writeToMatrixMarketJac != 0 || writeToCoutJac != 0) {
countJac++; // increment Jacobian counter
}
// Debut output - residual
Expand Down Expand Up @@ -3583,38 +3540,4 @@ Application::setupTangentWorksetInfo(
workset.param_offset = param_offset;
}

void
Application::removeEpetraRelatedPLs(
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
if (params->isSublist("Piro")) {
Teuchos::ParameterList& piroPL = params->sublist("Piro", true);
if (piroPL.isSublist("NOX")) {
Teuchos::ParameterList& noxPL = piroPL.sublist("NOX", true);
if (noxPL.isSublist("Direction")) {
Teuchos::ParameterList& dirPL = noxPL.sublist("Direction", true);
if (dirPL.isSublist("Newton")) {
Teuchos::ParameterList& newPL = dirPL.sublist("Newton", true);
if (newPL.isSublist("Stratimikos Linear Solver")) {
Teuchos::ParameterList& stratPL =
newPL.sublist("Stratimikos Linear Solver", true);
if (stratPL.isSublist("Stratimikos")) {
Teuchos::ParameterList& strataPL =
stratPL.sublist("Stratimikos", true);
if (strataPL.isSublist("AztecOO")) {
strataPL.remove("AztecOO", true);
}
if (strataPL.isSublist("Linear Solver Types")) {
Teuchos::ParameterList& lsPL =
strataPL.sublist("Linear Solver Types", true);
if (lsPL.isSublist("AztecOO")) { lsPL.remove("AztecOO", true); }
}
}
}
}
}
}
}
}

} // namespace Albany
4 changes: 0 additions & 4 deletions src/Albany_Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,9 +1031,6 @@ void
void
defineTimers();

void
removeEpetraRelatedPLs(const Teuchos::RCP<Teuchos::ParameterList>& params);

public:
//! Routine to get workset (bucket) size info needed by all Evaluation types
void
Expand Down Expand Up @@ -1216,7 +1213,6 @@ void
int writeToMatrixMarketJac;
int writeToMatrixMarketRes;
int writeToMatrixMarketSoln;
int computeJacCondNum;
//! Integer specifying whether user wants to write Jacobian, residual and solution to
//! Standard output (cout)
int writeToCoutJac;
Expand Down
Loading