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

Framework: Add ability to use explicit configure cachefile #12291

Merged
13 changes: 12 additions & 1 deletion cmake/SimpleTesting/cmake/ctest-cdash-setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,18 @@ set(CTEST_CMAKE_GENERATOR "Ninja")

set(CTEST_CONFIGURE_COMMAND_ARGS
"${CMAKE_COMMAND}"
"-C \"${configure_file}\""
)

if(USE_EXPLICIT_TRILINOS_CACHEFILE)
list(APPEND CTEST_CONFIGURE_COMMAND_ARGS
"-D Trilinos_CONFIGURE_OPTIONS_FILE=${configure_file}"
)
else()
list(APPEND CTEST_CONFIGURE_COMMAND_ARGS
"-C \"${configure_file}\""
)
endif()
list(APPEND CTEST_CONFIGURE_COMMAND_ARGS
"-C \"${package_enables_file}\""
"-G \"${CTEST_CMAKE_GENERATOR}\""
"${CTEST_SOURCE_DIRECTORY}"
Expand Down
12 changes: 9 additions & 3 deletions cmake/tribits/core/package_arch/TribitsPackageMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,19 @@ macro(tribits_disable_optional_dependency upstreamPackageName reasonStr)
" Instead, please call this from the package's base CMakeLists.txt file"
" '${${PACKAGE_NAME}_SOURCE_DIR}/CMakeLists.txt'" )
endif()
# Get the variable names that are going to be set assert they exist already
# Get the variable names that are going to be set
set(packageEnableVarName ${PACKAGE_NAME}_ENABLE_${upstreamPackageName})
assert_defined(${packageEnableVarName})
string(TOUPPER ${upstreamPackageName} upstreamPackageName_UC)
set(havePackageUpstreamPackageMacroVarName
HAVE_${PACKAGE_NAME_UC}_${upstreamPackageName_UC})
assert_defined(${havePackageUpstreamPackageMacroVarName})
# Assert that the vars already exist (to make sure the package and dependency exist)
if (${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST
)
# We only assert if all packages have to exist, which is not true in a reduced source tree
assert_defined(${packageEnableVarName})
assert_defined(${havePackageUpstreamPackageMacroVarName})
endif()
# Set the variables to OFF in local and project-level scopes
if (NOT "${reasonStr}" STREQUAL "")
message("-- ${reasonStr}")
Expand Down
24 changes: 4 additions & 20 deletions packages/amesos2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,20 @@ TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_KLU2
ON
)

IF (Trilinos_ENABLE_ShyLU_NodeTacho AND NOT Kokkos_ENABLE_CUDA AND NOT Kokkos_ENABLE_HIP)
SET(Amesos2_HAVE_TACHO ON)
ELSE()
SET(Amesos2_HAVE_TACHO OFF)
IF (Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_HIP)
tribits_disable_optional_dependency(ShyLU_NodeTacho "NOTE: Disabling ${PACKAGE_NAME}_ENABLE_ShyLU_NodeTacho because CUDA or HIP is enabled in Kokkos")
ENDIF()

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_ShyLU_NodeTacho
HAVE_AMESOS2_TACHO
"Enable Tacho in Amesos2"
${Amesos2_HAVE_TACHO}
)

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_Basker
HAVE_AMESOS2_BASKER
"Enable Basker in Amesos2"
OFF
)

IF (Trilinos_ENABLE_ShyLU_NodeBasker AND Kokkos_ENABLE_OPENMP AND NOT Kokkos_ENABLE_CUDA AND NOT Kokkos_ENABLE_HIP)
SET(Amesos2_HAVE_SHYLUBASKER ON)
ELSE()
SET(Amesos2_HAVE_SHYLUBASKER OFF)
IF (NOT Kokkos_ENABLE_OPENMP OR Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_HIP)
tribits_disable_optional_dependency(ShyLU_NodeBasker "NOTE: Disabling ${PACKAGE_NAME}_ENABLE_ShyLU_NodeBasker because CUDA or HIP is enabled in Kokkos or OpenMP is not enabled in Kokkos")
ENDIF()

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_ShyLU_NodeBasker
HAVE_AMESOS2_SHYLUBASKER
"Enable ShyLUBasker in Amesos2"
${Amesos2_HAVE_SHYLUBASKER}
)

TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_Experimental
HAVE_AMESOS2_EXPERIMENTAL
"Enable building and installation of experimental Amesos2 features."
Expand Down
4 changes: 2 additions & 2 deletions packages/amesos2/cmake/Amesos2_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
#cmakedefine HAVE_AMESOS2_UMFPACK

/* Defined if you want to enable amesos2-tacho */
#cmakedefine HAVE_AMESOS2_TACHO
#cmakedefine HAVE_AMESOS2_SHYLU_NODETACHO

/* Define if you want to build amesos2-superlu */
#cmakedefine HAVE_AMESOS2_SUPERLU
Expand Down Expand Up @@ -116,7 +116,7 @@
#cmakedefine HAVE_AMESOS2_BASKER

/*Define if you want to use ShyLUBasker */
#cmakedefine HAVE_AMESOS2_SHYLUBASKER
#cmakedefine HAVE_AMESOS2_SHYLU_NODEBASKER

/* Define to 1 if SuperLU_DIST uses a SLU_ prefix on a few of its enums */
#cmakedefine HAVE_SUPERLUDIST_ENUM_NAMESPACE
Expand Down
4 changes: 2 additions & 2 deletions packages/amesos2/example/SimpleSolveNonContigMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
int main(int argc, char *argv[]) {
Tpetra::ScopeGuard tpetraScope(&argc,&argv);

#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
std::string solver_name = "ShyLUBasker";
#else
std::string solver_name = "Basker";
Expand Down Expand Up @@ -221,7 +221,7 @@ int main(int argc, char *argv[]) {

// Teuchos::ParameterList & sublist_params = amesos2_params.sublist(solver_name);
// sublist_params.set("IsContiguous", false, "Are GIDs Contiguous");
#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
if ( solver_name == "ShyLUBasker" ) {
amesos2_params.sublist(solver_name).set("num_threads", 1, "Number of threads");
// sublist_params.set("num_threads", 1, "Number of threads");
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/example/quick_solve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
return 0;
}

#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
if( Amesos2::query("ShyLUBasker") ) {
Teuchos::ParameterList amesos2_params("Amesos2");
amesos2_params.sublist(solver_name).set("num_threads", 1, "Number of threads");
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/example/quick_solve_epetra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
return 0;
}

#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
if( Amesos2::query("shylubasker") ) {
Teuchos::ParameterList amesos2_params("Amesos2");
amesos2_params.sublist(solver_name).set("num_threads", 1, "Number of threads");
Expand Down
4 changes: 2 additions & 2 deletions packages/amesos2/src/Amesos2_Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Amesos2 {
}
#endif

#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
if (solverName == "amesos2_shylubasker" ||
//solverName == "ShyLUBasker" || // unnecessary - tolower called on solver name prior
solverName == "shylubasker") {
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace Amesos2 {
}
#endif

#ifdef HAVE_AMESOS2_TACHO
#ifdef HAVE_AMESOS2_SHYLU_NODETACHO
if (solverName == "amesos2_tacho" || solverName == "tacho") {
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/amesos2/src/Amesos2_Factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
#include "Amesos2_Basker.hpp"
#endif

#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
#include "Amesos2_ShyLUBasker.hpp"
#endif

Expand All @@ -116,7 +116,7 @@
#include "Amesos2_Umfpack.hpp"
#endif

#ifdef HAVE_AMESOS2_TACHO // Tacho
#ifdef HAVE_AMESOS2_SHYLU_NODETACHO // Tacho
#include "Amesos2_Tacho.hpp"
#endif

Expand Down Expand Up @@ -576,7 +576,7 @@ struct throw_no_matrix_support_exception {
// Check for our native solver first. Treat KLU and KLU2 as equals.
//
// We use compiler guards in case a user does want to disable KLU2
#ifdef HAVE_AMESOS2_SHYLUBASKER
#ifdef HAVE_AMESOS2_SHYLU_NODEBASKER
if((solverName == "ShyLUBasker") || (solverName == "shylubasker") || (solverName == "amesos2_shylubasker"))
{
return handle_solver_matrix_and_type_support<ShyLUBasker, Matrix,Vector>::apply(A,X,B);
Expand Down Expand Up @@ -623,7 +623,7 @@ struct throw_no_matrix_support_exception {
}
#endif

#ifdef HAVE_AMESOS2_TACHO
#ifdef HAVE_AMESOS2_SHYLU_NODETACHO
if((solverName == "amesos2_tacho") ||
(solverName == "tacho")){
return handle_solver_matrix_and_type_support<TachoSolver,Matrix,Vector>::apply(A, X, B);
Expand Down
6 changes: 4 additions & 2 deletions packages/framework/pr_tools/PullRequestLinuxDriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ test_cmd_options=(
--build-dir=${TRILINOS_BUILD_DIR:?}
--ctest-driver=${WORKSPACE:?}/Trilinos/cmake/SimpleTesting/cmake/ctest-driver.cmake
--ctest-drop-site=${TRILINOS_CTEST_DROP_SITE:?}
#--dry-run
)


if [[ ${GENCONFIG_BUILD_NAME} == *"gnu"* ]]
then
test_cmd_options+=( "--use-explicit-cachefile ")
fi

# Execute the TEST operation
test_cmd="${PYTHON_EXE:?} ${REPO_ROOT:?}/packages/framework/pr_tools/PullRequestLinuxDriverTest.py ${test_cmd_options[@]}"
Expand Down
7 changes: 7 additions & 0 deletions packages/framework/pr_tools/PullRequestLinuxDriverTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def parse_args():
help="Path to the build directory.",
required=False)

optional.add_argument('--use-explicit-cachefile',
dest='use_explicit_cachefile',
action='store_true',
default=False,
help="Use -DTrilinos_CONFIGURE_OPTIONS_FILE instead of -C.",
required=False)

optional.add_argument('--ctest-driver',
dest="ctest_driver",
action='store',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ def arg_ctest_drop_site(self):
"""
return self.args.ctest_drop_site

@property
def arg_use_explicit_cachefile(self):
"""
Argument Wrapper: This property wraps the value provided in self.args
to provide a convenient way to override this value if needed for some
specialty reason or for a customized test.

This parameter stores whether or not an explicit cachefile directive
will be passed (as opposed to using -C).

Returns:
self.args.use_explicit_cachefile
"""
return self.args.use_explicit_cachefile

@property
def arg_build_dir(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def execute_test(self):
f"-Dpackage_enables:FILEPATH={self.arg_filename_packageenables}",
f"-Dsubprojects_file:FILEPATH={self.arg_filename_subprojects}",
f"-DCTEST_DROP_SITE:STRING={self.arg_ctest_drop_site}",
"-DUSE_EXPLICIT_TRILINOS_CACHEFILE:BOOL=" + "ON" if self.arg_use_explicit_cachefile else "OFF",
]

self.message( "--- ctest version:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ def dummy_args(self):
max_cores_allowed=12,
num_concurrent_tests=-1,
ccache_enable=False,
dry_run = False
dry_run = False,
use_explicit_cachefile = False
)
return output

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def dummy_args(self):
max_cores_allowed=12,
num_concurrent_tests=-1,
ccache_enable=False,
dry_run = False
dry_run = False,
use_explicit_cachefile = False
)
return output

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def setUp(self):
max_cores_allowed=12,
num_concurrent_tests=-1,
ccache_enable=False,
dry_run=False)
dry_run=False,
use_explicit_cachefile=False)

self.default_stdout = dedent('''\
| - [R] source-repo-url : /dev/null/source_repo
Expand Down Expand Up @@ -120,7 +121,7 @@ def setUp(self):
--pullrequest-number PULLREQUEST_NUMBER
--jenkins-job-number JENKINS_JOB_NUMBER
[--source-dir SOURCE_DIR] [--build-dir BUILD_DIR]
[--ctest-driver CTEST_DRIVER]
[--use-explicit-cachefile] [--ctest-driver CTEST_DRIVER]
[--ctest-drop-site CTEST_DROP_SITE]
[--pullrequest-cdash-track PULLREQUEST_CDASH_TRACK]
[--pullrequest-env-config-file PULLREQUEST_ENV_CONFIG_FILE]
Expand Down Expand Up @@ -160,6 +161,8 @@ def setUp(self):
Directory containing the source code to compile/test.
--build-dir BUILD_DIR
Path to the build directory.
--use-explicit-cachefile
Use -DTrilinos_CONFIGURE_OPTIONS_FILE instead of -C.
--ctest-driver CTEST_DRIVER
Location of the CTest driver script to load via `-S`.
--ctest-drop-site CTEST_DROP_SITE
Expand Down Expand Up @@ -220,7 +223,7 @@ def setUp(self):
--pullrequest-number PULLREQUEST_NUMBER
--jenkins-job-number JENKINS_JOB_NUMBER
[--source-dir SOURCE_DIR] [--build-dir BUILD_DIR]
[--ctest-driver CTEST_DRIVER]
[--use-explicit-cachefile] [--ctest-driver CTEST_DRIVER]
[--ctest-drop-site CTEST_DROP_SITE]
[--pullrequest-cdash-track PULLREQUEST_CDASH_TRACK]
[--pullrequest-env-config-file PULLREQUEST_ENV_CONFIG_FILE]
Expand Down