Skip to content
Closed
Show file tree
Hide file tree
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
42 changes: 8 additions & 34 deletions packages/ifpack2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,17 @@ TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()

# Make sure that Tpetra actually defined these variables, even if they
# are empty.
ASSERT_DEFINED(TpetraCore_ETI_SCALARS)
ASSERT_DEFINED(TpetraCore_ETI_SCALARS_NO_ORDS)
ASSERT_DEFINED(TpetraCore_ETI_LORDS)
ASSERT_DEFINED(TpetraCore_ETI_GORDS)
ASSERT_DEFINED(TpetraCore_ETI_NODES)

# Exclude GlobalOrdinal types from the list of Scalar types over which
# Ifpack2 does ETI.
#
# Look at each entry in Tpetra's list of ETI Scalar types. If it is
# also a Tpetra ETI GlobalOrdinal type, don't append it to Ifpack2's
# list of ETI Scalar types. Otherwise, do.
SET (Ifpack2_ETI_SCALARS_TEMP ) # start with the empty list
FOREACH (scalarName IN LISTS TpetraCore_ETI_SCALARS)
LIST (FIND TpetraCore_ETI_GORDS ${scalarName} scalarNameIndex)
IF (-1 EQUAL scalarNameIndex) # not in the list of integer types
LIST (APPEND Ifpack2_ETI_SCALARS_TEMP ${scalarName})
ENDIF ()
ENDFOREACH ()

SET(Ifpack2_ETI_SCALARS ${Ifpack2_ETI_SCALARS_TEMP})
SET(Ifpack2_ETI_LORDS ${TpetraCore_ETI_LORDS})
SET(Ifpack2_ETI_GORDS ${TpetraCore_ETI_GORDS})
SET(Ifpack2_ETI_NODES ${TpetraCore_ETI_NODES})

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_Trilinos
HAVE_${PACKAGE_NAME}_Trilinos
"Building as a Trilinos package"
ON
)
# Promote these variables to be visible outside of the "scope" of this
# directory -- e.g., to other packages.
GLOBAL_SET(Ifpack2_ETI_SCALARS ${TpetraCore_ETI_SCALARS_NO_ORDS})
GLOBAL_SET(Ifpack2_ETI_LORDS ${TpetraCore_ETI_LORDS})
GLOBAL_SET(Ifpack2_ETI_GORDS ${TpetraCore_ETI_GORDS})
GLOBAL_SET(Ifpack2_ETI_NODES ${TpetraCore_ETI_NODES})

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ENABLE_DEBUG
Expand All @@ -78,7 +59,7 @@ IF(${PACKAGE_NAME}_ENABLE_Lemon AND ${PACKAGE_NAME}_ENABLE_Amesos2 AND ${PACKAGE
ENDIF()

TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ENABLE_Experimental
${PACKAGE_NAME}_ENABLE_Experimental
HAVE_IFPACK2_EXPERIMENTAL
"Enable building and installation of experimental Ifpack2 features."
NO )
Expand Down Expand Up @@ -128,13 +109,6 @@ ADD_SUBDIRECTORY(adapters)
TRIBITS_ADD_TEST_DIRECTORIES(test)
TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)

# Promote these variables to be visible outside of the "scope" of this
# directory -- e.g., to other packages.
GLOBAL_SET(Ifpack2_ETI_SCALARS ${Ifpack2_ETI_SCALARS})
GLOBAL_SET(Ifpack2_ETI_LORDS ${Ifpack2_ETI_LORDS})
GLOBAL_SET(Ifpack2_ETI_GORDS ${Ifpack2_ETI_GORDS})
GLOBAL_SET(Ifpack2_ETI_NODES ${Ifpack2_ETI_NODES})

#
# Exclude files for source package.
#
Expand Down
85 changes: 31 additions & 54 deletions packages/ifpack2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,6 @@ IF (${PACKAGE_NAME}_ENABLE_HYPRE)
ENDIF ()
ENDIF ()


FUNCTION(IFPACK2_PROCESS_ETI_TEMPLATE_LGN ETI_CLASSES TEMPLATE_FILE SOURCES_LIST IFPACK2_ETI_LORDS IFPACK2_ETI_GORDS IFPACK2_ETI_NODES)
SET(SRCS "")
FOREACH(CLASS ${ETI_CLASSES})
TPETRA_MANGLE_TEMPLATE_PARAMETER(CLASS_MANGLED ${CLASS})
string(TOUPPER "${CLASS_MANGLED}" UPPER_CASE_CLASS)
TPETRA_PROCESS_ALL_LGN_TEMPLATES(TMP_OUTPUT_FILES ${TEMPLATE_FILE} ${CLASS_MANGLED} ${UPPER_CASE_CLASS} "${IFPACK2_ETI_LORDS}" "${IFPACK2_ETI_GORDS}" "${IFPACK2_ETI_NODES}")
LIST(APPEND SRCS ${TMP_OUTPUT_FILES})
ENDFOREACH()
SET(${SOURCES_LIST} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(IFPACK2_PROCESS_ETI_TEMPLATE_LGN)

FUNCTION(IFPACK2_PROCESS_ETI_TEMPLATE_SLGN ETI_CLASSES TEMPLATE_FILE SOURCES_LIST IFPACK2_ETI_SCALARS IFPACK2_ETI_LORDS IFPACK2_ETI_GORDS IFPACK2_ETI_NODES)
SET(SRCS "")
FOREACH(CLASS ${ETI_CLASSES})
TPETRA_MANGLE_TEMPLATE_PARAMETER(CLASS_MANGLED ${CLASS})
string(TOUPPER "${CLASS_MANGLED}" UPPER_CASE_CLASS)
TPETRA_PROCESS_ALL_SLGN_TEMPLATES(TMP_OUTPUT_FILES ${TEMPLATE_FILE} ${CLASS_MANGLED} ${UPPER_CASE_CLASS} "${IFPACK2_ETI_SCALARS}" "${IFPACK2_ETI_LORDS}" "${IFPACK2_ETI_GORDS}" "${IFPACK2_ETI_NODES}" FALSE)
LIST(APPEND SRCS ${TMP_OUTPUT_FILES})
ENDFOREACH()
SET(${SOURCES_LIST} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(IFPACK2_PROCESS_ETI_TEMPLATE_SLGN)

#
# A) Package-specific configuration options
#
Expand All @@ -60,13 +37,13 @@ SET(HEADERS "")
SET(SOURCES "")

TRIBITS_SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_SOURCE_DIR})
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_GLOB(SOURCES ${DIR}/*.cpp)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${DIR})
APPEND_GLOB(HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
APPEND_GLOB(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR})

# SupportGraph requires some TPLs and options to be enabled.
IF (${PACKAGE_NAME}_ENABLE_Experimental AND ${PACKAGE_NAME}_ENABLE_Lemon AND ${PACKAGE_NAME}_ENABLE_Amesos2 AND ${PACKAGE_NAME}_ENABLE_Cholmod)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${DIR}/supportgraph)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR}/supportgraph)
TRIBITS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/supportgraph)
SET(HEADERS ${HEADERS}
supportgraph/Ifpack2_SupportGraph_decl.hpp
Expand All @@ -79,20 +56,19 @@ ENDIF()

# Must glob the binary dir last to get all of the auto-generated headers
TRIBITS_SET_AND_INC_DIRS(DIR ${CMAKE_CURRENT_BINARY_DIR})
APPEND_GLOB(HEADERS ${DIR}/*.hpp)
APPEND_SET(HEADERS ${DIR}/${PACKAGE_NAME}_config.h )
APPEND_SET(HEADERS ${DIR}/${PACKAGE_NAME}_ETIHelperMacros.h )
APPEND_GLOB(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/*.hpp)
APPEND_SET(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h )
# APPEND_SET(HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_ETIHelperMacros.h )

# Automatically generate ETI (explicit template instanatiation) files
# for Node types that use the (new) Kokkos Devices.
SET(IFPACK2_CPP_SOURCES "")
# Automatically generate ETI (explicit template instantiation) files
# for Node types that use the Kokkos Devices.
IF(Ifpack2_ENABLE_EXPLICIT_INSTANTIATION)
# Set the list of Ifpack2 classes templated on <Scalar, LO, GO,
# Node> for which we want to do ETI using this system. These
# classes usually operate on sparse matrices (instances of
# Tpetra::CrsMatrix or Tpetra::RowMatrix, which also take these
# template parameters).
GLOBAL_SET(IFPACK2_ETI_CLASSES
SET(IFPACK2_ETI_CLASSES
AdditiveSchwarz
BlockRelaxation
BorderedOperator
Expand Down Expand Up @@ -132,18 +108,21 @@ IF(Ifpack2_ENABLE_EXPLICIT_INSTANTIATION)
Details::ScaledDampedResidual
Details::TriDiSolver
Experimental::RBILUK
Details::LinearSolverFactory
)

IF(Ifpack2_ENABLE_Amesos2)
APPEND_GLOBAL_SET(IFPACK2_ETI_CLASSES
APPEND_SET(IFPACK2_ETI_CLASSES
Details::Amesos2Wrapper
)
ENDIF()

IF(${PACKAGE_NAME}_ENABLE_Experimental_KokkosKernels_Features)
APPEND_GLOBAL_SET(IFPACK2_ETI_CLASSES BlockTriDiContainer)
APPEND_SET(IFPACK2_ETI_CLASSES BlockTriDiContainer)
ENDIF()

IF(Ifpack2_ENABLE_ShyLU_NodeFastILU)
APPEND_GLOBAL_SET(IFPACK2_ETI_CLASSES
APPEND_SET(IFPACK2_ETI_CLASSES
Details::FastILU_Base
Details::Filu
Details::Fic
Expand All @@ -152,7 +131,7 @@ IF(Ifpack2_ENABLE_EXPLICIT_INSTANTIATION)
ENDIF()

IF(Ifpack2_ENABLE_HYPRE)
APPEND_GLOBAL_SET(IFPACK2_ETI_CLASSES
APPEND_SET(IFPACK2_ETI_CLASSES
Hypre
)
ENDIF()
Expand All @@ -161,27 +140,25 @@ IF(Ifpack2_ENABLE_EXPLICIT_INSTANTIATION)
# which we want to do ETI using this system. These classes usually
# operate on sparse graphs (instances of Tpetra::CrsGraph or
# Tpetra::RowGraph, which also take these template parameters).
GLOBAL_SET(IFPACK2_ETI_LO_GO_CLASSES
SET(IFPACK2_ETI_LO_GO_CLASSES
LinearPartitioner
OverlappingPartitioner
Details::OverlappingRowGraph
)

GLOBAL_SET(IFPACK2_ETI_LINEAR_SOLVER_FACTORY_CLASSES
Details::LinearSolverFactory
)

SET(TEMPLATE_FILE "Ifpack2_Details_LinearSolverFactory_ETI_SC_LO_GO_NT.tmpl")
IFPACK2_PROCESS_ETI_TEMPLATE_SLGN(${IFPACK2_ETI_LINEAR_SOLVER_FACTORY_CLASSES} ${TEMPLATE_FILE} IFPACK2_FACTORY_OUTPUT_FILES "${Ifpack2_ETI_SCALARS}" "${Ifpack2_ETI_LORDS}" "${Ifpack2_ETI_GORDS}" "${Ifpack2_ETI_NODES}")
LIST(APPEND IFPACK2_CPP_SOURCES ${IFPACK2_FACTORY_OUTPUT_FILES})

SET(TEMPLATE_FILE "Ifpack2_ETI_LO_GO_NT.tmpl")
IFPACK2_PROCESS_ETI_TEMPLATE_LGN("${IFPACK2_ETI_LO_GO_CLASSES}" ${TEMPLATE_FILE} IFPACK2_SRCS "${Ifpack2_ETI_LORDS}" "${Ifpack2_ETI_GORDS}" "${Ifpack2_ETI_NODES}")
LIST(APPEND IFPACK2_CPP_SOURCES ${IFPACK2_SRCS})
# LGN templates
TPETRA_PROCESS_ETI_TEMPLATES_LGN(SRCS
"Ifpack2_ETI_LO_GO_NT.tmpl"
"${IFPACK2_ETI_LO_GO_CLASSES}"
"${Ifpack2_ETI_LORDS}" "${Ifpack2_ETI_GORDS}" "${Ifpack2_ETI_NODES}")
LIST(APPEND SOURCES ${SRCS})

SET(TEMPLATE_FILE "Ifpack2_ETI_SC_LO_GO_NT.tmpl")
IFPACK2_PROCESS_ETI_TEMPLATE_SLGN("${IFPACK2_ETI_CLASSES}" ${TEMPLATE_FILE} IFPACK2_SRCS "${Ifpack2_ETI_SCALARS}" "${Ifpack2_ETI_LORDS}" "${Ifpack2_ETI_GORDS}" "${Ifpack2_ETI_NODES}")
LIST(APPEND IFPACK2_CPP_SOURCES ${IFPACK2_SRCS})
# SLGN templates
TPETRA_PROCESS_ETI_TEMPLATES_SLGN(SRCS
"Ifpack2_ETI_SC_LO_GO_NT.tmpl"
"${IFPACK2_ETI_CLASSES}"
"${Ifpack2_ETI_SCALARS}" "${Ifpack2_ETI_LORDS}" "${Ifpack2_ETI_GORDS}" "${Ifpack2_ETI_NODES}" FALSE)
LIST(APPEND SOURCES ${SRCS})

ENDIF()

Expand All @@ -194,7 +171,7 @@ ENDIF()
TRIBITS_ADD_LIBRARY(
ifpack2
HEADERS ${HEADERS}
SOURCES ${SOURCES} ${IFPACK2_CPP_SOURCES}
SOURCES ${SOURCES}
)

#
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions packages/ifpack2/src/Ifpack2_ETI_LO_GO_NT.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
// @HEADER

#include "Ifpack2_ConfigDefs.hpp"
#if defined(HAVE_IFPACK2_EXPLICIT_INSTANTIATION)

#include "TpetraCore_ETIHelperMacros.h"
#if defined(HAVE_IFPACK2_EXPLICIT_INSTANTIATION)
#include "Ifpack2_ETIHelperMacros.h"
#include "Ifpack2_@CLASS_NAME@_decl.hpp"
#include "Ifpack2_@CLASS_NAME@_def.hpp"
Expand Down
1 change: 0 additions & 1 deletion packages/ifpack2/src/Ifpack2_ETI_SC_LO_GO_NT.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Ifpack2_ConfigDefs.hpp"
#if defined(HAVE_IFPACK2_EXPLICIT_INSTANTIATION)

#include "TpetraCore_ETIHelperMacros.h"
#include "Ifpack2_ETIHelperMacros.h"
#include "Ifpack2_@CLASS_NAME@_decl.hpp"
#include "Ifpack2_@CLASS_NAME@_def.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Ifpack2_OverlappingPartitioner_decl.hpp"
#include "Teuchos_Array.hpp"
#include "Teuchos_ArrayRCP.hpp"
#include "Tpetra_Util.hpp"

namespace Ifpack2 {

Expand Down
88 changes: 88 additions & 0 deletions packages/tpetra/cmake/ETI_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,91 @@ FUNCTION(TPETRA_PROCESS_ALL_N_TEMPLATES OUTPUT_FILES TEMPLATE_FILE
# that the caller can see the result.
SET(${OUTPUT_FILES} ${OUT_FILES} PARENT_SCOPE)
ENDFUNCTION(TPETRA_PROCESS_ALL_N_TEMPLATES)


# Function to generate .cpp files for ETI of a list of classes or
# functions, over all enabled Scalar, LocalOrdinal, GlobalOrdinal, and
# Node template parameters. We generate one .cpp file for each
# (Scalar, LocalOrdinal, GlobalOrdinal, Node) type combination over
# which Tpetra does ETI.
#
# OUTPUT_FILES [out] List of the generated .cpp files.
#
# TEMPLATE_FILE [in] Name of the input .tmpl "template" file. This
# function does string substitution in that file, using the input
# arguments of this function. For example, @SC_MACRO_EXPR@ (Scalar
# macro expression) gets substituted for the value of this
# function's SC_MACRO_EXPR input argument.
#
# CLASS_LIST [in] List of classes (without namespace
# qualifiers)
#
# SCALAR_TYPES [in] All Scalar types over which to do ETI for the given
# class. This may include Scalar = GlobalOrdinal and/or Scalar =
# int, if appropriate for that class.
#
# LOCALORDINAL_TYPES [in] All LocalOrdinal types over which to do ETI
# for the given class.
#
# GLOBALORDINAL_TYPES [in] All GlobalOrdinal types over which to do
# ETI for the given class.
#
# NODE_TYPES [in] All Node types over which to do ETI for the given
# class.
#
# MUST_HAVE_SCALAR_INT [in] (Boolean) Whether the class must be
# instantiated with Scalar = int, even if int is not in the set of
# GlobalOrdinal types.
FUNCTION(TPETRA_PROCESS_ETI_TEMPLATES_SLGN OUTPUT_FILES TEMPLATE_FILE CLASS_LIST SCALAR_TYPES LOCALORDINAL_TYPES GLOBALORDINAL_TYPES NODE_TYPES MUST_HAVE_SCALAR_INT)
SET(SRCS "")
FOREACH(CLASS ${CLASS_LIST})
TPETRA_MANGLE_TEMPLATE_PARAMETER(CLASS_MANGLED ${CLASS})
string(TOUPPER "${CLASS_MANGLED}" UPPER_CASE_CLASS)
TPETRA_PROCESS_ALL_SLGN_TEMPLATES(TMP_OUTPUT_FILES ${TEMPLATE_FILE} ${CLASS_MANGLED} ${UPPER_CASE_CLASS} "${SCALAR_TYPES}" "${LOCALORDINAL_TYPES}" "${GLOBALORDINAL_TYPES}" "${NODE_TYPES}" ${MUST_HAVE_SCALAR_INT})
LIST(APPEND SRCS ${TMP_OUTPUT_FILES})
ENDFOREACH()

# This is the standard CMake idiom for setting an output variable so
# that the caller can see the result.
SET(${OUTPUT_FILES} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(TPETRA_PROCESS_ETI_TEMPLATES_SLGN)


# Function to generate .cpp files for ETI of a list of classes or
# functions, over all enabled LocalOrdinal, GlobalOrdinal, and
# Node template parameters. We generate one .cpp file for each
# (LocalOrdinal, GlobalOrdinal, Node) type combination over
# which Tpetra does ETI.
#
# OUTPUT_FILES [out] List of the generated .cpp files.
#
# TEMPLATE_FILE [in] Name of the input .tmpl "template" file. This
# function does string substitution in that file, using the input
# arguments of this function. For example, @SC_MACRO_EXPR@ (Scalar
# macro expression) gets substituted for the value of this
# function's SC_MACRO_EXPR input argument.
#
# CLASS_LIST [in] List of classes (without namespace
# qualifiers)
#
# LOCALORDINAL_TYPES [in] All LocalOrdinal types over which to do ETI
# for the given class.
#
# GLOBALORDINAL_TYPES [in] All GlobalOrdinal types over which to do
# ETI for the given class.
#
# NODE_TYPES [in] All Node types over which to do ETI for the given
# class.
FUNCTION(TPETRA_PROCESS_ETI_TEMPLATES_LGN OUTPUT_FILES TEMPLATE_FILE CLASS_LIST LOCALORDINAL_TYPES GLOBALORDINAL_TYPES NODE_TYPES)
SET(SRCS "")
FOREACH(CLASS ${CLASS_LIST})
TPETRA_MANGLE_TEMPLATE_PARAMETER(CLASS_MANGLED ${CLASS})
string(TOUPPER "${CLASS_MANGLED}" UPPER_CASE_CLASS)
TPETRA_PROCESS_ALL_LGN_TEMPLATES(TMP_OUTPUT_FILES ${TEMPLATE_FILE} ${CLASS_MANGLED} ${UPPER_CASE_CLASS} "${LOCALORDINAL_TYPES}" "${GLOBALORDINAL_TYPES}" "${NODE_TYPES}" ${MUST_HAVE_SCALAR_INT})
LIST(APPEND SRCS ${TMP_OUTPUT_FILES})
ENDFOREACH()

# This is the standard CMake idiom for setting an output variable so
# that the caller can see the result.
SET(${OUTPUT_FILES} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(TPETRA_PROCESS_ETI_TEMPLATES_LGN)
Loading
Loading