You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ETI stands for "explicit template instantiation." We weren't and aren't strictly using ETI. Instead, we "prebuild" kernels for a small set of template parameter combinations, determined at configure time. We also (will) have an option to disable use of template parameter combinations outside that set. This will help both developers and users reduce build times and library sizes, by determining whether they are unexpectedly using combinations outside the set of prebuilt combinations.
We used to use macros to generate prebuilt combinations. We're switching to the C++11 extern template approach, which obviates the need for definition macros that duplicate code in the templated definitions.
The default solution needs to respect trilinos/Trilinos#362
and thus, it needs to respect the following CMake variables:
Trilinos_ENABLE_FLOAT
Trilinos_ENABLE_COMPLEX_DOUBLE
Trilinos_ENABLE_COMPLEX_FLOAT
(in theory, also, Trilinos_ENABLE_COMPLEX, though no Trilinos package currently uses that)
New macro names:
KOKKOSKERNELS_INST_SCALAR_${SCALAR}
KOKKOSKERNELS_INST_LAYOUT_${LAYOUT}
KOKKOSKERNELS_INST_EXECSPACE_${EXECSPACE}
KOKKOSKERNELS_INST_MEMSPACE_${MEMSPACE}
The variables in the above macro names are upper-case and mangled-for-macro-use versions of the original type names. Here is a CMake rule for converting a type name into a name suitable for use either as a typedef used in a macro argument (macros don't like spaces, commas, etc.), or as part of a macro name (if made upper case).
# Function that turns a valid Scalar, LocalOrdinal, or GlobalOrdinal
# template parameter into a macro name (all caps, with no white space
# and no punctuation other than underscore).
#
# NAME_OUT [out] The mangled type name.
#
# NAME_IN [in] The type to mangle.
FUNCTION(TPETRA_SLG_MACRO_NAME NAME_OUT NAME_IN)
STRING(COMPARE EQUAL "${NAME_IN}" "__float128" IS_FLOAT128)
IF(IS_FLOAT128)
# __float128 is a special case; we remove the __ from the macro name.
SET(${NAME_OUT} "FLOAT128" PARENT_SCOPE)
ELSE()
STRING(COMPARE EQUAL "${NAME_IN}" "std::complex<float>" IS_COMPLEX_FLOAT)
IF(IS_COMPLEX_FLOAT)
SET(${NAME_OUT} "COMPLEX_FLOAT" PARENT_SCOPE)
ELSE()
STRING(COMPARE EQUAL "${NAME_IN}" "std::complex<double>" IS_COMPLEX_DOUBLE)
IF(IS_COMPLEX_DOUBLE)
SET(${NAME_OUT} "COMPLEX_DOUBLE" PARENT_SCOPE)
ELSE()
# Make upper-case version of ${NAME_IN}.
STRING(TOUPPER "${NAME_IN}" TMP0)
# Use the generic algorithm for mangling the type name.
TPETRA_MANGLE_TEMPLATE_PARAMETER(TMP1 "${TMP0}")
SET(${NAME_OUT} ${TMP1} PARENT_SCOPE)
ENDIF()
ENDIF()
ENDIF()
ENDFUNCTION(TPETRA_SLG_MACRO_NAME)
The text was updated successfully, but these errors were encountered:
This is necessary to handle cmake install better. Since
the number of generated header files is relatively small this
is not as bad as it would be for the cpp files.
This should largely resolve issue #21
Story: #1
ETI stands for "explicit template instantiation." We weren't and aren't strictly using ETI. Instead, we "prebuild" kernels for a small set of template parameter combinations, determined at configure time. We also (will) have an option to disable use of template parameter combinations outside that set. This will help both developers and users reduce build times and library sizes, by determining whether they are unexpectedly using combinations outside the set of prebuilt combinations.
We used to use macros to generate prebuilt combinations. We're switching to the C++11
extern template
approach, which obviates the need for definition macros that duplicate code in the templated definitions.The default solution needs to respect
trilinos/Trilinos#362
and thus, it needs to respect the following CMake variables:
Trilinos_ENABLE_FLOAT
Trilinos_ENABLE_COMPLEX_DOUBLE
Trilinos_ENABLE_COMPLEX_FLOAT
Trilinos_ENABLE_COMPLEX
, though no Trilinos package currently uses that)New macro names:
The variables in the above macro names are upper-case and mangled-for-macro-use versions of the original type names. Here is a CMake rule for converting a type name into a name suitable for use either as a typedef used in a macro argument (macros don't like spaces, commas, etc.), or as part of a macro name (if made upper case).
Summary of that rule:
<
turns into0
>
turns into0
::
turns into_
Here is a more Tpetra-specific CMake rule:
The text was updated successfully, but these errors were encountered: