From eb711b5599993937bb17e85fe163620f05e4de49 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sat, 13 May 2023 12:46:54 -0600 Subject: [PATCH 01/23] Automatic snapshot commit from tribits at 9e6f4b99 Origin repo remote tracking branch: 'github/master' Origin repo remote repo URL: 'github = git@github.com:TriBITSPub/TriBITS.git' Git describe: vera-release-3.5-start-1789-gb669da78 At commit: commit 9e6f4b999cfc38fcc40475491dc962ae514c08f2 Author: Roscoe A. Bartlett Date: Thu May 11 13:36:23 2023 -0600 Summary: Fix some old misspellings caught by codespell tests (#63) --- cmake/tribits/CHANGELOG.md | 15 ++- .../ci_support/CDashQueryAnalyzeReport.py | 54 ++++---- cmake/tribits/ci_support/CheckinTest.py | 2 +- .../ci_support/cdash_analyze_and_report.py | 6 +- cmake/tribits/common_tpls/FindTPLHDF5.cmake | 5 +- .../common_tpls/utils/ParseLibraryList.cmake | 2 +- .../package_arch/TribitsAddAdvancedTest.cmake | 2 +- .../core/package_arch/TribitsAddLibrary.cmake | 4 +- .../TribitsAddOptionAndDefine.cmake | 2 +- .../core/package_arch/TribitsAddTest.cmake | 2 +- .../package_arch/TribitsAddTestHelpers.cmake | 6 +- .../TribitsAdjustPackageEnables.cmake | 26 ++-- .../package_arch/TribitsGlobalMacros.cmake | 2 +- .../package_arch/TribitsInstallHeaders.cmake | 2 +- ...ribitsInternalPackageWriteConfigFile.cmake | 24 +++- .../TribitsProcessEnabledTpls.cmake | 44 ++++++- .../TribitsReadDepsFilesCreateDepsGraph.cmake | 2 +- ...itsSystemDataStructuresMacrosFunctions.rst | 121 ++++++++++-------- ...ribitsTplFindIncludeDirsAndLibraries.cmake | 2 +- .../TribitsCTestDriverCoreHelpers.cmake | 14 +- .../tribits/devtools_install/install-mpich.py | 2 +- .../devtools_install/install_devtools.py | 2 +- .../build_ref/TribitsBuildReferenceBody.rst | 36 ++++-- .../guides/TribitsCoreDetailedReference.rst | 2 +- .../tribits/doc/guides/TribitsGuidesBody.rst | 88 +++++++------ .../TribitsSystemMacroFunctionDocTemplate.rst | 1 + cmake/tribits/doc/guides/rst2latex.tex | 2 +- .../src/TribitsTutorial_ConvertAProject.rst | 10 +- .../packages/package1/CMakeLists.txt | 61 ++++++++- .../cmake/raw/Package1Config.cmake.in | 3 + .../package1/src/CMakeLists.raw.cmake | 24 ++++ .../packages/package1/src/CMakeLists.txt | 20 +-- .../package1/test/CMakeLists.raw.cmake | 3 + .../packages/package1/test/CMakeLists.txt | 9 +- cmake/tribits/python_utils/SnapshotDir.py | 2 +- .../python_utils/extract_rst_cmake_doc.py | 2 +- cmake/tribits/python_utils/gitdist.py | 39 +----- 37 files changed, 392 insertions(+), 251 deletions(-) create mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in create mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake create mode 100644 cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake diff --git a/cmake/tribits/CHANGELOG.md b/cmake/tribits/CHANGELOG.md index ad09ea89dcb7..00ee3427aa03 100644 --- a/cmake/tribits/CHANGELOG.md +++ b/cmake/tribits/CHANGELOG.md @@ -2,6 +2,17 @@ ChangeLog for TriBITS ---------------------------------------- +## 2023-5-03: + +* **Added:** Added support for non-fully TriBITS-compatible external packages. + Now, a `Config.cmake` file need not define + `::all_libs` targets for all of its upstream dependencies. The + updated macro `tribits_process_enabled_tpls()` will find any missing + upstream external packages/TPLs as needed (see updated documentation in the + section "TriBITS-Compliant External Packages" in the "TriBITS Users Guide" + and the section "Processing of external packages/TPLs and TriBITS-compliant + external packages" in the "TriBITS Maintainers Guide"). + ## 2023-02-24: * **Changed:** Upgraded minimum required CMake version from 3.17 to 3.23. @@ -214,9 +225,9 @@ ChangeLog for TriBITS macro `tribits_extpkg_define_dependencies()` that sets `_LIB_ALL_DEPENDENCIES`. Now `_LIB_ENABLED_DEPENDENCIES` is automatically set from `_LIB_ALL_DEPENDENCIES` based on what - TPLs are actaully enabled. This avoids the problem described below from + TPLs are actually enabled. This avoids the problem described below from directly setting `_LIB_ENABLED_DEPENDENCIES` without reguard to - what TPLs are actaully enabled. This maintains backward compatibility for + what TPLs are actually enabled. This maintains backward compatibility for existing configure scripts where an upstream TPL may not be enabled in some strange configure scripts (see [TriBITSPub/TriBITS#494](https://github.com/TriBITSPub/TriBITS/issues/494)). diff --git a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py index 5556a65c2141..dc20a2f54ec2 100644 --- a/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py +++ b/cmake/tribits/ci_support/CDashQueryAnalyzeReport.py @@ -40,9 +40,11 @@ try: # Python 2 from urllib2 import urlopen + from urllib2 import quote as urlquote except ImportError: # Python 3 from urllib.request import urlopen + from urllib.parse import quote as urlquote import sys import hashlib @@ -716,41 +718,45 @@ def getAndCacheCDashQueryDataOrReadFromCache( return cdashQueryData +def normalizeUrlStrings(*args): + return [urlquote(x) for x in args] + + # Construct full cdash/api/v1/index.php query URL to pull data down given the # pieces def getCDashIndexQueryUrl(cdashUrl, projectName, date, filterFields): + # for legacy reasons, this function assumes we normalized projectName + projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/api/v1/index.php?project="+projectName+dateArg \ - + "&"+filterFields + + "&"+filterFields # Construct full cdash/index.php browser URL given the pieces def getCDashIndexBrowserUrl(cdashUrl, projectName, date, filterFields): + # for legacy reasons, this function assumes we normalized projectName + projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/index.php?project="+projectName+dateArg \ - + "&"+filterFields + + "&"+filterFields # Construct full cdash/api/v1/queryTests.php query URL given the pieces def getCDashQueryTestsQueryUrl(cdashUrl, projectName, date, filterFields): + # for legacy reasons, this function assumes we normalized projectName + projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" cdashTestUrl = cdashUrl+"/api/v1/queryTests.php?project="+projectName+dateArg+"&"+filterFields - return replaceNonUrlCharsInUrl(cdashTestUrl) - - -# Replace non-URL chars and return new URL string -def replaceNonUrlCharsInUrl(url): - urlNew = url - urlNew = urlNew.replace(' ', '%20') - # ToDo: Replace other chars as needed - return urlNew + return cdashTestUrl # Construct full cdash/queryTests.php browser URL given the pieces def getCDashQueryTestsBrowserUrl(cdashUrl, projectName, date, filterFields): + # for legacy reasons, this function assumes we normalized projectName + projectName, = normalizeUrlStrings(projectName,) if date: dateArg = "&date="+date else: dateArg = "" return cdashUrl+"/queryTests.php?project="+projectName+dateArg+"&"+filterFields @@ -1701,29 +1707,33 @@ def __call__(self, testDict): dateRangeEndDateStr = self.__date beginEndUrlFields = "begin="+dateRangeBeginDateStr+"&end="+dateRangeEndDateStr + # normalize names for query + projectName_url, buildName_url, testname_url, site_url = normalizeUrlStrings( + projectName, buildName, testname, site) + # Define queryTests.php query filters for test history testHistoryQueryFilters = \ beginEndUrlFields+"&"+\ "filtercombine=and&filtercombine=&filtercount=3&showfilters=1&filtercombine=and"+\ - "&field1=buildname&compare1=61&value1="+buildName+\ - "&field2=testname&compare2=61&value2="+testname+\ - "&field3=site&compare3=61&value3="+site + "&field1=buildname&compare1=61&value1="+buildName_url+\ + "&field2=testname&compare2=61&value2="+testname_url+\ + "&field3=site&compare3=61&value3="+site_url # URL used to get the history of the test in JSON form testHistoryQueryUrl = \ - getCDashQueryTestsQueryUrl(cdashUrl, projectName, None, testHistoryQueryFilters) + getCDashQueryTestsQueryUrl(cdashUrl, projectName_url, None, testHistoryQueryFilters) # URL to embed in email to show the history of the test to humans testHistoryBrowserUrl = \ - getCDashQueryTestsBrowserUrl(cdashUrl, projectName, None, testHistoryQueryFilters) + getCDashQueryTestsBrowserUrl(cdashUrl, projectName_url, None, testHistoryQueryFilters) # URL for to the build summary on index.php page buildHistoryEmailUrl = getCDashIndexBrowserUrl( - cdashUrl, projectName, None, + cdashUrl, projectName_url, None, beginEndUrlFields+"&"+\ "filtercombine=and&filtercombine=&filtercount=2&showfilters=1&filtercombine=and"+\ - "&field1=buildname&compare1=61&value1="+buildName+\ - "&field2=site&compare2=61&value2="+site + "&field1=buildname&compare1=61&value1="+buildName_url+\ + "&field2=site&compare2=61&value2="+site_url ) # ToDo: Replace this with the the URL to just this one build the index.php # page. To do that, get the build stamp from the list of builds on CDash @@ -2102,7 +2112,7 @@ def __call__(self, dict_in): # # limitRowsToDisplay [in]: The max number of rows to display. The default is # None which will result in no limit to the number of rows displayed. The top -# limitRowsToDisplay items will be dispalyed after the list is sorted. +# limitRowsToDisplay items will be displayed after the list is sorted. # def sortAndLimitListOfDicts(listOfDicts, sortKeyList = None, limitRowsToDisplay = None\ @@ -2405,7 +2415,7 @@ def getCDashDataSummaryHtmlTableTitleStr(dataTitle, dataCountAcronym, numItems, # # limitRowsToDisplay [in]: The max number of rows to display. The default is # None which will result in no limit to the number of rows displayed. The top -# limitRowsToDisplay items will be dispalyed after the list is sorted. +# limitRowsToDisplay items will be displayed after the list is sorted. # # htmlStyle [in]: The HTML style data (between . If None is # passed in then a default style is provided internally (see @@ -2692,7 +2702,7 @@ def __init__(self, cdashReportData, # # verbose [in] If set to True then some more verbose info is printed to # STDOUT. If False, then nothing is printed to STDOUT (which is useful - # for unit testsing). The default is True. + # for unit testing). The default is True. # # On output, self.cdashReportData data will be updated with the summary and # table of this given build-set. In particular, the following diff --git a/cmake/tribits/ci_support/CheckinTest.py b/cmake/tribits/ci_support/CheckinTest.py index 7566143c7551..1b330c30c38d 100644 --- a/cmake/tribits/ci_support/CheckinTest.py +++ b/cmake/tribits/ci_support/CheckinTest.py @@ -2456,7 +2456,7 @@ def checkinTest(tribitsDir, inOptions, configuration={}): abortGracefullyDueToNoChangesToPush = True runBuildCases = False elif pullPassed: - print("\nThe pull passsed, running the build/test cases ...\n") + print("\nThe pull passed, running the build/test cases ...\n") runBuildCases = True else: print("\nNot running any build/test cases because the pull failed!\n") diff --git a/cmake/tribits/ci_support/cdash_analyze_and_report.py b/cmake/tribits/ci_support/cdash_analyze_and_report.py index 2e22cfca1fed..201502a9ec1e 100755 --- a/cmake/tribits/ci_support/cdash_analyze_and_report.py +++ b/cmake/tribits/ci_support/cdash_analyze_and_report.py @@ -542,6 +542,10 @@ def getTestHistory(self, testLOD): # D.2.a) Get list of dicts of builds off cdash/index.phpp # + # @arghdos: note, we do not have to normalize the URLs from the input + # options because they are currently taken from the cdash site already + # (i.e., they are already in normalized form). + cdashIndexBuildsBrowserUrl = CDQAR.getCDashIndexBrowserUrl( inOptions.cdashSiteUrl, inOptions.cdashProjectName, inOptions.date, inOptions.cdashBuildsFilters) @@ -663,7 +667,7 @@ def getTestHistory(self, testLOD): CDQAR.MatchDictKeysValuesFunctor(nonpassingTestsSLOD) # - # D.3) Partition the varous list of tests into different sets that will + # D.3) Partition the various list of tests into different sets that will # be displayed in different tables. # diff --git a/cmake/tribits/common_tpls/FindTPLHDF5.cmake b/cmake/tribits/common_tpls/FindTPLHDF5.cmake index d89e4cd98415..ea218295def1 100644 --- a/cmake/tribits/common_tpls/FindTPLHDF5.cmake +++ b/cmake/tribits/common_tpls/FindTPLHDF5.cmake @@ -6,10 +6,9 @@ set(HDF5_INTERNAL_IS_MODERN FALSE) if (Netcdf_ALLOW_MODERN) - set(minimum_modern_HDF5_version 1.10.9) print_var(Netcdf_ALLOW_MODERN) - message("-- Using find_package(HDF5 ${minimum_modern_HDF5_version} CONFIG) ...") - find_package(HDF5 ${minimum_modern_HDF5_version} CONFIG) + message("-- Using find_package(HDF5 CONFIG) ...") + find_package(HDF5 CONFIG) if (HDF5_FOUND) message("-- Found HDF5_CONFIG=${HDF5_CONFIG}") message("-- Generating Netcdf::all_libs and NetcdfConfig.cmake") diff --git a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake index 3f1423b3126c..74affbecc9e8 100644 --- a/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake +++ b/cmake/tribits/common_tpls/utils/ParseLibraryList.cmake @@ -100,7 +100,7 @@ function(parse_library_list) endforeach() - # Now set output vairables + # Now set output variables set(${PARSE_ARGS_DEBUG} "${_debug_libs}" PARENT_SCOPE) set(${PARSE_ARGS_OPT} "${_opt_libs}" PARENT_SCOPE) set(${PARSE_ARGS_GENERAL} "${_gen_libs}" PARENT_SCOPE) diff --git a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake index 4c3ad13b8a3e..fca20e1113a6 100644 --- a/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddAdvancedTest.cmake @@ -373,7 +373,7 @@ include(PrintVar) # instead. **WARNING:** If you want to run such tests using valgrind, you # have to use the raw executable as the ```` argument and *not* # the script. For example, if you have a python script -# ``my_python_test.py`` with ``/usr/bin/env pyhton`` at the top, you can't +# ``my_python_test.py`` with ``/usr/bin/env python`` at the top, you can't # just use:: # # CMND /my_python_test.py ARGS "" "" ... diff --git a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake index 30036149dbdc..0e249f4f9c53 100644 --- a/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddLibrary.cmake @@ -271,7 +271,7 @@ include(TribitsSetAndIncDirs) # ``${CMAKE_INSTALL_PREFIX}/lib/`` (actual install directory is given by # ``${PROJECT}_INSTALL_LIB_DIR``, see `Setting the install prefix`_). # However, this install target will not get created if -# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE`` and +# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE`` and # ``BUILD_SHARD_LIBS=OFF``. But when ``BUILD_SHARD_LIBS=ON``, the install # target will get added. Also, this install target will *not* get added if # ``TESTONLY`` or ``NO_INSTALL_LIB_OR_HEADERS`` are passed in. @@ -280,7 +280,7 @@ include(TribitsSetAndIncDirs) # added using ``install(FILES

...)``, but only if ``TESTONLY`` and # ``NO_INSTALL_LIB_OR_HEADERS`` are not passed in as well. Also, the install # target for the headers will not get added if -# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``. If this +# `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE``. If this # install target is added, then the headers get installed into the flat # directory ``${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}/`` (default is # ``${CMAKE_INSTALL_PREFIX}/include/``, see `Setting the install prefix`_). diff --git a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake index f210f2eaafd6..f82e4976e30a 100644 --- a/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddOptionAndDefine.cmake @@ -54,7 +54,7 @@ include(GlobalSet) # it is true, then sets the global (internal cache) macro define variable # ```` to ``ON``, and otherwise sets it to ``OFF``. If # ``NONCACHE`` is passed in, then ```` is set as a non-cache -# local varaible instead of a cache variable. +# local variable instead of a cache variable. # # This is designed to make it easy to add a user-enabled option to a # configured header file and have the define set in one shot. This would diff --git a/cmake/tribits/core/package_arch/TribitsAddTest.cmake b/cmake/tribits/core/package_arch/TribitsAddTest.cmake index 842bf3b2b94c..6f388fdaca40 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTest.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTest.cmake @@ -853,7 +853,7 @@ function(tribits_add_test EXE_NAME) elseif (PARSE_POSTFIX_AND_ARGS_0) # We will use this list instead else() - # Niether 'ARGS' nor 'POSTFIX_AND_ARGS' was selected so just assume one + # Neither 'ARGS' nor 'POSTFIX_AND_ARGS' was selected so just assume one # empty arg set(PARSE_ARGS " ") set(NUM_PARSE_ARGS 1) diff --git a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake index ba8a6412b67b..715bca20f9b0 100644 --- a/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake +++ b/cmake/tribits/core/package_arch/TribitsAddTestHelpers.cmake @@ -736,7 +736,7 @@ endfunction() # -# Set the timeout for a test already aded +# Set the timeout for a test already added # function(tribits_private_add_test_set_timeout TEST_NAME_IN TIMEOUT_USED_OUT) @@ -753,7 +753,7 @@ endfunction() # -# Set the environment for a test already aded +# Set the environment for a test already added # function(tribits_private_add_test_set_environment TEST_NAME_IN) @@ -768,7 +768,7 @@ endfunction() # -# Set the environment for a test already aded +# Set the environment for a test already added # function(tribits_private_add_test_set_processors TEST_NAME_IN NUM_TOTAL_CORES_USED_IN PROCESSORS_OUT diff --git a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake index cc6da7aba6df..814533ea3594 100644 --- a/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake +++ b/cmake/tribits/core/package_arch/TribitsAdjustPackageEnables.cmake @@ -853,7 +853,7 @@ macro(tribits_set_package_and_related_upstream_packages_to_external packageName tribits_set_upstream_dep_packages_as_external(${packageName} ${subpackageTriggeredParentPackageExternal}) - tribits_set_package_as_processed_by_downstream_tribits_external_package(${packageName}) + tribits_mark_package_as_upstream_of_tribits_compliant_external_package(${packageName}) endmacro() # NOTE: In the above macro, if ${packageName} is made EXTERNAL because it one @@ -1317,10 +1317,16 @@ macro(tribits_set_upstream_dep_packages_as_external packageName endmacro() -# Mark a package as being processed by a downstream TriBITS-compliant external -# package +# Mark a package as being upstream of a TriBITS-compliant external package +# (and therefore should be processed by a downstream TriBITS-complaint +# package) +# +# NOTE: These packages are initially marked by setting +# ``${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. +# If this packages are not actually defined by a downstream TriBITS-compliant +# external package, then this variable will be set to ``FALSE`` later. # -macro(tribits_set_package_as_processed_by_downstream_tribits_external_package packageName) +macro(tribits_mark_package_as_upstream_of_tribits_compliant_external_package packageName) set_default(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) @@ -1344,10 +1350,10 @@ macro(tribits_set_package_as_processed_by_downstream_tribits_external_package p endif() if (packageEnable AND (NOT ${packageName}_IS_TRIBITS_COMPLIANT)) message("-- " - "NOTE: ${packageName} is ${directOrIndirectStr} downstream from a" + "NOTE: ${packageName} is ${directOrIndirectStr} upstream from a" " TriBITS-compliant external package${downstreamPkgStr}") endif() - set(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE TRUE) + set(${packageName}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE TRUE) break() endif() @@ -1358,6 +1364,7 @@ macro(tribits_set_package_as_processed_by_downstream_tribits_external_package p endmacro() + # Macro that sets ``_ENABLE_=ON`` if not already # enabled for all enabled subpackages of a parent package. # @@ -1424,13 +1431,6 @@ macro(tribits_set_internal_package_to_external depPkgName) endmacro() -macro(tribits_set_as_processed_by_downstream_tribits_external_package packageName - depPkgName - ) - -endmacro() - - # Function to return if is to be treated as an EXTERNAL package # in processing of the package # diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index 3ebfa7d9b75e..5315bb0a6ad8 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -439,7 +439,7 @@ macro(tribits_define_global_options_and_define_extra_repos) message(FATAL_ERROR "Error, the value of" " ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS =" " '${${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS}' is invalid!" - " Valid valules include 'WANRING', 'SEND_ERROR', and 'FATAL_ERROR'" + " Valid values include 'WARNING', 'SEND_ERROR', and 'FATAL_ERROR'" ) endif() diff --git a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake index c1bf53039796..7ac01b81edaa 100644 --- a/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake +++ b/cmake/tribits/core/package_arch/TribitsInstallHeaders.cmake @@ -76,7 +76,7 @@ include(CMakeParseArguments) # If specified, then ``COMPONENT `` will be passed into # ``install()``. Otherwise, ``COMPONENT ${PROJECT_NAME}`` will get used. # -# If `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FASLE``, then the +# If `${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS`_ is ``FALSE``, then the # headers will not get installed. # function(tribits_install_headers) diff --git a/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake b/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake index 914825ffad41..7d3c1bb683b2 100644 --- a/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake +++ b/cmake/tribits/core/package_arch/TribitsInternalPackageWriteConfigFile.cmake @@ -525,25 +525,35 @@ function(tribits_append_dependent_package_config_file_includes_and_enables_str p # Include configurations of dependent packages string(APPEND configFileStr "\n# Include configuration of dependent packages\n") + set(DOLLAR "$") + set(externalPkgsDir + "${DOLLAR}{CMAKE_CURRENT_LIST_DIR}/../../${${PROJECT_NAME}_BUILD_DIR_EXTERNAL_PKGS_DIR}") foreach(depPkg IN LISTS ${packageName}_LIB_ENABLED_DEPENDENCIES) - set(packageConfigBaseDir "") # Initially, no add include() + set(findDepPkgCode "") # Start out not including anything if (${depPkg}_PACKAGE_BUILD_STATUS STREQUAL "INTERNAL") - set(packageConfigBaseDir "\${CMAKE_CURRENT_LIST_DIR}/../${depPkg}") + set(findDepPkgCode + " include(\"${DOLLAR}{CMAKE_CURRENT_LIST_DIR}/../${depPkg}/${depPkg}Config.cmake\")\n") elseif (${depPkg}_PACKAGE_BUILD_STATUS STREQUAL "EXTERNAL") if (NOT "${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}" STREQUAL "") - set(packageConfigBaseDir "${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}") + set(findDepPkgCode + " include(\"${${depPkg}_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR}/${depPkg}Config.cmake\")\n") + elseif (${depPkg}_FINDMOD STREQUAL "TRIBITS_PKG") + assert_defined(${depPkg}_CONFIG) + string(APPEND findDepPkgCode + " include(\"${${depPkg}_CONFIG}\")\n" + " set(${depPkg}_CONFIG \"${${depPkg}_CONFIG}\")\n") else() - set(packageConfigBaseDir - "\${CMAKE_CURRENT_LIST_DIR}/../../${${PROJECT_NAME}_BUILD_DIR_EXTERNAL_PKGS_DIR}/${depPkg}") + set(findDepPkgCode + " include(\"${externalPkgsDir}/${depPkg}/${depPkg}Config.cmake\")\n") endif() else() message(FATAL_ERROR "ERROR:" " ${depPkg}_PACKAGE_BUILD_STATUS='${${depPkg}_PACKAGE_BUILD_STATUS}' invalid!") endif() - if (packageConfigBaseDir) + if (findDepPkgCode) string(APPEND configFileStr "if (NOT TARGET ${depPkg}::all_libs)\n" - " include(\"${packageConfigBaseDir}/${depPkg}Config.cmake\")\n" + "${findDepPkgCode}" "endif()\n" ) endif() diff --git a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake index b161a9edef11..890b4eb23af3 100644 --- a/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake +++ b/cmake/tribits/core/package_arch/TribitsProcessEnabledTpls.cmake @@ -47,9 +47,15 @@ include(TribitsGeneralMacros) # Standard TriBITS utilities includes include(AppendStringVar) include(TribitsStandardizePaths) +include(TribitsCreateReverseList) -# Gather information from enabled TPLs +# @MACRO: tribits_process_enabled_tpls() +# +# Gather information and targets from enabled TPLs +# +# For more info, see `Processing of external packages/TPLs and +# TriBITS-compliant external packages`_. # macro(tribits_process_enabled_tpls) @@ -65,10 +71,13 @@ macro(tribits_process_enabled_tpls) if (projectHasTribitsCompliantExternalPackages) message("") message("Getting information for all enabled TriBITS-compliant" - " or upstream external packages/TPLs ...") + " or upstream external packages/TPLs in reverse order ...") message("") - foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_enabledExternalTopLevelPackages) + tribits_create_reverse_list(${PROJECT_NAME}_enabledExternalTopLevelPackages + ${PROJECT_NAME}_reverseEnabledExternalTopLevelPackages) + + foreach(TPL_NAME IN LISTS ${PROJECT_NAME}_reverseEnabledExternalTopLevelPackages) if (${TPL_NAME}_IS_TRIBITS_COMPLIANT OR ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE ) @@ -108,16 +117,37 @@ macro(tribits_process_enabled_tribits_compliant_or_upstream_tpl TPL_NAME) message("${tplProcessingString}") if (NOT ${PROJECT_NAME}_TRACE_DEPENDENCY_HANDLING_ONLY) - if (NOT ${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE) + if ( (NOT TARGET ${TPL_NAME}::all_libs) AND ${TPL_NAME}_IS_TRIBITS_COMPLIANT ) tribits_process_enabled_tribits_compliant_tpl(${TPL_NAME}) - else() + set(${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) + elseif (TARGET ${TPL_NAME}::all_libs) + message("-- " + "The external package/TPL ${TPL_NAME} was defined by a downstream" + " TriBITS-compliant external package already processed") + elseif (${TPL_NAME}_FINDMOD AND (NOT ${TPL_NAME}_FINDMOD STREQUAL "TRIBITS_PKG")) message("-- " - "The external package/TPL ${TPL_NAME} will be read in by a downstream" - " TriBITS-compliant external package") + "The external package/TPL ${TPL_NAME} was *NOT* defined by a downstream" + " TriBITS-compliant external package and must be found again in below loop") + set(${TPL_NAME}_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE FALSE) + else() + message(FATAL_ERROR + "Error, the external package/TPL ${TPL_NAME} was *NOT* defined by a downstream" + " TriBITS-compliant external package and has not find module!") endif() endif() endmacro() +# NOTE: Above, handles the case where an upstream external package/TPL should +# have been defined a downstream external package that was already processed +# but it was not defined (because the downstream packages was not a fully +# TriBITS-compliant external package). For a TriBITS-compliant external +# package/TPL that should have been defined by a downstream TriBITS-compliant +# an external package/TPL, the first if-statement above takes care of that +# case by calling find_package(${TPL_NAME}) (because ${TPL_NAME}::all_libs +# will not be defined). However, if the upstream external package/TPL is +# *NOT* TriBITS-compliant, then it may be a legacy TriBITS TPL which means +# that it must be processed in ascending order in order to build the +# downstream TriBITS TPLs correctly. # @MACRO: tribits_process_enabled_standard_tpl() diff --git a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake index c8c22505b3c5..4c193adeff75 100644 --- a/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake +++ b/cmake/tribits/core/package_arch/TribitsReadDepsFilesCreateDepsGraph.cmake @@ -203,7 +203,7 @@ endmacro() # tribits_read_external_package_deps_files_add_to_graph() # # This reads in the file ``${_DEPENDENCIES_FILE}`` and sets the -# varaible:: +# variable:: # # _LIB_DEFINED_DEPENDENCIES # diff --git a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst index 861ccc835ec6..faba873cf22b 100644 --- a/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst +++ b/cmake/tribits/core/package_arch/TribitsSystemDataStructuresMacrosFunctions.rst @@ -460,76 +460,89 @@ Processing of external packages/TPLs and TriBITS-compliant external packages +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ The processing of external packages/TPLs is influenced by whether the external -package is a regular TriBITS TPL or is a TriBITS-compliant external -package. Here, a **TriBITS-Compliant External Package** has a -``Config.cmake`` file that satisfies the following properties: - -* Has the target ``::all_libs``. -* Calls ``find_dependency()`` for all upstream packages it depends on. -* Every upstream dependent package ```` has the target - ``::all_libs``. - -That means that when calling ``find_package()`` for a TriBITS-compliant +package is a regular TriBITS TPL (i.e with a ``FindTPL.cmake`` +modules) or is a TriBITS-compliant external package. Here, a +**TriBITS-Compliant External Package** has a ``Config.cmake`` file +that satisfies the following properties: + +* Has the target ``::all_libs`` which is a fully specified modern + CMake target. +* Calls ``find_dependency()`` or the equivalent for all upstream packages that + it depends on. +* Every upstream dependent package ```` has the target + ``::all_libs``. (But a non-fully TriBITS-compliant external + package need not define this for all of its upstream dependencies.) + +That means that when calling ``find_package()`` for a fully TriBITS-compliant external package, there is no need to worry about finding any of its upstream dependent external packages. That means that any external packages/TPLs -defined a TriBITS project which is upstream from a TriBITS-compliant -external package will be uniquely defined by calling ``find_package()`` on the -most downstream TriBITS-compliant external package that depends on it. -Therefore, defining the external packages and their targets in this set of -external packages just involves calling ``find_package()`` on the terminal -TriBITS-compliant external packages (i.e. TriBITS-compliant -external packages that don't have any downstream dependencies that are -external packages). Then the remaining subset of external packages/TPLs that -don't have a downstream TriBITS-compliant external package dependency -will be defined as usual. (ToDo: Put in a more detailed examples explaining -how this works.) +defined a TriBITS project which is upstream from a TriBITS-compliant external +package will be uniquely defined by calling ``find_package()`` on the most +downstream TriBITS-compliant external package that depends on it. Therefore, +defining the external packages and their targets in this set of external +packages just involves calling ``find_package()`` on the terminal +TriBITS-compliant external packages (i.e. TriBITS-compliant external packages +that don't have any downstream dependencies that are external packages). Then +the remaining subset of external packages/TPLs that don't have a downstream +TriBITS-compliant external package dependency will be defined as usual. +(However, as mentioned above, some of these are not fully TriBITS compliant and +don't fully define the ``::all_libs`` for all of their upstream +dependencies (see below).) + +By having all fully TriBITS-compliant external packages, an external +dependency is never found more than once. The variables that are set internally to define these different subsets of external packages/TPLs are: * ``_IS_TRIBITS_COMPLIANT``: Set the ``TRUE`` if the package - ```` provides the ``::all_libs`` target for itself and all - of its upstream dependent (internal or external) packages (whether this - package is treated as an internal or external package). + ```` provides the ``::all_libs`` by just calling + ``find_package( CONFIG REQUIRED)``. * ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE``: Set to - ``TRUE`` if the external package/TPL will be processed by downstream TriBITS - complient package. In this case, we just print that we are skipping the - find operation and explain why. + ``TRUE`` if the external package/TPL should be (or was after the fact) + defined by a downstream TriBITS-compliant external package. An external package with ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE`` is the one for which ``find_package( CONFIG REQUIRED)`` will be called and does not have any downstream packages that are being treated as external -packages. +packages. Also, ``find_package( CONFIG REQUIRED)`` will be called on +TriBITS-compliant external packages if ``::all_libs`` was not defined +by a downstream non fully TriBITS-compliant external package. -The variable ``_IS_TRIBITS_COMPLIANT`` is set right when the -packages are initially defined by reading in the various input files. That -is, all initially internal packages that are listed in a +The variable ``_IS_TRIBITS_COMPLIANT`` is set right when the packages +are initially defined by reading in the various input files. That is, all +initially internal packages that are listed in a `/PackagesList.cmake`_ file will have -``_IS_TRIBITS_COMPLIANT=TRUE`` set. While all external -packages/TPLs listed in a `/TPLsList.cmake`_ file will have -``_IS_TRIBITS_COMPLIANT=FALSE`` set (except for those tagged -with ``TRIBITS_PKG`` which will have -``_IS_TRIBITS_COMPLIANT=FALSE`` set). - -NOTE: When a TriBITS TPL (i.e. ``_IS_TRIBITS_COMPLIANT=FALSE``) -is being processed, we can't assume where its -``Config.cmake`` file exists so we must find upstream -dependencies using ``set(_DIR ...)`` and -``find_dependency( CONFIG REQUIRED)``. - -So the first loop over external packages/TPLs will be those external -packages/TPLs that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **OR** -``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. And we -only call ``find_package()`` for those TriBITS-compliant external -packages that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** -``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. - -The second loop are those external packages/TPLs that don't have a downstream -TriBITS-compliant external package which are all of those external -packages for which ``_IS_TRIBITS_COMPLIANT=FALSE`` **AND** -``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE``. +``_IS_TRIBITS_COMPLIANT=TRUE`` set while all external packages/TPLs +listed in a `/TPLsList.cmake`_ file will have +``_IS_TRIBITS_COMPLIANT=FALSE`` set (except for those tagged with +``TRIBITS_PKG`` which will have ``_IS_TRIBITS_COMPLIANT=FALSE`` set). + +The processing of external packages/TPLs is done in two loops: + +* The first loop over external packages/TPLs will be those external + packages/TPLs that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **OR** + ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=TRUE``. And we + only call ``find_package()`` for those TriBITS-compliant external packages + that have ``_IS_TRIBITS_COMPLIANT=TRUE`` **AND** don't have + ``::all_libs`` already defined. This is a reverse loop to give an + opportunity for downstream TriBITS-compliant external packages to define + their upstream external packages/TPLs. NOTE: If + ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE`` was set to + ``TRUE`` before this loop starts, it will be set to ``FALSE`` for + non-TriBITS-compliant external packages + (i.e. ``_IS_TRIBITS_COMPLIANT=FALSE``). + +* The second loop processes remaining external packages/TPLs that where not + defined by a downstream TriBITS-compliant external package in the first + loop. These are all TriBITS TPLs for which + ``_IS_TRIBITS_COMPLIANT=FALSE`` **AND** + ``_PROCESSED_BY_DOWNSTREAM_TRIBITS_EXTERNAL_PACKAGE=FALSE`` **AND** + for which ``_FINDMOD`` is not empty and is not ``TRIBITS_PKG``. + +For more details, see the implementation in `tribits_process_enabled_tpls()`_. Other package-related variables diff --git a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake index 490d204ec71e..23d43ad0ef3c 100644 --- a/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake +++ b/cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake @@ -139,7 +139,7 @@ function(tribits_tpl_allow_pre_find_package TPL_NAME ALLOW_PACKAGE_PREFIND_OUT OR (NOT "${${TPL_NAME}_LIBRARY_NAMES}" STREQUAL "") OR (NOT "${${TPL_NAME}_LIBRARY_DIRS}" STREQUAL "") ) - # One ore more of the ${TPL_NAME}_XXX variables are set + # One or more of the ${TPL_NAME}_XXX variables are set if (${TPL_NAME}_FORCE_PRE_FIND_PACKAGE) # Even with one or more of the ${TPL_NAME}_XXX vars set, we still want # to do the find_package(${TPL_NAME} ...) search and ignore this diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake index 08c621ed422c..5e183341f059 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake @@ -791,7 +791,7 @@ endmacro() # Helper macros to pass through common CMake configure arguments used by both -# package-by-pacakge approach and all-at-once approach +# package-by-package approach and all-at-once approach # macro(tribits_fwd_cmake_config_args_0) set( CONFIGURE_OPTIONS @@ -1643,27 +1643,27 @@ macro(tribits_ctest_all_at_once) if (AAO_CONFIGURE_FAILED OR AAO_BUILD_FAILED OR AAO_INSTALL_FAILED) if (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) - # Special value "ALL_PACAKGES" so that it will trigger enabling all + # Special value "ALL_PACKAGES" so that it will trigger enabling all # packages on the next CI iteration! set(${PROJECT_NAME}_FAILED_PACKAGES ALL_PACKAGES) else() # Specific packages were selected to be tested so fail all of them! set(${PROJECT_NAME}_FAILED_PACKAGES ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) endif() - # NOTE: With the all-at-once appraoch, there is no way to determine which + # NOTE: With the all-at-once approach, there is no way to determine which # packages have build or install failures given the current ctest_build() # command. And since some build targets don't get used in tests, we can't # look at what packages have test failures in order to know that a build # failure will cause a test failure. And in the case of install failures, # those will never cause test failures. Therefore, if there are any build # or install failures, we just have to assume that any tested package - # could have failed. Hense, we set the above just like for a (global) + # could have failed. Hence, we set the above just like for a (global) # configure failures. Perhaps we could read the generated *.xml files to - # figure that out but that is not worth the work righ now. The only bad + # figure that out but that is not worth the work right now. The only bad # consequence of this is that a CI build would end up building and testing - # every package even if only one dowstream package had a build failure, + # every package even if only one downstream package had a build failure, # for example. That is just one of the downsides of the all-at-once - # appraoch vs. the package-by-package appraoch. + # approach vs. the package-by-package approach. elseif (FAILED_TEST_LOG_FILE) tribits_get_failed_packages_from_failed_tests("${FAILED_TEST_LOG_FILE}" ${PROJECT_NAME}_FAILED_PACKAGES ) diff --git a/cmake/tribits/devtools_install/install-mpich.py b/cmake/tribits/devtools_install/install-mpich.py index 59db602dbc6d..122dccb5d41e 100755 --- a/cmake/tribits/devtools_install/install-mpich.py +++ b/cmake/tribits/devtools_install/install-mpich.py @@ -146,7 +146,7 @@ def doUntar(self): echoChDir(self.mpichBaseDir) echoRunSysCmnd("tar -xzf "+self.mpichTarball) # NOTE: I found that you have to untar the tarball and can't store the - # open source in the git repo. Otherwise the timestaps are messed up and + # open source in the git repo. Otherwise the timestamps are messed up and # it 'make' tries to recreate some generated files. def doConfigure(self): diff --git a/cmake/tribits/devtools_install/install_devtools.py b/cmake/tribits/devtools_install/install_devtools.py index 78f283a94428..27383bc86df0 100755 --- a/cmake/tribits/devtools_install/install_devtools.py +++ b/cmake/tribits/devtools_install/install_devtools.py @@ -155,7 +155,7 @@ --base - This can also accomidate gitolite repos and other directory structures, + This can also accommodate gitolite repos and other directory structures, for example, with: git@:prerequisites/ diff --git a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index a9ab5f74120c..2c5a98291d35 100644 --- a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -516,7 +516,7 @@ example:: The above will enable the package test suites for ```` and ```` but **not** for ```` (or any other -packages that might get implicitly enabled). One might use this approch if +packages that might get implicitly enabled). One might use this approach if one wants to build and install package ```` but does not want to build and run the test suite for that package. @@ -1994,9 +1994,10 @@ external packages has several consequences: (Otherwise, a configure error will result from the mismatch.) * The definition of any TriBITS external packages/TPLs that are enabled - upstream dependencies from any of these internally defined packages being - treated as external packages will be defined by the calls to - ``find_package()`` and will **not** be found again. + upstream dependencies from any of these external packages should be defined + automatically and will **not** be found again. (But there can be exceptions + for non-fully TriBITS-compliant external packages; see the section + "TriBITS-Compliant External Packages" in the "TriBITS Users Guide".) The logic for treating internally defined packages as external packages will be printed in the CMake configure output in the section ``Adjust the set of @@ -2016,22 +2017,35 @@ the terminal TriBITS-compliant external packages. This is shown in the CMake output in the section ``Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs`` and looks like:: - Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs ... + Getting information for all enabled TriBITS-compliant or upstream external packages/TPLs in reverse order ... - Processing enabled external package/TPL: (...) - -- The external package/TPL will be read in by a downstream TriBITS-compliant external package - Processing enabled external package/TPL: (...) - -- The external package/TPL will be read in by a downstream TriBITS-compliant external package - Processing enabled external package/TPL: (...) - -- The external package/TPL will be read in by a downstream TriBITS-compliant external package Processing enabled external package/TPL: (...) -- Calling find_package( for TriBITS-compliant external package + Processing enabled external package/TPL: (...) + -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed + Processing enabled external package/TPL: (...) + -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed + Processing enabled external package/TPL: (...) + -- The external package/TPL was defined by a downstream TriBITS-compliant external package already processed In the above example ````, ```` and ```` are all direct or indirect dependencies of ```` and therefore calling just ``find_package()`` fully defines those TriBITS-compliant external packages as well. +All remaining TPLs that are not defined in that first reverse loop are defined +in a second forward loop over regular TPLs:: + + Getting information for all remaining enabled external packages/TPLs ... + +NOTE: The case is also supported where a TriBITS-compliant external package +like ```` does not define all of it upstream dependencies (i.e. does not +define the ``::all_libs`` target) and these external packages/TPLs will +be found again. This allows the possibility of finding different/inconsistent +upstream dependencies but this is allowed to accommodate some packages with +non-TriBITS CMake build systems that don't create fully TriBITS-compliant +external packages. + xSDK Configuration Options -------------------------- diff --git a/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst b/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst index 50a90c79aca5..7fbad8103af2 100644 --- a/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst +++ b/cmake/tribits/doc/guides/TribitsCoreDetailedReference.rst @@ -279,7 +279,7 @@ These options are described below. processed in CTest -S driver scripts using ``tribits_ctest_driver()``.) In general, a project should change the default to ``TRUE`` when using a - newer CDash installation with CDash versions 3.0+ that can accomidate the + newer CDash installation with CDash versions 3.0+ that can accommodate the results coming from ctest -S and display them package-by-package very nicely. Otherwise, most projects are better off with package-by-package mode since it results in nicer display on CDash for older CDash versions. diff --git a/cmake/tribits/doc/guides/TribitsGuidesBody.rst b/cmake/tribits/doc/guides/TribitsGuidesBody.rst index 0cbcf2c5a98a..1c86bca77fb0 100644 --- a/cmake/tribits/doc/guides/TribitsGuidesBody.rst +++ b/cmake/tribits/doc/guides/TribitsGuidesBody.rst @@ -2142,7 +2142,7 @@ defined TPL ``TPL_NAME`` is assigned the following global non-cache variables: Note, the ```` field path in the call to `tribits_repository_define_tpls()`_ is relative to the TriBITS repository dir -```` but a relative path in for the varaible `_FINDMOD`_ is +```` but a relative path in for the variable `_FINDMOD`_ is relative to the project dir ````. There is a translation of the ```` field to the variable ``_FINDMOD`` that takes place when the `/TPLsList.cmake`_ file is processed to make this so. @@ -2615,33 +2615,20 @@ packages** as imposed by downstream TriBITS internal packages are: CMake macros or functions that downstream CMake packages may need to use the upstream package ````. -* All of the upstream dependencies (listed in the ``INTERFACE_LINK_LIBRARIES`` - property recursively) are also `TriBITS-compliant packages`_ +* [Optional] All of the upstream dependencies (listed in the + ``INTERFACE_LINK_LIBRARIES`` property recursively) are also + `TriBITS-compliant packages`_ The TriBITS system will also set the variable: * ``_IS_TRIBITS_COMPLIANT``: Set to ``TRUE`` -for all packages that are determined to be TriBITS-compliant packages. +for all packages that are determined to be TriBITS-compliant packages and +satisfy the above criteria. The above are all that is needed by downstream TriBITS packages to build and link against their upstream dependencies. -If a TriBITS package provides any CTest tests/examples, then it must also -satsify the following requirements: - -* Test names must be prefixed with the package name ``_``. - -* Tests should only be added if the variable ``_ENABLE_TESTS`` is - true. - -* Examples (that run as CTest tests) should only be added if the variable - ``_ENABLE_EXAMPLES`` is true. - -* The test ``PROCESSORS`` and other test properties must be set in a way - consistent with `tribits_add_test()`_ so as to run in parallel with other - tests and not overwhelm the computing resources on the machine. - Additional requirements are placed on TriBITS-compliant packages depending on if they are defined as internal CMake packages (i.e. `TriBITS-compliant internal packages`_) or are pulled in as external pre-built/pre-installed @@ -2672,15 +2659,38 @@ The requirements for **TriBITS-compliant internal packages** are: directory ``/lib/cmake//`` allowing the installed package to be used by downstream CMake packages/projects. -* All of the upstream dependencies (recursively) are also `TriBITS-compliant - packages`_ +* [Optional] All of the upstream dependencies (recursively) are also + `TriBITS-compliant packages`_. + +If a TriBITS package provides any CTest tests/examples, then it must also +satisfy the following requirements: + +* Test names must be prefixed with the package name ``_``. + +* Tests should only be added if the variable ``_ENABLE_TESTS`` is + true. + +* Examples (that run as CTest tests) should only be added if the variable + ``_ENABLE_EXAMPLES`` is true. + +* The ``PROCESSORS`` test property and other test properties must be set in a + way consistent with `tribits_add_test()`_ so as to run in parallel with + other tests and not overwhelm the computing resources on the machine. + +* The test ```` must not be added if the cache variable + ``_DISABLE`` is set to ``TRUE`` or if the cache variable + ``_SET_DISABLED_AND_MSG`` is set to non-empty (and the message + string should be printed to STDOUT). TriBITS internal packages that are defined using the TriBITS framework using -the TriBITS-provided macros and functions such as `tribits_add_library()`_ are -automatically `TriBITS-compliant internal packages`_ and when they are -installed they automatically provide `TriBITS-compliant external packages`_. +the TriBITS-provided macros and functions such as `tribits_add_library()`_ and +have tests defined using the functions `tribits_add_test()`_ and +`tribits_add_advanced_test()`_ are automatically `TriBITS-compliant internal +packages`_. And when these TriBITS-implemented internal packages are +installed, they automatically provide `TriBITS-compliant external packages`_. But it is possible for a CMake package to write its own raw CMake code to -satisfy these basic requirements for both internal and external packages. +satisfy these basic requirements for both internal and (installed) external +packages. .. _TriBITS-Compliant External Package: @@ -2692,8 +2702,9 @@ For packages that are installed on the system and not built in the current CMake project, a streamlined type of `TriBITS External Package/TPL`_ is a *TriBITS-compliant external package*. These special types of external package's don't need to provide a `FindTPL.cmake`_ find module. -Instead, they are fully defined by calling ``find_package()`` to -locate and load their ``Config.cmake`` package config file. +Instead, they are fully defined by calling ``find_package()`` or +``include(/Config.cmake)`` to load their +``Config.cmake`` package config file. The requirements for **TriBITS-compliant external packages** are: @@ -2708,18 +2719,23 @@ The requirements for **TriBITS-compliant external packages** are: ``_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE``: Points to the file ``Config.cmake`` (i.e. ``${CMAKE_CURRENT_LIST_FILE}``) - * ``_DIR`` or - ``_TRIBITS_COMPLIANT_PACKAGE_CONFIG_FILE_DIR`` Points to the base - directory for ``Config.cmake`` - (i.e. ``${CMAKE_CURRENT_LIST_DIR}``) - -* All of the upstream dependencies (recursively) are also provided as - `TriBITS-compliant external packages`_ with +* [Optional] All of the upstream dependencies (recursively) are also provided + as `TriBITS-compliant external packages`_ with ``Config.cmake`` files (see above) and all of the targets and variables for a TriBITS-compliant external package are defined when the ``Config.cmake`` file is included (or pulled in with ``find_package()`` or ``find_dependency()``). +NOTE: TriBITS-compliant external packages that provide TriBITS-compliant +external packages for all of their upstream dependencies are said to be *fully +TriBITS-compliant external packages* while those that don't are said to be +*non-fully TriBITS-compliant external packages*. The TriBITS external +package/TPL system is robust enough to deal with non-fully TriBITS-compliant +external packages. Any TriBITS external packages/TPLs upstream from a +non-fully TriBITS-compliant external package will be found again in the +current TriBITS project. (In these cases, it is up to the user to make sure +that the same upstream packages are found.) + Example TriBITS Projects ========================= @@ -5681,7 +5697,7 @@ to modern CMake along with the proper usage of complete However, to maintain backwards compatibility with the legacy TriBITS TPL system (such as when upgrading a existing ``FindTPL.cmake`` file), a -``FindTPL.cmake`` file can be extended to use the +``FindTPL.cmake`` file can be extended to use the function `tribits_tpl_allow_pre_find_package()`_ in combination with the functions ``tribits_extpkg_create_imported_all_libs_target_and_config_file()`` and `tribits_tpl_find_include_dirs_and_libraries()`_ as follows:: @@ -5717,7 +5733,7 @@ the TPL. See the documentation for `tribits_tpl_allow_pre_find_package()`_ for conditions where ``_ALLOW_PREFIND`` is set to ``FALSE`` (and therefore ``find_package()`` is not called). -Note that in the above ``FindTPL.cmake`` file that +Note in the above ``FindTPL.cmake`` file that ``find_package()`` will be called even on reconfigures. That is critical since ``find_package()`` defines IMPORTED targets that must be available each time configure is called. Also, if diff --git a/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst b/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst index 6a71292c45a5..a2fdb71c978b 100644 --- a/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst +++ b/cmake/tribits/doc/guides/TribitsSystemMacroFunctionDocTemplate.rst @@ -34,6 +34,7 @@ understand the internals of TriBITS. @MACRO: tribits_parse_subpackages_append_packages_add_options() + @MACRO: tribits_prep_to_read_dependencies() + @MACRO: tribits_process_all_repository_deps_setup_files() + +@MACRO: tribits_process_enabled_tpls() + @MACRO: tribits_process_package_dependencies_lists() + @MACRO: tribits_process_packages_and_dirs_lists() + @MACRO: tribits_process_project_dependency_setup_file() + diff --git a/cmake/tribits/doc/guides/rst2latex.tex b/cmake/tribits/doc/guides/rst2latex.tex index 75646b96cf97..6385d26e8f5b 100644 --- a/cmake/tribits/doc/guides/rst2latex.tex +++ b/cmake/tribits/doc/guides/rst2latex.tex @@ -8,7 +8,7 @@ % Generated files should process well standalone too, LaTeX might give a % message about a missing file. -% donot indent first line of paragraph. +% Do not indent first line of paragraph. \setlength{\parindent}{0pt} \setlength{\parskip}{5pt plus 2pt minus 1pt} diff --git a/cmake/tribits/doc/tutorial/src/TribitsTutorial_ConvertAProject.rst b/cmake/tribits/doc/tutorial/src/TribitsTutorial_ConvertAProject.rst index d3b202ac97d9..e80d563044a5 100644 --- a/cmake/tribits/doc/tutorial/src/TribitsTutorial_ConvertAProject.rst +++ b/cmake/tribits/doc/tutorial/src/TribitsTutorial_ConvertAProject.rst @@ -231,11 +231,11 @@ have the following files: this projec t and where to find them #. *TPLsList.cmke* - Tells tribits which TPLs that packages my depend on and how to find them -#. *ProjectName.cmake* - defines the projet name and possibly some +#. *ProjectName.cmake* - defines the project name and possibly some other project level settings #. *Version.cmake* - set the version of the software being built #. *Package Directories* - A directory for each package that contains - everything nesseesary for a Tribits package described above. Often + everything necessary for a Tribits package described above. Often Projects will have a packages directory that contains all of the individual package directories in the project @@ -393,14 +393,14 @@ in this project level CMakeLists file: for this project o build. If you try and run with a lower version then there will be an error. You cannot specify a version lower than 3.23.0 -#. Include ProjectNmae.cmake and call project() with argument PROJECT_NAME +#. Include ProjectName.cmake and call project() with argument PROJECT_NAME #. specify the directory to tribits and include TriBITS.cmake #. specify which packages are turned on/off by default #. call tribits_project() -Here is an examlpe of a project CMakeLists:: +Here is an example of a project CMakeLists:: - # Deefine your minimum CMake version + # Define your minimum CMake version cmake_minimum_required(VERSION 3.23.0 FATAL_ERROR) # Define your project name and set up major project options diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt index bf2638c61fe9..5f3b156eba2f 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt @@ -1,4 +1,57 @@ -tribits_package(Package1) -add_subdirectory(src) -tribits_add_test_directories(test) -tribits_package_postprocess() +cmake_minimum_required(VERSION 3.23.0 FATAL_ERROR) + +macro(include_raw_cmake_build) + if (NOT COMMAND tribits_project) + include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.raw.cmake" + NO_POLICY_SCOPE) + return() + endif() +endmacro() + +if (COMMAND tribits_package) + + # Being processed as a TriBITS package + tribits_package(Package1) + add_subdirectory(src) + tribits_add_test_directories(test) + tribits_package_postprocess() + +else() + + message("Configuring raw CMake project Package1") + project(Package1 LANGUAGES C CXX) + include(GNUInstallDirs) + find_package(Tpl1 CONFIG REQUIRED) + add_subdirectory(src) + if (Package1_ENABLE_TESTS) + include(CTest) + add_subdirectory(test) + endif() + + # Generate the all_libs target + add_library(Package1_all_libs INTERFACE) + set_target_properties(Package1_all_libs PROPERTIES + EXPORT_NAME all_libs) + target_link_libraries(Package1_all_libs INTERFACE Package1_package1) + install( + TARGETS Package1_all_libs + EXPORT ${PROJECT_NAME} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + + # Generate and install the Package1Config.cmake file + install(EXPORT ${PROJECT_NAME} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + NAMESPACE ${PROJECT_NAME}:: + FILE ${PROJECT_NAME}ConfigTargets.cmake ) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/raw/Package1Config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Package1Config.install.cmake" + @ONLY ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Package1Config.install.cmake" + RENAME "Package1Config.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) + +endif() + + diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in new file mode 100644 index 000000000000..63cffb786754 --- /dev/null +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/cmake/raw/Package1Config.cmake.in @@ -0,0 +1,3 @@ +set(Tpl1_DIR "@Tpl1_DIR@") +find_package(Tpl1 CONFIG REQUIRED) +include("${CMAKE_CURRENT_LIST_DIR}/Package1ConfigTargets.cmake") diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake new file mode 100644 index 000000000000..aa5dffd55aa0 --- /dev/null +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.raw.cmake @@ -0,0 +1,24 @@ +# Create and install library 'package1' +add_library(Package1_package1 Package1.hpp Package1.cpp) +target_include_directories(Package1_package1 + PUBLIC $) +target_link_libraries(Package1_package1 + PRIVATE tpl1::tpl1 ) +set_target_properties(Package1_package1 PROPERTIES + EXPORT_NAME package1) +add_library(Package1::package1 ALIAS Package1_package1) +install( + TARGETS Package1_package1 + EXPORT ${PROJECT_NAME} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) +install( + FILES Package1.hpp + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) + +# Create and install executable 'package1-prg' +add_executable(package1-prg Package1_Prg.cpp) +target_link_libraries(package1-prg PRIVATE Package1::package1) +install( + TARGETS package1-prg + EXPORT ${PROJECT_NAME} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt index b74162bb25ed..59e7a3b5b68f 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt @@ -1,22 +1,8 @@ -set(HEADERS "") -set(SOURCES "") +include_raw_cmake_build() tribits_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -append_set(HEADERS - Package1.hpp - ) -append_set(SOURCES - Package1.cpp - ) - -tribits_add_library( - package1 - HEADERS ${HEADERS} - SOURCES ${SOURCES} - ) +tribits_add_library(package1 HEADERS Package1.hpp SOURCES Package1.cpp) tribits_add_executable(package1-prg NOEXEPREFIX NOEXESUFFIX - SOURCES Package1_Prg.cpp - INSTALLABLE - ) + SOURCES Package1_Prg.cpp INSTALLABLE ) diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake new file mode 100644 index 000000000000..6e4cf3a0f2e8 --- /dev/null +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.raw.cmake @@ -0,0 +1,3 @@ +add_test(NAME Package1_Prg COMMAND package1-prg) +set_tests_properties(Package1_Prg + PROPERTIES PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1") diff --git a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt index afef4e708adf..906e0faf8b94 100644 --- a/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt +++ b/cmake/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt @@ -1,6 +1,5 @@ +include_raw_cmake_build() + tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX - NAME Prg - DIRECTORY ${PACKAGE_BINARY_DIR}/src - NUM_MPI_PROCS 1 - PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" - ) + NAME Prg DIRECTORY ${PACKAGE_BINARY_DIR}/src NUM_MPI_PROCS 1 + PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" ) diff --git a/cmake/tribits/python_utils/SnapshotDir.py b/cmake/tribits/python_utils/SnapshotDir.py index ccaf58cf78e1..f7106da086b0 100644 --- a/cmake/tribits/python_utils/SnapshotDir.py +++ b/cmake/tribits/python_utils/SnapshotDir.py @@ -401,7 +401,7 @@ def snapshotDirMainDriver(cmndLineArgs, defaultOptionsIn = None, stdout = None): return # All done! # - # C) Exectute the + # C) Execute the # snapshotDir(options) diff --git a/cmake/tribits/python_utils/extract_rst_cmake_doc.py b/cmake/tribits/python_utils/extract_rst_cmake_doc.py index b9a8e8cdf36d..a179712c58fb 100755 --- a/cmake/tribits/python_utils/extract_rst_cmake_doc.py +++ b/cmake/tribits/python_utils/extract_rst_cmake_doc.py @@ -185,7 +185,7 @@ error will occur. See the unit tests in extract_rst_cmake_doc_UnitTest.py for examples of -behavior w.r.t. different errors and fomatting mistakes. +behavior w.r.t. different errors and formatting mistakes. """ # diff --git a/cmake/tribits/python_utils/gitdist.py b/cmake/tribits/python_utils/gitdist.py index 672bd6be2927..db20c7ddfa4a 100755 --- a/cmake/tribits/python_utils/gitdist.py +++ b/cmake/tribits/python_utils/gitdist.py @@ -473,7 +473,7 @@ def getHelpTopicsStr(): |:-------------- |:-------:|:------------------- |:---------------------- |:---------------------------------------------- | | MockProjectDir | e2dc488 | 2019-10-23 10:16:07 | user@domain.com | Merge Pull Request #1234 from user/repo/branch | | ExtraRepo1 | f671414 | 2019-10-22 11:18:47 | wile.e.coyote@acme.com | Fixed a Bug | - | ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somwhere.com | Did Some Work | + | ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somewhere.com | Did Some Work | If the option --dist-short is also passed in, the output will be limited to: @@ -1039,7 +1039,6 @@ def getDistHelpTopicStr(helpTopicVal): def getUsageHelpStr(helpTopicArg): - #print("helpTopicArg = " + helpTopicArg) usageHelpStr = helpUsageHeader if helpTopicArg == "": # No help topic option so just use the standard help header @@ -1050,8 +1049,6 @@ def getUsageHelpStr(helpTopicArg): # Option not formatted correctly, set let error handler get it." return "" (helpTopicArgName, helpTopicVal) = helpTopicArg.split("=") - #print("helpTopicArgName = " + helpTopicArgName) - #print("helpTopicVal = " + helpTopicVal) usageHelpStr += getDistHelpTopicStr(helpTopicVal) return usageHelpStr @@ -1094,7 +1091,6 @@ def runCmnd(options, cmnd): # Determine if a command exists: def commandExists(cmnd): whichCmnd = getCmndOutput("which "+cmnd).strip() - #print("whichCmnd = %s" % whichCmnd) if os.path.exists(whichCmnd): return True return False @@ -1188,14 +1184,10 @@ def getCommandlineOps(): helpTopicArg = "" for arg in argv: - #print("\narg = '" + arg + "'") matchedNativeArg = False for nativeArgName in nativeArgNames: - #print("\nnativeArgName ='" + nativeArgName + "'") currentArgName = arg[0:len(nativeArgName)] - #print("currentArgName = '" + currentArgName + "'") if currentArgName == nativeArgName: - #print("\nMatches native arg!") nativeArgs.append(arg) matchedNativeArg = True if currentArgName == distHelpArgName: @@ -1204,19 +1196,11 @@ def getCommandlineOps(): matchedNativeCmnd = False for nativeCmndName in nativeCmndNames: if arg == nativeCmndName: - #print("\nMatches native cmnd!") nativeCmnds.append(nativeCmndName) matchedNativeCmnd = True break if not (matchedNativeArg or matchedNativeCmnd): - #print("\nDoes *not* match native arg!") otherArgs.append(arg) - #print("\nnativeArgs = " + str(nativeArgs)) - #print("otherArgs = " + str(otherArgs)) - - #print("\nnativeArgs = " + str(nativeArgs)) - #print("nativeCmnds = " + str(nativeCmnds)) - #print("otherArgs = " + str(otherArgs)) if len(nativeCmnds) == 0: nativeCmnd = None @@ -1460,7 +1444,6 @@ def requoteCmndLineArgsIntoArray(inArgs): newArg = arg else: newArg = splitArg[0]+"="+'='.join(splitArg[1:]) - #print("\nnewArg =" + newArg) argsArray.append(newArg) return argsArray @@ -1472,19 +1455,12 @@ def getRepoVersionDictFromRepoVersionFileString(repoVersionFileStr): len_repoVersionFileStrList = len(repoVersionFileStrList) i = 0 while i < len_repoVersionFileStrList: - #print("i = %d" % i) repoDirLine = repoVersionFileStrList[i] - #print("repoDirLine = '" + repoDirLine + "'") if repoDirLine[0:3] == "***": repoDir = repoDirLine.split(":")[1].strip() - #print("repoDir = '" + repoDir + "'") repoVersionLine = repoVersionFileStrList[i+1] - #print("repoVersionLine = '" + repoVersionLine + "'") repoSha1 = repoVersionLine.split(" ")[0].strip() - #print("repoSha1 = '" + repoSha1 + "'") - #print("baseRepoName = '"+baseRepoName+"'") repoDirToEnter = ("." if repoDir == baseRepoName else repoDir) - #print("repoDirToEnter = '" + repoDirToEnter + "'") repoVersionDict.update({repoDirToEnter : repoSha1}) else: break @@ -1535,20 +1511,14 @@ def replaceRepoVersionInCmndLineArg(cmndLineArg, verToken, repoDirName, repoSha1 def replaceRepoVersionInCmndLineArgs(cmndLineArgsArray, repoDirName, \ repoVersionDict, repoVersionDict2 \ ): - #print("repoDirName = %s" % repoDirName) repoSha1 = assertAndGetRepoVersionFromDict(repoDirName, repoVersionDict) repoSha1_2 = assertAndGetRepoVersionFromDict(repoDirName, repoVersionDict2) - #print("repoSha1 = " + repoSha1 ) - #print("repoSha1_2 = " + repoSha1_2) cmndLineArgsArrayRepo = [] for cmndLineArg in cmndLineArgsArray: - #print("cmndLineArg = " + cmndLineArg) newCmndLineArg = replaceRepoVersionInCmndLineArg(cmndLineArg, \ "_VERSION_", repoDirName, repoSha1) - #print("newCmndLineArg = " + newCmndLineArg) newCmndLineArg = replaceRepoVersionInCmndLineArg(newCmndLineArg, \ "_VERSION2_", repoDirName, repoSha1_2) - #print("newCmndLineArg = " + newCmndLineArg) cmndLineArgsArrayRepo.append(newCmndLineArg) return cmndLineArgsArrayRepo @@ -1626,8 +1596,6 @@ def getTrackingBranch(options, getCmndOutputFunc): # Get number of commits as a str wr.t.t tracking branch def getNumCommitsWrtTrackingBranch(options, trackingBranch, getCmndOutputFunc): - #print("type(options.useGit) =", type(options.useGit)) - #print("type(trackingBranch) =", type(trackingBranch)) if trackingBranch == "": return "" (summaryLines, rtnCode) = \ @@ -1639,14 +1607,12 @@ def getNumCommitsWrtTrackingBranch(options, trackingBranch, getCmndOutputFunc): summaryLines = summaryLines.strip() if summaryLines: for summaryLine in filterWarnings(summaryLines.splitlines()): - #print("summaryLine = '" + summaryLine + "'") numAuthorCommits = int(summaryLine.strip().split()[0].strip()) - #print("numAuthorCommits = " + numAuthorCommits) numCommits += numAuthorCommits return str(numCommits) # NOTE: Above, we would like to use 'git ref-list --count' but that is not # supported in older versions of git (at least not in 1.7.0.4). Using 'git - # shortlog -s' will return just one line per author so this is not likley to + # shortlog -s' will return just one line per author so this is not likely to # return a lot of data and the cost of the python code to process this # should be insignificant compared to the process execution command. @@ -1903,7 +1869,6 @@ def getRepoName(repoDir, baseRepoName): repoVersionDict2 = getRepoVersionDictFromRepoVersionFile(options.versionFile2) # Reform the commandline arguments correctly - #print("otherArgs = ", str(otherArgs)) cmndLineArgsArray = requoteCmndLineArgsIntoArray(otherArgs) if options.debug: From b0c67e6f1e2d103cd912094ffb86f2e81c3db04e Mon Sep 17 00:00:00 2001 From: Chris Siefert Date: Mon, 15 May 2023 13:52:55 -0600 Subject: [PATCH 02/23] Tpetra: Removing test for deleted feature --- .../CrsMatrix/CrsMatrix_createDeepCopy.cpp | 759 ------------------ 1 file changed, 759 deletions(-) delete mode 100644 packages/tpetra/core/test/CrsMatrix/CrsMatrix_createDeepCopy.cpp diff --git a/packages/tpetra/core/test/CrsMatrix/CrsMatrix_createDeepCopy.cpp b/packages/tpetra/core/test/CrsMatrix/CrsMatrix_createDeepCopy.cpp deleted file mode 100644 index fc148eb079e8..000000000000 --- a/packages/tpetra/core/test/CrsMatrix/CrsMatrix_createDeepCopy.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/* -// @HEADER -// *********************************************************************** -// -// Tpetra: Templated Linear Algebra Services Package -// Copyright (2008) Sandia Corporation -// -// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Michael A. Heroux (maherou@sandia.gov) -// -// ************************************************************************ -// @HEADER -*/ - - -#include "Tpetra_TestingUtilities.hpp" -#include "Tpetra_CrsMatrix.hpp" -#include "Tpetra_Map.hpp" -#include "Tpetra_RowGraph.hpp" -#include "Tpetra_RowMatrix.hpp" -#include "Tpetra_createDeepCopy_CrsMatrix.hpp" -#include "Tpetra_Util.hpp" -#include "Teuchos_ArrayRCP.hpp" - - -namespace { // (anonymous) - -template -bool array_equal( const Array1 &a1, const Array2 &a2 ) - -{ - using Teuchos::as; - bool success = true; - const int n = a1.size(); - - // Compare sizes - if (as(a2.size()) != n) { - return false; - } - - // Compare elements - for( int i = 0; i < n; ++i ) { - const bool result = ( a1[i] == a2[i] ); // Tests C::operator[](i) const - if (!result) { - success = false; - } - } - - return success; - -} - -// Test interfaces that need a RowGraph which is not just a CrsGraph. -template -class MyRowGraph : public Tpetra::RowGraph { - using base_type = Tpetra::RowGraph; - -public: - using local_ordinal_type = typename base_type::local_ordinal_type; - using global_ordinal_type = typename base_type::global_ordinal_type; - using node_type = typename base_type::node_type; - - MyRowGraph (Teuchos::RCP G, const bool permitRowViews) : - G_ (G), - supportsRowViews_ (permitRowViews) - {} - - ~MyRowGraph () override = default; - - Teuchos::RCP > - getComm () const override { return G_->getComm (); } - - - Teuchos::RCP> - getRowMap () const override { - return G_->getRowMap (); - } - - Teuchos::RCP> - getColMap () const override { - return G_->getColMap (); - } - - Teuchos::RCP> - getDomainMap () const override { - return G_->getDomainMap (); - } - - Teuchos::RCP> - getRangeMap () const override { - return G_->getRangeMap (); - } - - Teuchos::RCP> - getImporter () const override { - return G_->getImporter (); - } - - Teuchos::RCP> - getExporter () const override { - return G_->getExporter (); - } - - Tpetra::global_size_t getGlobalNumRows () const override { - return G_->getGlobalNumRows (); - } - - Tpetra::global_size_t getGlobalNumCols () const override { - return G_->getGlobalNumCols (); - } - - size_t getLocalNumRows () const override { - return G_->getLocalNumRows (); - } - - size_t getLocalNumCols () const override { - return G_->getLocalNumCols (); - } - - GO getIndexBase () const override { - return G_->getIndexBase (); - } - - Tpetra::global_size_t getGlobalNumEntries () const override { - return G_->getGlobalNumEntries (); - } - - size_t getLocalNumEntries () const override { - return G_->getLocalNumEntries (); - } - - size_t getNumEntriesInGlobalRow (GO gblRow) const override { - return G_->getNumEntriesInGlobalRow (gblRow); - } - - size_t getNumEntriesInLocalRow (LO lclRow) const override { - return G_->getNumEntriesInLocalRow (lclRow); - } - - size_t getGlobalMaxNumRowEntries () const override { - return G_->getGlobalMaxNumRowEntries (); - } - - size_t getLocalMaxNumRowEntries () const override { - return G_->getLocalMaxNumRowEntries (); - } - - bool hasColMap () const override { - return G_->hasColMap (); - } - - bool isLocallyIndexed () const override { - return G_->isLocallyIndexed (); - } - - bool isGloballyIndexed () const override { - return G_->isGloballyIndexed (); - } - - bool isFillComplete () const override { - return G_->isFillComplete (); - } - - void - getGlobalRowCopy (GO gblRow, - typename base_type::nonconst_global_inds_host_view_type & gblColInds, - size_t& numColInds) const override - { - G_->getGlobalRowCopy (gblRow, gblColInds,numColInds); - } - - void - getLocalRowCopy (LO lclRow, - typename base_type::nonconst_local_inds_host_view_type & lclColInds, - size_t& numColInds) const override - { - G_->getLocalRowCopy (lclRow, lclColInds,numColInds); - } - - - bool supportsRowViews () const override { - return supportsRowViews_; - } - - void - getLocalRowView (const LO lclRow, - Teuchos::ArrayView & lclColInds) const override - { - G_->getLocalRowView (lclRow, lclColInds); - } - - void - getLocalRowView (const LO lclRow, - typename base_type::local_inds_host_view_type & lclColInds) const override - { - G_->getLocalRowView (lclRow, lclColInds); - } - - - void - getGlobalRowView (const GO gblRow, - Teuchos::ArrayView & gblColInds) const override - { - G_->getGlobalRowView (gblRow, gblColInds); - } - - void - getGlobalRowView (const GO gblRow, - typename base_type::global_inds_host_view_type & gblColInds) const override - { - G_->getGlobalRowView (gblRow, gblColInds); - } - - void - pack (const Teuchos::ArrayView& exportLIDs, - Teuchos::Array& exports, - const Teuchos::ArrayView& numPacketsPerLID, - size_t& constantNumPackets) const override - { - return G_->pack (exportLIDs, exports, numPacketsPerLID, - constantNumPackets); - } - -private: - Teuchos::RCP G_; - bool supportsRowViews_ = false; -}; - -// Test interfaces that need a RowMatrix which is not just a CrsMatrix. -template -class MyRowMatrix : public Tpetra::RowMatrix { - using base_type = Tpetra::RowMatrix; - -public: - using scalar_type = typename base_type::scalar_type; - using local_ordinal_type = typename base_type::local_ordinal_type; - using global_ordinal_type = typename base_type::global_ordinal_type; - using node_type = typename base_type::node_type; - using mag_type = typename base_type::mag_type; - - MyRowMatrix (Teuchos::RCP A, - const bool permitRowViews) : - A_ (A), - G_ (new MyRowGraph (A->getGraph (), permitRowViews)), - supportsRowViews_ (permitRowViews) - {} - - ~MyRowMatrix () override = default; - - Teuchos::RCP > - getComm () const override { return A_->getComm (); } - - - Teuchos::RCP> - getRowMap () const override { - return A_->getRowMap (); - } - - Teuchos::RCP> - getColMap () const override { - return A_->getColMap (); - } - - Teuchos::RCP > - getGraph () const override { - return G_; - } - - Tpetra::global_size_t getGlobalNumRows () const override { - return A_->getGlobalNumRows (); - } - - Tpetra::global_size_t getGlobalNumCols () const override { - return A_->getGlobalNumCols (); - } - - size_t getLocalNumRows () const override { - return A_->getLocalNumRows (); - } - - size_t getLocalNumCols () const override { - return A_->getLocalNumCols (); - } - - GO getIndexBase () const override { - return A_->getIndexBase (); - } - - Tpetra::global_size_t getGlobalNumEntries () const override { - return A_->getGlobalNumEntries (); - } - - size_t getLocalNumEntries () const override { - return A_->getLocalNumEntries (); - } - - size_t getNumEntriesInGlobalRow (GO gblRow) const override { - return A_->getNumEntriesInGlobalRow (gblRow); - } - - size_t getNumEntriesInLocalRow (LO lclRow) const override { - return A_->getNumEntriesInLocalRow (lclRow); - } - - size_t getGlobalMaxNumRowEntries () const override { - return A_->getGlobalMaxNumRowEntries (); - } - - size_t getLocalMaxNumRowEntries () const override { - return A_->getLocalMaxNumRowEntries (); - } - - bool hasColMap () const override { - return A_->hasColMap (); - } - - bool isLocallyIndexed () const override { - return A_->isLocallyIndexed (); - } - - bool isGloballyIndexed () const override { - return A_->isGloballyIndexed (); - } - - bool isFillComplete () const override { - return A_->isFillComplete (); - } - - - bool supportsRowViews () const override { - return supportsRowViews_; - } - - void - getGlobalRowCopy (GO gblRow, - typename base_type::nonconst_global_inds_host_view_type &gblColInds, - typename base_type::nonconst_values_host_view_type &values, - size_t& numColInds) const override - { - A_->getGlobalRowCopy (gblRow, gblColInds, values, numColInds); - } - - void - getLocalRowCopy (LO lclRow, - typename base_type::nonconst_local_inds_host_view_type &lclColInds, - typename base_type::nonconst_values_host_view_type &values, - size_t& numColInds) const override - { - A_->getLocalRowCopy (lclRow, lclColInds, values, numColInds); - } - - void - getGlobalRowView (const GO gblRow, - typename base_type::global_inds_host_view_type & gblColInds, - typename base_type::values_host_view_type & values) const override - { - A_->getGlobalRowView (gblRow, gblColInds, values); - } - - void - getLocalRowView (const LO lclRow, - typename base_type::local_inds_host_view_type & lclColInds, - typename base_type::values_host_view_type &values) const override - { - A_->getLocalRowView (lclRow, lclColInds, values); - } - - void - getLocalDiagCopy (Tpetra::Vector& diag) const override - { - A_->getLocalDiagCopy (diag); - } - - void - leftScale (const Tpetra::Vector& x) override - { - A_->leftScale (x); - } - - void - rightScale (const Tpetra::Vector& x) override - { - A_->rightScale (x); - } - - mag_type getFrobeniusNorm () const override { - return A_->getFrobeniusNorm (); - } - - Teuchos::RCP> - getDomainMap () const override { - return A_->getDomainMap (); - } - - Teuchos::RCP> - getRangeMap () const override { - return A_->getRangeMap (); - } - - // Teuchos::RCP> - // getImporter () const override { - // return A_->getImporter (); - // } - - // Teuchos::RCP> - // getExporter () const override { - // return A_->getExporter (); - // } - - void - pack (const Teuchos::ArrayView& exportLIDs, - Teuchos::Array& exports, - const Teuchos::ArrayView& numPacketsPerLID, - size_t& constantNumPackets) const override - { - return A_->pack (exportLIDs, exports, numPacketsPerLID, - constantNumPackets); - } - - void - apply (const Tpetra::MultiVector& X, - Tpetra::MultiVector& Y, - Teuchos::ETransp mode = Teuchos::NO_TRANS, - SC alpha = Teuchos::ScalarTraits::one (), - SC beta = Teuchos::ScalarTraits::zero ()) const override - { - return A_->apply (X, Y, mode, alpha, beta); - } - -private: - Teuchos::RCP A_; - Teuchos::RCP> G_; - bool supportsRowViews_ = false; -}; - - - -template -bool -crsMatrixInstancesEqual (const Tpetra::CrsMatrix& A, - const Tpetra::CrsMatrix& B) -{ - using Teuchos::outArg; - using Teuchos::REDUCE_MIN; - using Teuchos::reduceAll; - using values_view = typename Tpetra::CrsMatrix::nonconst_values_host_view_type; - using l_indices_view = typename Tpetra::CrsMatrix::nonconst_local_inds_host_view_type; - using g_indices_view = typename Tpetra::CrsMatrix::nonconst_global_inds_host_view_type; - - const Teuchos::Comm& comm = * (A.getMap ()->getComm ()); - int lclSuccess = 1; - int gblSuccess = 0; - - if (A.getRowMap ().is_null () && ! B.getRowMap ().is_null ()) { - lclSuccess = 0; - } - else if (! A.getRowMap ().is_null () && B.getRowMap ().is_null ()) { - lclSuccess = 0; - } - else if (A.getColMap ().is_null () && ! B.getColMap ().is_null ()) { - lclSuccess = 0; - } - else if (! A.getColMap ().is_null () && B.getColMap ().is_null ()) { - lclSuccess = 0; - } - else if (A.isLocallyIndexed () && ! B.isLocallyIndexed ()) { - lclSuccess = 0; - } - else if (A.isGloballyIndexed () && ! B.isGloballyIndexed ()) { - lclSuccess = 0; - } - else if (! A.isLocallyIndexed () && ! A.isGloballyIndexed () && - (B.isLocallyIndexed () || B.isGloballyIndexed ())) { - lclSuccess = 0; - } - - reduceAll (comm, REDUCE_MIN, lclSuccess, outArg (gblSuccess)); - if (gblSuccess != 1) { - return false; - } - - if (! A.getRowMap ().is_null () && - ! A.getRowMap ()->isSameAs (* (B.getRowMap ()))) { - lclSuccess = 0; - } - if (! A.getColMap ().is_null () && - ! A.getColMap ()->isSameAs (* (B.getColMap ()))) { - lclSuccess = 0; - } - if (! A.getDomainMap ().is_null () && - ! B.getDomainMap ().is_null () && - ! A.getDomainMap ()->isSameAs (* (B.getDomainMap ()))) { - lclSuccess = 0; - } - if (! A.getRangeMap ().is_null () && - ! A.getRangeMap ().is_null () && - ! A.getRangeMap ()->isSameAs (* (B.getRangeMap ()))) { - lclSuccess = 0; - } - - reduceAll (comm, REDUCE_MIN, lclSuccess, outArg (gblSuccess)); - if (gblSuccess != 1) { - return false; - } - - const auto& rowMap = * (A.getRowMap ()); - const LO lclNumRows = A.getLocalNumRows (); - - values_view A_vals; - values_view B_vals; - - if (A.isLocallyIndexed ()) { - l_indices_view A_lclColInds; - l_indices_view B_lclColInds; - - for (LO lclRow = 0; lclRow < lclNumRows; ++lclRow) { - size_t A_numEnt = 0; - size_t B_numEnt = 0; - - const size_t A_numEnt2 = A.getNumEntriesInLocalRow (lclRow); - if (A_numEnt2 > size_t (A_vals.size ())) { - Kokkos::resize(A_vals,A_numEnt2); - } - if (A_numEnt2 > size_t (A_lclColInds.size ())) { - Kokkos::resize(A_lclColInds,A_numEnt2); - } - A.getLocalRowCopy (lclRow, A_lclColInds , A_vals, A_numEnt); - - const size_t B_numEnt2 = B.getNumEntriesInLocalRow (lclRow); - if (B_numEnt2 > size_t (B_vals.size ())) { - Kokkos::resize(B_vals,B_numEnt2); - } - if (B_numEnt2 > size_t (B_lclColInds.size ())) { - Kokkos::resize(B_lclColInds,B_numEnt2); - } - B.getLocalRowCopy (lclRow, B_lclColInds, B_vals, B_numEnt); - - if (A_numEnt != B_numEnt) { - lclSuccess = 0; - break; - } - - Tpetra::sort2 (A_lclColInds, A_lclColInds.size(), A_vals); - Tpetra::sort2 (B_lclColInds, B_lclColInds.size(), B_vals); - - lclSuccess=array_equal(A_lclColInds, B_lclColInds); - if(!lclSuccess) break; - lclSuccess=array_equal(A_vals, B_vals); - if(!lclSuccess) break; - } - } - else if (A.isGloballyIndexed ()) { - g_indices_view A_gblColInds; - g_indices_view B_gblColInds; - - for (LO lclRow = 0; lclRow < lclNumRows; ++lclRow) { - const GO gblRow = rowMap.getGlobalElement (lclRow); - size_t A_numEnt = 0; - size_t B_numEnt = 0; - - const size_t A_numEnt2 = A.getNumEntriesInGlobalRow (gblRow); - if (A_numEnt2 > size_t (A_vals.size ())) { - Kokkos::resize(A_vals,A_numEnt2); - } - if (A_numEnt2 > size_t (A_gblColInds.size ())) { - Kokkos::resize(A_gblColInds,A_numEnt2); - } - A.getGlobalRowCopy (gblRow, A_gblColInds , A_vals , A_numEnt); - - const size_t B_numEnt2 = B.getNumEntriesInGlobalRow (gblRow); - if (B_numEnt2 > size_t (B_vals.size ())) { - Kokkos::resize(B_vals,B_numEnt2); - } - if (B_numEnt2 > size_t (B_gblColInds.size ())) { - Kokkos::resize(B_gblColInds,B_numEnt2); - } - B.getGlobalRowCopy (gblRow, B_gblColInds, B_vals, B_numEnt); - - - } - } - - reduceAll (comm, REDUCE_MIN, lclSuccess, outArg (gblSuccess)); - return gblSuccess == 1; -} - -// -// UNIT TESTS -// - -TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( CrsMatrix, createDeepCopy, SC, LO, GO, NT ) -{ - using Teuchos::RCP; - using std::endl; - using crs_matrix_type = Tpetra::CrsMatrix; - using map_type = Tpetra::Map; - constexpr bool testCrsNotFillComplete = true; - constexpr bool debug = true; - - RCP fancyOutPtr = debug ? - Teuchos::getFancyOStream (Teuchos::rcpFromRef (std::cerr)) : - Teuchos::rcpFromRef (out); - Teuchos::FancyOStream& myOut = *fancyOutPtr; - - myOut << "Test Tpetra::createDeepCopy(RowMatrix)->CrsMatrix" << endl; - Teuchos::OSTab tab0 (myOut); - - auto comm = Tpetra::getDefaultComm (); - const int numProcs = comm->getSize (); - const LO lclNumRows = 5; - const GO gblNumRows = GO (numProcs) * GO (lclNumRows); - const GO indexBase = 0; - RCP rowMap (new map_type (gblNumRows, lclNumRows, - indexBase, comm)); - { - myOut << "Test CrsMatrix created with row Map" << endl; - Teuchos::OSTab tab1 (myOut); - RCP A - (new crs_matrix_type (rowMap, 1)); - - for (LO lclRow = 0; lclRow < lclNumRows; ++lclRow) { - const GO gblRow = rowMap->getGlobalElement (lclRow); - const GO gblCol = (gblRow + GO (1)) % GO (gblNumRows); - const SC val = Teuchos::ScalarTraits::one (); - A->insertGlobalValues (gblRow, LO (1), &val, &gblCol); - } - - if (testCrsNotFillComplete) { - myOut << "Test createDeepCopy with CrsMatrix not yet " - "fillComplete" << endl; - Teuchos::OSTab tab2 (myOut); - crs_matrix_type A_copy = Tpetra::createDeepCopy (*A); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - for (bool hasRowViews : {false, true}) { - myOut << "Test createDeepCopy with CrsMatrix not yet " - "fillComplete, wrapped, with hasRowViews=" - << (hasRowViews ? "true" : "false") << endl; - Teuchos::OSTab tab2 (myOut); - MyRowMatrix A_my (A, hasRowViews); - crs_matrix_type A_copy = Tpetra::createDeepCopy (A_my); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - - RCP domainMap = rowMap; - RCP rangeMap = rowMap; - A->fillComplete (domainMap, rangeMap); - - { - myOut << "Test createDeepCopy with fillComplete CrsMatrix" << endl; - Teuchos::OSTab tab2 (myOut); - - crs_matrix_type A_copy = Tpetra::createDeepCopy (*A); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - for (bool hasRowViews : {false, true}) { - myOut << "Test createDeepCopy with fillComplete " - "CrsMatrix, wrapped, with hasRowViews=" - << (hasRowViews ? "true" : "false") << endl; - Teuchos::OSTab tab2 (myOut); - - MyRowMatrix A_my (A, hasRowViews); - crs_matrix_type A_copy = Tpetra::createDeepCopy (A_my); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - } - - { - myOut << "Test CrsMatrix created with row and column Map" << endl; - Teuchos::OSTab tab1 (myOut); - - RCP colMap = rowMap; - RCP A - (new crs_matrix_type (rowMap, colMap, 1)); - - for (LO lclRow = 0; lclRow < lclNumRows; ++lclRow) { - const GO gblRow = rowMap->getGlobalElement (lclRow); - const GO gblCol = gblRow; - const SC val = Teuchos::ScalarTraits::one (); - A->insertGlobalValues (gblRow, LO (1), &val, &gblCol); - } - - if (testCrsNotFillComplete) { - crs_matrix_type A_copy = Tpetra::createDeepCopy (*A); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - for (bool hasRowViews : {false, true}) { - MyRowMatrix A_my (A, hasRowViews); - crs_matrix_type A_copy = Tpetra::createDeepCopy (A_my); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - - RCP domainMap = rowMap; - RCP rangeMap = rowMap; - A->fillComplete (domainMap, rangeMap); - - { - crs_matrix_type A_copy = Tpetra::createDeepCopy (*A); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - for (bool hasRowViews : {false, true}) { - MyRowMatrix A_my (A, hasRowViews); - crs_matrix_type A_copy = Tpetra::createDeepCopy (A_my); - TEST_ASSERT( crsMatrixInstancesEqual (*A, A_copy) ); - } - } -} - -// -// INSTANTIATIONS -// - -#define UNIT_TEST_GROUP( SC, LO, GO, NT ) \ - TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT( CrsMatrix, createDeepCopy, SC, LO, GO, NT ) - - TPETRA_ETI_MANGLING_TYPEDEFS() - - TPETRA_INSTANTIATE_SLGN_NO_ORDINAL_SCALAR( UNIT_TEST_GROUP ) - -} // namespace (anonymous) - -int -main (int argc, char* argv[]) -{ - Tpetra::ScopeGuard tpetraScope (&argc, &argv); - const int errCode = - Teuchos::UnitTestRepository::runUnitTestsFromMain (argc, argv); - return errCode; -} - From dafa52bb889a06fb130dbe34213f46995ea39d23 Mon Sep 17 00:00:00 2001 From: Chris Siefert Date: Mon, 15 May 2023 14:11:34 -0600 Subject: [PATCH 03/23] Tpetra: Fixing missing HIP tesT --- .../tpetra/core/test/CrsMatrix/CMakeLists.txt | 13 ++++ .../CrsMatrix/CrsMatrix_WithGraph_HIP.cpp | 73 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 packages/tpetra/core/test/CrsMatrix/CrsMatrix_WithGraph_HIP.cpp diff --git a/packages/tpetra/core/test/CrsMatrix/CMakeLists.txt b/packages/tpetra/core/test/CrsMatrix/CMakeLists.txt index b635d5294fd3..3852898dc1a1 100644 --- a/packages/tpetra/core/test/CrsMatrix/CMakeLists.txt +++ b/packages/tpetra/core/test/CrsMatrix/CMakeLists.txt @@ -144,6 +144,19 @@ IF (Tpetra_INST_CUDA) ) ENDIF () +ASSERT_DEFINED (Tpetra_INST_HIP) +IF (Tpetra_INST_HIP) + TRIBITS_ADD_EXECUTABLE_AND_TEST( + CrsMatrix_WithGraph_HIP + SOURCES + CrsMatrix_WithGraph_HIP.cpp + ${TEUCHOS_STD_UNIT_TEST_MAIN} + ARGS ${ARGS} + COMM serial mpi + STANDARD_PASS_OUTPUT + ) +ENDIF () + ASSERT_DEFINED (Tpetra_INST_OPENMP) IF (Tpetra_INST_OPENMP) TRIBITS_ADD_EXECUTABLE_AND_TEST( diff --git a/packages/tpetra/core/test/CrsMatrix/CrsMatrix_WithGraph_HIP.cpp b/packages/tpetra/core/test/CrsMatrix/CrsMatrix_WithGraph_HIP.cpp new file mode 100644 index 000000000000..2b67fa56b48e --- /dev/null +++ b/packages/tpetra/core/test/CrsMatrix/CrsMatrix_WithGraph_HIP.cpp @@ -0,0 +1,73 @@ +/* +// @HEADER +// *********************************************************************** +// +// Tpetra: Templated Linear Algebra Services Package +// Copyright (2008) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Michael A. Heroux (maherou@sandia.gov) +// +// ************************************************************************ +// @HEADER +*/ + +// Include here just the bare minimum needed for the outer #if. +// Only include more once we know we need the test. +#include "TpetraCore_config.h" + +#if defined(HAVE_TPETRA_HIP) + +#include "Tpetra_Test_CrsMatrix_WithGraph.hpp" + +namespace Tpetra { +namespace Test { + +// +// INSTANTIATIONS +// + +TPETRA_ETI_MANGLING_TYPEDEFS() + +// Declare a colon- and comma-free typedef, to avoid macro issues. +typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode hip_node_type; + +#define UNIT_TEST_GROUP_HIP( SCALAR, LO, GO ) \ + UNIT_TEST_GROUP( SCALAR, LO, GO, hip_node_type ) + +TPETRA_INSTANTIATE_SLG_NO_ORDINAL_SCALAR( UNIT_TEST_GROUP_HIP ) + +} // namespace Test +} // namespace Tpetra + +#endif // defined(HAVE_TPETRA_HIP) + From 51a60747d1932fafe52c756a48f8670e6d2a9261 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 25 May 2023 13:02:48 -0400 Subject: [PATCH 04/23] Tpetra: Don't use std::binary_function --- packages/tpetra/core/src/Tpetra_ConfigDefs.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tpetra/core/src/Tpetra_ConfigDefs.hpp b/packages/tpetra/core/src/Tpetra_ConfigDefs.hpp index 0620ab22968d..b9efc215527f 100644 --- a/packages/tpetra/core/src/Tpetra_ConfigDefs.hpp +++ b/packages/tpetra/core/src/Tpetra_ConfigDefs.hpp @@ -150,7 +150,7 @@ namespace Tpetra { /// this and other reasons not to state using namespace /// std; in the global namespace. template - class project1st : public std::binary_function { + class project1st { public: typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; @@ -176,7 +176,7 @@ namespace Tpetra { /// this and other reasons not to state using namespace /// std; in the global namespace. template - class project2nd : public std::binary_function { + class project2nd { public: typedef Arg1 first_argument_type; typedef Arg2 second_argument_type; From 5b08e548dd8e6403737a02c935e5305cd0dd7ae5 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Wed, 17 May 2023 09:55:28 -0400 Subject: [PATCH 05/23] Expand list of kokkos options not to export with cmake --- packages/kokkos/cmake/kokkos_functions.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/kokkos/cmake/kokkos_functions.cmake b/packages/kokkos/cmake/kokkos_functions.cmake index 55b1ebbf818e..9dab1ca00ea4 100644 --- a/packages/kokkos/cmake/kokkos_functions.cmake +++ b/packages/kokkos/cmake/kokkos_functions.cmake @@ -6,7 +6,12 @@ # upper-case version for use within set(Kokkos_OPTIONS_NOT_TO_EXPORT - Kokkos_ENABLE_TESTS Kokkos_ENABLE_EXAMPLES) + Kokkos_ENABLE_BENCHMARKS + Kokkos_ENABLE_EXAMPLES + Kokkos_ENABLE_TESTS + Kokkos_ENABLE_HEADER_SELF_CONTAINMENT_TESTS + Kokkos_ENABLE_COMPILER_WARNINGS +) # # From de9b359b1c0ae30e355a1194cdcde8927629a026 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Wed, 17 May 2023 09:56:11 -0400 Subject: [PATCH 06/23] Do not append to Kokkos_OPTIONS variables those in the do not export list --- packages/kokkos/cmake/kokkos_enable_options.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kokkos/cmake/kokkos_enable_options.cmake b/packages/kokkos/cmake/kokkos_enable_options.cmake index f9f1bc5a8b51..8113e0795bb1 100644 --- a/packages/kokkos/cmake/kokkos_enable_options.cmake +++ b/packages/kokkos/cmake/kokkos_enable_options.cmake @@ -11,7 +11,7 @@ FUNCTION(KOKKOS_ENABLE_OPTION SUFFIX DEFAULT DOCSTRING) KOKKOS_OPTION(ENABLE_${SUFFIX} ${DEFAULT} BOOL ${DOCSTRING}) STRING(TOUPPER ${SUFFIX} UC_NAME) - IF (KOKKOS_ENABLE_${UC_NAME}) + IF (KOKKOS_ENABLE_${UC_NAME} AND NOT "Kokkos_ENABLE_${UC_NAME}" IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT) LIST(APPEND KOKKOS_ENABLED_OPTIONS ${UC_NAME}) #I hate that CMake makes me do this SET(KOKKOS_ENABLED_OPTIONS ${KOKKOS_ENABLED_OPTIONS} PARENT_SCOPE) From dbd9f40aedda6617646d8d8e5e134c5db4ece11f Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Wed, 17 May 2023 17:01:28 -0400 Subject: [PATCH 07/23] Export Kokkos_ENABLE_