Skip to content

Commit

Permalink
Merge 'trilinos/Trilinos:develop' (8e95d51) into 'tcad-charon/Trilino…
Browse files Browse the repository at this point in the history
…s:develop' (0f5e2d6).

* trilinos-develop:
  TriBITS: Temp fix for configuring from reduced tarball (trilinos#11976)
  Make work with missing commonTools/build_stats (trilinos#11976)
  Add a spec for all packages + complex<float>
  Update MueLu_FactoryManager_def.hpp
  KokkosKernels: Don't list include for non-existant 'batched' build dir (trilinos#11966)
  MueLu: Enabling better dumps for Maxwell1
  MueLu RefMaxwell: Accept "aggregation: phase3 avoid singletons"
  Tpetra: Carl's fixes
  Tpetra: Improving std::move()-ability of BlockMultiVector
  Tpetra: Improving std::move()-ability of BlockMultiVector
  • Loading branch information
Charonops Jenkins Pipeline committed Jun 16, 2023
2 parents 0f5e2d6 + 8e95d51 commit b1906b2
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 23 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ SET(${PROJECT_NAME}_ENABLE_EXPORT_MAKEFILES OFF CACHE BOOL
# Do all of the processing for this Tribits project
TRIBITS_PROJECT()

INSTALL_BUILD_STATS_SCRIPTS()
if (COMMAND INSTALL_BUILD_STATS_SCRIPTS)
INSTALL_BUILD_STATS_SCRIPTS()
endif()

# Install TriBITS so that other projects can use it.
ADVANCED_SET(${PROJECT_NAME}_INSTALL_TriBITS ON CACHE BOOL
Expand Down
13 changes: 9 additions & 4 deletions cmake/CallbackSetupExtraOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ ENDMACRO()
# Set up for build stats
#

include("${Trilinos_SOURCE_DIR}/commonTools/build_stats/BuildStatsWrappers.cmake")
generate_build_stats_wrappers()
remove_build_stats_file_on_configure()
remove_build_stats_timing_files_on_fresh_configure()
set(buildStatsWrappersFile
"${Trilinos_SOURCE_DIR}/commonTools/build_stats/BuildStatsWrappers.cmake")
if (EXISTS "${buildStatsWrappersFile}")
include("${Trilinos_SOURCE_DIR}/commonTools/build_stats/BuildStatsWrappers.cmake")
generate_build_stats_wrappers()
remove_build_stats_file_on_configure()
remove_build_stats_timing_files_on_fresh_configure()
endif()

Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,18 @@ macro(tribits_read_all_package_deps_files_create_deps_graph)
set(${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES "") # Packages and subpackages

foreach(TRIBITS_PACKAGE IN LISTS ${PROJECT_NAME}_DEFINED_INTERNAL_TOPLEVEL_PACKAGES)
tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE}
${${TRIBITS_PACKAGE}_REL_SOURCE_DIR})
set(absPackageSrcDir "${PROJECT_SOURCE_DIR}/${${TRIBITS_PACKAGE}_REL_SOURCE_DIR}")
set(packageDependenciesFile "${absPackageSrcDir}/cmake/Dependencies.cmake")
if ( (NOT EXISTS "${packageDependenciesFile}")
AND (NOT ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES IN_LIST
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_ERROR_VALUES_LIST)
)
# ToDo: Print message about the package being missing depending on the
# value of ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES!
else()
message("${TRIBITS_PACKAGE} package dependency file: '${packageDependenciesFile}' exists!")
tribits_read_toplevel_package_deps_files_add_to_graph(${TRIBITS_PACKAGE})
endif()
endforeach()

list(LENGTH ${PROJECT_NAME}_DEFINED_INTERNAL_PACKAGES
Expand Down
5 changes: 5 additions & 0 deletions packages/framework/ini-files/config-specs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,11 @@ opt-set-cmake-var Trilinos_ENABLE_COMPLEX_DOUBLE BOOL FO
opt-set-cmake-var Trilinos_ENABLE_FLOAT BOOL FORCE : ON
opt-set-cmake-var Trilinos_ENABLE_COMPLEX_FLOAT BOOL FORCE : ON

[rhel7_sems-gnu-8.3.0-openmpi-1.10.1-serial_debug_shared_no-kokkos-arch_no-asan_complex-float_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_all]
#uses sems-archive modules
use rhel7_sems-gnu-8.3.0-openmpi-1.10.1-serial_debug_shared_no-kokkos-arch_no-asan_complex-float_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables
use PACKAGE-ENABLES|ALL

[rhel7_sems-gnu-8.3.0-serial_release-debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_no-mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables]
#uses sems-archive modules
use RHEL7_SEMS_COMPILER|GNU
Expand Down
15 changes: 12 additions & 3 deletions packages/kokkos-kernels/batched/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ IF (NOT KokkosKernels_ENABLE_COMPONENT_BLAS)
LIST(APPEND SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/batched/KokkosBatched_Util.cpp)
ENDIF()

# Adding unit-tests
KOKKOSKERNELS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/batched)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}/batched)
IF(KokkosKernels_ENABLE_TESTS OR KokkosKernels_ENABLE_TESTS_AND_PERFSUITE)
# Adding unit-tests
KOKKOSKERNELS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/batched)
KOKKOSKERNELS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING
${CMAKE_CURRENT_SOURCE_DIR}/batched)
ENDIF()
# NOTE: Above, the build directory 'batched' is not created unless unit tests
# are actually enabled (which are actually included from the base-level
# CMakeLists.txt file). And the KokkosKernelsTargets.cmake file that gets
# generated from this CMake package in the build dir will be broken if these
# are listed in the `INTERFACE_INCLUDE_DIRECTORIES` property when the build
# `batched` is not created (see Trilinos PR #11966).
5 changes: 5 additions & 0 deletions packages/muelu/src/MueCentral/MueLu_FactoryManager_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ namespace MueLu {
if (varName == "pcoarsen: element to node map") return GetFactory("P");
#endif

// NOTE: These are user data, but we might want to print them, so they need a default factory
if (varName == "NodeMatrix") return NoFactory::getRCP();
if (varName == "NodeAggMatrix") return NoFactory::getRCP();


TEUCHOS_TEST_FOR_EXCEPTION(true, MueLu::Exceptions::RuntimeError, "MueLu::FactoryManager::GetDefaultFactory(): No default factory available for building '" + varName + "'.");
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/muelu/src/Operators/MueLu_RefMaxwell_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,8 @@ namespace MueLu {
UncoupledAggFact->SetParameter("aggregation: max agg size",Teuchos::ParameterEntry(maxAggSize));
bool matchMLbehavior = parameterList_.get("aggregation: match ML phase2a",MasterList::getDefault<bool>("aggregation: match ML phase2a"));
UncoupledAggFact->SetParameter("aggregation: match ML phase2a",Teuchos::ParameterEntry(matchMLbehavior));
bool avoidSingletons = parameterList_.get("aggregation: phase3 avoid singletons",MasterList::getDefault<bool>("aggregation: phase3 avoid singletons"));
UncoupledAggFact->SetParameter("aggregation: phase3 avoid singletons",Teuchos::ParameterEntry(avoidSingletons));

coarseMapFact->SetFactory("Aggregates", UncoupledAggFact);

Expand Down
16 changes: 13 additions & 3 deletions packages/tpetra/core/src/Tpetra_BlockMultiVector_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,25 @@ class BlockMultiVector :
/// This is a class ("static") method so that you can make and reuse
/// a point Map for creating different BlockMultiVector instances,
/// using the more efficient four-argument constructor.
///
static map_type
makePointMap (const map_type& meshMap, const LO blockSize);

/// \brief Create and return an owning RCP to the point Map corresponding to the
/// given mesh Map and block size.
///
/// This is a class ("static") method so that you can make and reuse
/// a point Map for creating different BlockMultiVector instances,
/// using the more efficient four-argument constructor.
static Teuchos::RCP<const map_type>
makePointMapRCP (const map_type& meshMap, const LO blockSize);

/// \brief Get this BlockMultiVector's (previously computed) point Map.
///
/// It is always valid to call this method. A BlockMultiVector
/// always has a point Map. We do not compute the point Map lazily.
map_type getPointMap () const {
return pointMap_;
const map_type getPointMap () const {
return *pointMap_;
}

//! Get the number of degrees of freedom per mesh point.
Expand Down Expand Up @@ -619,7 +629,7 @@ class BlockMultiVector :

private:
//! The point Map (describing the distribution of degrees of freedom).
map_type pointMap_;
Teuchos::RCP<const map_type> pointMap_;

protected:
//! The Tpetra::MultiVector used to represent the data.
Expand Down
65 changes: 55 additions & 10 deletions packages/tpetra/core/src/Tpetra_BlockMultiVector_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ BlockMultiVector (const map_type& meshMap,
const LO numVecs) :
dist_object_type (Teuchos::rcp (new map_type (meshMap))), // shallow copy
meshMap_ (meshMap),
pointMap_ (makePointMap (meshMap, blockSize)),
mv_ (Teuchos::rcpFromRef (pointMap_), numVecs), // nonowning RCP is OK, since pointMap_ won't go away
pointMap_ (makePointMapRCP (meshMap, blockSize)),
mv_ (pointMap_, numVecs), // nonowning RCP is OK, since pointMap_ won't go away
blockSize_ (blockSize)
{}

Expand All @@ -100,8 +100,8 @@ BlockMultiVector (const map_type& meshMap,
const LO numVecs) :
dist_object_type (Teuchos::rcp (new map_type (meshMap))), // shallow copy
meshMap_ (meshMap),
pointMap_ (pointMap),
mv_ (Teuchos::rcpFromRef (pointMap_), numVecs),
pointMap_ (new map_type(pointMap)),
mv_ (pointMap_, numVecs),
blockSize_ (blockSize)
{}

Expand Down Expand Up @@ -156,9 +156,8 @@ BlockMultiVector (const mv_type& X_mv,

// At this point, mv_ has been assigned, so we can ignore X_mv.
Teuchos::RCP<const map_type> pointMap = mv_.getMap ();
if (! pointMap.is_null ()) {
pointMap_ = *pointMap; // Map::operator= also does a shallow copy
}
pointMap_ = pointMap;

}

template<class Scalar, class LO, class GO, class Node>
Expand All @@ -169,7 +168,7 @@ BlockMultiVector (const BlockMultiVector<Scalar, LO, GO, Node>& X,
const size_t offset) :
dist_object_type (Teuchos::rcp (new map_type (newMeshMap))), // shallow copy
meshMap_ (newMeshMap),
pointMap_ (newPointMap),
pointMap_ (new map_type(newPointMap)),
mv_ (X.mv_, newPointMap, offset * X.getBlockSize ()), // MV "offset view" constructor
blockSize_ (X.getBlockSize ())
{}
Expand All @@ -181,7 +180,7 @@ BlockMultiVector (const BlockMultiVector<Scalar, LO, GO, Node>& X,
const size_t offset) :
dist_object_type (Teuchos::rcp (new map_type (newMeshMap))), // shallow copy
meshMap_ (newMeshMap),
pointMap_ (makePointMap (newMeshMap, X.getBlockSize ())),
pointMap_ (makePointMapRCP (newMeshMap, X.getBlockSize ())),
mv_ (X.mv_, pointMap_, offset * X.getBlockSize ()), // MV "offset view" constructor
blockSize_ (X.getBlockSize ())
{}
Expand All @@ -198,7 +197,7 @@ typename BlockMultiVector<Scalar, LO, GO, Node>::map_type
BlockMultiVector<Scalar, LO, GO, Node>::
makePointMap (const map_type& meshMap, const LO blockSize)
{
typedef Tpetra::global_size_t GST;
typedef Tpetra::global_size_t GST;
typedef typename Teuchos::ArrayView<const GO>::size_type size_type;

const GST gblNumMeshMapInds =
Expand Down Expand Up @@ -234,10 +233,56 @@ makePointMap (const map_type& meshMap, const LO blockSize)
}
return map_type (gblNumPointMapInds, lclPointGblInds (), indexBase,
meshMap.getComm ());

}
}


template<class Scalar, class LO, class GO, class Node>
Teuchos::RCP<const typename BlockMultiVector<Scalar, LO, GO, Node>::map_type>
BlockMultiVector<Scalar, LO, GO, Node>::
makePointMapRCP (const map_type& meshMap, const LO blockSize)
{
typedef Tpetra::global_size_t GST;
typedef typename Teuchos::ArrayView<const GO>::size_type size_type;

const GST gblNumMeshMapInds =
static_cast<GST> (meshMap.getGlobalNumElements ());
const size_t lclNumMeshMapIndices =
static_cast<size_t> (meshMap.getLocalNumElements ());
const GST gblNumPointMapInds =
gblNumMeshMapInds * static_cast<GST> (blockSize);
const size_t lclNumPointMapInds =
lclNumMeshMapIndices * static_cast<size_t> (blockSize);
const GO indexBase = meshMap.getIndexBase ();

if (meshMap.isContiguous ()) {
return Teuchos::rcp(new map_type (gblNumPointMapInds, lclNumPointMapInds, indexBase,
meshMap.getComm ()));
}
else {
// "Hilbert's Hotel" trick: multiply each process' GIDs by
// blockSize, and fill in. That ensures correctness even if the
// mesh Map is overlapping.
Teuchos::ArrayView<const GO> lclMeshGblInds = meshMap.getLocalElementList ();
const size_type lclNumMeshGblInds = lclMeshGblInds.size ();
Teuchos::Array<GO> lclPointGblInds (lclNumPointMapInds);
for (size_type g = 0; g < lclNumMeshGblInds; ++g) {
const GO meshGid = lclMeshGblInds[g];
const GO pointGidStart = indexBase +
(meshGid - indexBase) * static_cast<GO> (blockSize);
const size_type offset = g * static_cast<size_type> (blockSize);
for (LO k = 0; k < blockSize; ++k) {
const GO pointGid = pointGidStart + static_cast<GO> (k);
lclPointGblInds[offset + static_cast<size_type> (k)] = pointGid;
}
}
return Teuchos::rcp(new map_type (gblNumPointMapInds, lclPointGblInds (), indexBase,
meshMap.getComm ()));

}
}

template<class Scalar, class LO, class GO, class Node>
void
BlockMultiVector<Scalar, LO, GO, Node>::
Expand Down
11 changes: 11 additions & 0 deletions packages/tpetra/core/test/Block/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST(
STANDARD_PASS_OUTPUT
)

TRIBITS_ADD_EXECUTABLE_AND_TEST(
Issue11931
SOURCES
Issue11931.cpp
${TEUCHOS_STD_UNIT_TEST_MAIN}
COMM serial mpi
STANDARD_PASS_OUTPUT
)



TRIBITS_COPY_FILES_TO_BINARY_DIR(TpetraCore_BlockCrsMatrix_cp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
SOURCE_FILES blockA.mm blockA-complex.mm
Expand Down
112 changes: 112 additions & 0 deletions packages/tpetra/core/test/Block/Issue11931.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
// @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 ([email protected])
//
// ************************************************************************
// @HEADER
*/

#include "Tpetra_TestingUtilities.hpp"
#include "Tpetra_BlockVector.hpp"
#include "Tpetra_BlockView.hpp"
#include "Teuchos_SerialDenseMatrix.hpp"
#include "Teuchos_LAPACK.hpp"
#include "Teuchos_TypeNameTraits.hpp"


namespace { // anonymous

using Kokkos::ALL;
using Kokkos::subview;
using Tpetra::TestingUtilities::getDefaultComm;
using Teuchos::Comm;
using Teuchos::outArg;
using Teuchos::RCP;
using Teuchos::REDUCE_MIN;
using Teuchos::reduceAll;
using Teuchos::TypeNameTraits;
using std::endl;


TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL( BlockVector, Issue11931, Scalar, LO, GO, Node ) {
// This particular issued exposed the fact that BlockVector did not std::move
// correctly, due to an issue with the internal pointMap

RCP<const Comm<int> > comm = Tpetra::getDefaultComm ();
using BV = Tpetra::BlockVector<Scalar,LO,GO,Node>;
using map_t = Tpetra::Map<LO,GO,Node>;

const int numGlobalEntries = 15*comm->getSize();
RCP<const map_t> Map = Teuchos::rcp(new map_t(numGlobalEntries, 0, comm));


int block_size = 5;

// To test this, we make a BlockVector, std::move it to a second one
// and then have the first guy go out of scope.
RCP<BV> Vec2;
{
BV Vec1 (*Map,block_size);
Vec2 = Teuchos::rcp(new BV(std::move(Vec1)));
}

Tpetra::global_size_t block_map_size = Vec2->getMap()->getGlobalNumElements();
Tpetra::global_size_t point_map_size = Vec2->getVectorView().getMap()->getGlobalNumElements();
TEST_EQUALITY_CONST( block_map_size * block_size, point_map_size );

}





//
// INSTANTIATIONS
//

#define UNIT_TEST_GROUP( SCALAR, LO, GO, NODE ) \
TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT( BlockVector, Issue11931, SCALAR, LO, GO, NODE )


TPETRA_ETI_MANGLING_TYPEDEFS()

TPETRA_INSTANTIATE_SLGN_NO_ORDINAL_SCALAR( UNIT_TEST_GROUP )

} // namespace (anonymous)


0 comments on commit b1906b2

Please sign in to comment.