Skip to content

Commit

Permalink
Merge Pull Request #12645 from trilinos/Trilinos/master_merge_2024010…
Browse files Browse the repository at this point in the history
…5_175833

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: b'Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20240105_175833 branch to master'
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester authored Jan 6, 2024
2 parents 6248500 + 471c324 commit 7b22ec3
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 71 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/muelu_clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@ jobs:
inplace: true
- run: git diff HEAD > format_patch.txt
- run: if [ "$(cat format_patch.txt)" == "" ] ; then rm format_patch.txt ; fi
- uses: actions/upload-artifact@v3

- uses: actions/upload-artifact@v4
id: upload-artf
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
name: MueLu format patch
path: format_patch.txt

- name: Artifact ID test
run: |
echo "Artifact ID is ${{ steps.upload-artf.outputs.artifact-id }}"
echo "Link: https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/artifacts/${{ steps.upload-artf.outputs.artifact-id }}"
- name: Post artifact in issue comment
uses: mshick/[email protected]
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
message: |
Your PR updated files in MueLu, but did not respect the clang formatting settings. Please apply the patch found [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload-artf.outputs.artifact-id }})
- uses: actions/github-script@v3
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
Expand Down
2 changes: 1 addition & 1 deletion cmake/tribits/core/std_tpls/FindTPLCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@
find_package(CUDAToolkit REQUIRED) # Will abort if not found!
tribits_extpkg_create_imported_all_libs_target_and_config_file( CUDA
INNER_FIND_PACKAGE_NAME CUDAToolkit
IMPORTED_TARGETS_FOR_ALL_LIBS CUDA::cufft CUDA::cublas CUDA::cudart )
IMPORTED_TARGETS_FOR_ALL_LIBS CUDA::cufft CUDA::cublas CUDA::cudart CUDA::cuda_driver )
# Above, we could add more dependencies if we need
12 changes: 8 additions & 4 deletions packages/belos/tpetra/test/BlockCG/test_resolve_cg_hb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ int run(int argc, char *argv[])

// Get the number of iterations for this solve.
int numIters = solver->getNumIters();
std::cout << "Number of iterations performed for this solve: " << numIters << std::endl;
if (proc_verbose)
std::cout << "Number of iterations performed for this solve: " << numIters << std::endl;

// Compute actual residuals.
std::vector<MT> actual_resids( numrhs );
Expand All @@ -209,7 +210,8 @@ int run(int argc, char *argv[])

// Get the number of iterations for this solve.
numIters = solver->getNumIters();
std::cout << "Number of iterations performed for this solve (manager reset): " << numIters << std::endl;
if (proc_verbose)
std::cout << "Number of iterations performed for this solve (manager reset): " << numIters << std::endl;
if (ret!=Belos::Converged) {
if (proc_verbose)
std::cout << "End Result: TEST FAILED" << std::endl;
Expand Down Expand Up @@ -250,7 +252,8 @@ int run(int argc, char *argv[])

// Get the number of iterations for this solve.
numIters = solver->getNumIters();
std::cout << "Number of iterations performed for this solve (label reset): " << numIters << std::endl;
if (proc_verbose)
std::cout << "Number of iterations performed for this solve (label reset): " << numIters << std::endl;
if (ret!=Belos::Converged) {
if (proc_verbose)
std::cout << "End Result: TEST FAILED" << std::endl;
Expand Down Expand Up @@ -317,7 +320,8 @@ int run(int argc, char *argv[])

// Get the number of iterations for this solve.
numIters = solver->getNumIters();
std::cout << "Number of iterations performed for this solve (new solver): " << numIters << std::endl;
if (proc_verbose)
std::cout << "Number of iterations performed for this solve (new solver): " << numIters << std::endl;

// Compute actual residuals.
OPT::Apply( *A, *X2, resid2 );
Expand Down
18 changes: 10 additions & 8 deletions packages/ifpack2/test/belos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,16 @@ TRIBITS_ADD_TEST(
STANDARD_PASS_OUTPUT
)

TRIBITS_ADD_TEST(
tif_belos
NAME Schwarz_RILUK_hb_belos
ARGS "--xml_file=schwarz.xml"
COMM serial mpi
NUM_MPI_PROCS 2
STANDARD_PASS_OUTPUT
)
IF(${PACKAGE_NAME}_ENABLE_Zoltan2Core AND ${PACKAGE_NAME}_ENABLE_Xpetra)
TRIBITS_ADD_TEST(
tif_belos
NAME Schwarz_RILUK_hb_belos
ARGS "--xml_file=schwarz.xml"
COMM serial mpi
NUM_MPI_PROCS 2
STANDARD_PASS_OUTPUT
)
ENDIF()



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,6 @@ void ReitzingerPFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::BuildP(Level
D0_colind.resize(current);
D0_values.resize(current);

// We're assuming that if the coarse NodeMatrix has no nodes on a rank, the coarse edge guy won't either.
// We check that here.
TEUCHOS_TEST_FOR_EXCEPTION((num_coarse_edges > 0 && CoarseNodeMatrix.is_null()) ||
(num_coarse_edges == 0 && !CoarseNodeMatrix.is_null()),
Exceptions::RuntimeError, "MueLu::ReitzingerPFactory: Mismatched num_coarse_edges and NodeMatrix repartition.");

// Count the total number of edges
// NOTE: Since we solve the ownership issue above, this should do what we want
RCP<const Map> ownedCoarseEdgeMap = Xpetra::MapFactory<LO, GO, NO>::Build(EdgeMatrix->getRowMap()->lib(), GO_INVALID, num_coarse_edges, EdgeMatrix->getRowMap()->getIndexBase(), EdgeMatrix->getRowMap()->getComm());
Expand Down
24 changes: 19 additions & 5 deletions packages/panzer/disc-fe/src/Panzer_VectorTemplateIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,16 @@ namespace panzer {
* TemplateManager.
*/
template <typename TypeSeq, typename BaseT, typename ObjectT>
class VectorTemplateIterator : public std::iterator<std::input_iterator_tag,
std::vector<Teuchos::RCP<BaseT> > > {
class VectorTemplateIterator {
public:

// Iterator requirements
using iterator_category = std::input_iterator_tag;
using value_type = std::vector<Teuchos::RCP<BaseT>>;
using differnce_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

//! Constructor
VectorTemplateIterator(panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> & m,
typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::iterator p)
Expand Down Expand Up @@ -106,10 +113,17 @@ class VectorTemplateIterator : public std::iterator<std::input_iterator_tag,
};

template <typename TypeSeq, typename BaseT, typename ObjectT>
class ConstVectorTemplateIterator : public std::iterator<std::input_iterator_tag,
const std::vector<Teuchos::RCP<BaseT> > > {
class ConstVectorTemplateIterator {
public:
//! Constructor

// Iterator requirements
using iterator_category = std::input_iterator_tag;
using value_type = const std::vector<Teuchos::RCP<BaseT>>;
using differnce_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;

//! Constructor
ConstVectorTemplateIterator(const panzer::VectorTemplateManager<TypeSeq,BaseT,ObjectT> & m,
typename std::vector<std::vector< Teuchos::RCP<BaseT> > >::const_iterator p)
: manager_(&m), object_iterator_(p) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ evaluateFields(typename TRAITS::EvalData workset)

Kokkos::MDRangePolicy<PHX::Device,Kokkos::Rank<3>> policy({0,0,0},{int(workset.num_cells),s_basis_coordinates.extent_int(1),s_basis_coordinates.extent_int(2)});
Kokkos::parallel_for("GatherBasisCoords",policy, KOKKOS_LAMBDA(const int i, const int j, const int k) {
auto d_basisCoordinates_tmp = d_basisCoordinates;
auto s_basis_coordinates_tmp = s_basis_coordinates;
if constexpr(Sacado::IsADType<typename EvalT::ScalarT>::value) {
d_basisCoordinates(i,j,k).val() = s_basis_coordinates(i,j,k);
d_basisCoordinates_tmp(i,j,k).val() = s_basis_coordinates_tmp(i,j,k);
}
else {
d_basisCoordinates(i,j,k) = s_basis_coordinates(i,j,k);
d_basisCoordinates_tmp(i,j,k) = s_basis_coordinates_tmp(i,j,k);
}
});
Kokkos::fence();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ evaluateFields(typename TRAITS::EvalData workset)
// just copy the array
Kokkos::MDRangePolicy<PHX::Device,Kokkos::Rank<3>> policy({0,0,0},{int(workset.num_cells),s_ip_coordinates.extent_int(1),s_ip_coordinates.extent_int(2)});
Kokkos::parallel_for("GatherIntegrationCoords", policy, KOKKOS_LAMBDA (const int i, const int j, const int k) {
auto s_ip_coordinates_tmp = s_ip_coordinates;
auto d_quadCoordinates_tmp = d_quadCoordinates;
if constexpr(Sacado::IsADType<typename EvalT::ScalarT>::value) {
d_quadCoordinates(i,j,k).val() = s_ip_coordinates(i,j,k);
d_quadCoordinates_tmp(i,j,k).val() = s_ip_coordinates_tmp(i,j,k);
}
else {
d_quadCoordinates(i,j,k) = s_ip_coordinates(i,j,k);
d_quadCoordinates_tmp(i,j,k) = s_ip_coordinates_tmp(i,j,k);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ namespace panzer
tmp_(cell) = 1.0;
for (int fm(0); fm < numFieldMults; ++fm)
tmp_(cell) *= kokkosFieldMults_(fm)(cell, qp);
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),KOKKOS_LAMBDA (const int& basis) {
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),[&] (const int& basis) {
field_(cell, basis) += basis_(cell, basis, qp) * multiplier_ * scalar_(cell, qp) * tmp_(cell);
});
} // end loop over the quadrature points
Expand Down Expand Up @@ -315,7 +315,7 @@ namespace panzer
}

// Initialize the evaluated field.
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),KOKKOS_LAMBDA (const int& basis) {
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),[&] (const int& basis) {
tmp_field(basis) = 0.0;
});

Expand All @@ -330,7 +330,7 @@ namespace panzer
{
team.team_barrier();
tmp(0) = multiplier_ * scalar_(cell, qp);
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),KOKKOS_LAMBDA (const int& basis) {
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),[&] (const int& basis) {
tmp_field(basis) += basis_(cell, basis, qp) * tmp(0);
});
} // end loop over the quadrature points
Expand All @@ -344,7 +344,7 @@ namespace panzer
{
team.team_barrier();
tmp(0) = multiplier_ * scalar_(cell, qp) * kokkosFieldMults_(0)(cell, qp);
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),KOKKOS_LAMBDA (const int& basis) {
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),[&] (const int& basis) {
tmp_field(basis) += basis_(cell, basis, qp) * tmp(0);
});
} // end loop over the quadrature points
Expand All @@ -363,7 +363,7 @@ namespace panzer
for (int fm(0); fm < numFieldMults; ++fm)
fieldMultsTotal *= kokkosFieldMults_(fm)(cell, qp);
tmp(0) = multiplier_ * scalar_(cell, qp) * fieldMultsTotal;
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),KOKKOS_LAMBDA (const int& basis) {
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,0,numBases),[&] (const int& basis) {
tmp_field(basis) += basis_(cell, basis, qp) * tmp(0);
});
} // end loop over the quadrature points
Expand Down
58 changes: 35 additions & 23 deletions packages/phalanx/src/Phalanx_TemplateIterator.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// $Id$
// $Source$
// $Id$
// $Source$
// @HEADER
// ************************************************************************
//
// Phalanx: A Partial Differential Equation Field Evaluation
// Phalanx: A Partial Differential Equation Field Evaluation
// Kernel for Flexible Management of Complex Dependency Chains
// Copyright 2008 Sandia Corporation
//
Expand Down Expand Up @@ -54,46 +54,52 @@

namespace PHX {

/*!
/*!
* Iterator for traversing through template instantiations stored by
* the TemplateManager class.
*/
/*!
* This class implements a standard forward iterator for the
* This class implements a standard forward iterator for the
* TemplateManager.
*/
template <typename TypeSeq, typename BaseT, typename ObjectT>
class TemplateIterator : public std::iterator<std::input_iterator_tag,
BaseT> {
class TemplateIterator {
public:

// Iterator requirements
using iterator_category = std::input_iterator_tag;
using value_type = BaseT;
using differnce_type = std::ptrdiff_t;
using pointer = BaseT*;
using reference = BaseT&;

//! Constructor
TemplateIterator(
PHX::TemplateManager<TypeSeq,BaseT,ObjectT>& m,
typename std::vector< Teuchos::RCP<BaseT> >::iterator p) :
manager(&m), object_iterator(p) {}

// No default constructor
// Use default copy constructor and copy assignment

//! Equal operator
bool operator==(const TemplateIterator& t) const {
return object_iterator == t.objectIterator;
return object_iterator == t.objectIterator;
}

//! Not equal operator
bool operator!=(const TemplateIterator& t) const {
return object_iterator != t.object_iterator;
return object_iterator != t.object_iterator;
}

//! Dereference operator
typename PHX::TemplateIterator<TypeSeq, BaseT, ObjectT>::reference
typename PHX::TemplateIterator<TypeSeq, BaseT, ObjectT>::reference
operator*() const {
return *(*object_iterator);
}

//! -> operator
typename PHX::TemplateIterator<TypeSeq, BaseT, ObjectT>::pointer
typename PHX::TemplateIterator<TypeSeq, BaseT, ObjectT>::pointer
operator->() const {
return &(*(*object_iterator));
}
Expand Down Expand Up @@ -123,49 +129,55 @@ namespace PHX {

//! Underlying object iterator
typename std::vector< Teuchos::RCP<BaseT> >::iterator object_iterator;

};

/*!
/*!
* Iterator for traversing through template instantiations stored by
* the TemplateManager class.
*/
/*!
* This class implements a standard forward iterator for the
* This class implements a standard forward iterator for the
* TemplateManager.
*/
template <typename TypeSeq, typename BaseT, typename ObjectT>
class ConstTemplateIterator : public std::iterator<std::input_iterator_tag,
BaseT> {
class ConstTemplateIterator {
public:

// Iterator requirements
using iterator_category = std::input_iterator_tag;
using value_type = BaseT;
using differnce_type = std::ptrdiff_t;
using pointer = BaseT*;
using reference = BaseT&;

//! Constructor
ConstTemplateIterator(
const PHX::TemplateManager<TypeSeq,BaseT,ObjectT>& m,
typename std::vector< Teuchos::RCP<BaseT> >::const_iterator p) :
manager(&m), object_iterator(p) {}

// No default constructor
// Use default copy constructor and copy assignment

//! Equal operator
bool operator==(const ConstTemplateIterator& t) const {
return object_iterator == t.objectIterator;
return object_iterator == t.objectIterator;
}

//! Not equal operator
bool operator!=(const ConstTemplateIterator& t) const {
return object_iterator != t.object_iterator;
return object_iterator != t.object_iterator;
}

//! Dereference operator
const typename PHX::ConstTemplateIterator<TypeSeq, BaseT, ObjectT>::reference
typename PHX::ConstTemplateIterator<TypeSeq, BaseT, ObjectT>::reference
operator*() const {
return *(*object_iterator);
}

//! -> operator
const typename PHX::ConstTemplateIterator<TypeSeq, BaseT, ObjectT>::pointer
typename PHX::ConstTemplateIterator<TypeSeq, BaseT, ObjectT>::pointer
operator->() const {
return &(*(*object_iterator));
}
Expand Down Expand Up @@ -195,7 +207,7 @@ namespace PHX {

//! Underlying object iterator
typename std::vector< Teuchos::RCP<BaseT> >::const_iterator object_iterator;

};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ template <typename VT, typename DT> int Driver<VT, DT>::analyze() {
graph_tools_type G(graph);
#if defined(TACHO_HAVE_METIS)
if (_order_connected_graph_separately) {
G.setOption(METIS_OPTION_CCORDER, 1);
idx_t one_i = 1;
G.setOption(METIS_OPTION_CCORDER, one_i);
}
#endif
G.reorder(_verbose);
Expand All @@ -216,7 +217,8 @@ template <typename VT, typename DT> int Driver<VT, DT>::analyze() {
graph_tools_type G(graph);
#if defined(TACHO_HAVE_METIS)
if (_order_connected_graph_separately) {
G.setOption(METIS_OPTION_CCORDER, 1);
idx_t one_i = 1;
G.setOption(METIS_OPTION_CCORDER, one_i);
}
#endif
G.reorder(_verbose);
Expand Down
Loading

0 comments on commit 7b22ec3

Please sign in to comment.