Skip to content

Commit

Permalink
Merge remote-tracking branch 'Trilinos/trilinos:develop' into trilino…
Browse files Browse the repository at this point in the history
…s-sync
  • Loading branch information
dc-snl committed May 17, 2022
2 parents 9814fc6 + 020bc72 commit cd0d04b
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 43 deletions.
6 changes: 3 additions & 3 deletions Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
# for release mode and set the version.
#

SET(Trilinos_VERSION 13.1)
SET(Trilinos_VERSION 13.5)
SET(Trilinos_MAJOR_VERSION 13)
SET(Trilinos_MAJOR_MINOR_VERSION 130100)
SET(Trilinos_VERSION_STRING "13.1 (Dev)")
SET(Trilinos_MAJOR_MINOR_VERSION 130500)
SET(Trilinos_VERSION_STRING "13.5 (Dev)")
SET(Trilinos_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) # Change to 'OFF' for a release

# Used by testing scripts and should not be used elsewhere
Expand Down
12 changes: 0 additions & 12 deletions cmake/std/PullRequestLinuxIntel19.0.5TestingSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@ set (ROL_test_step_TrustRegion_MPI_1_DISABLE ON CACHE BOOL "Temporarily disabled
set (ROL_tutorial_BoundAndInequality_MPI_1_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")


# Tests turned off until an issue with Scotch can be resolved
set (Zoltan2_scotch_example_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_VWeights_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_OneProc_VWeights_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_OneProc_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_OneProc_EWeights_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_Partitioning1_EWeights_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan2_pamgenMeshAdapterTest_scotch_MPI_4_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Phalanx_dynamic_data_layout_MPI_1_DISABLE ON CACHE BOOL "Temporarily disabled in PR testing")
set (Zoltan_ENABLE_Scotch OFF CACHE BOOL "Temporarily disabled in PR testing")

# Misc options typically added by CI testing mode in TriBITS

# Use the below option only when submitting to the dashboard
Expand Down
12 changes: 4 additions & 8 deletions cmake/std/pr_config/pullrequest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,10 @@ setenv LDFLAGS: -lifcore


[Trilinos_pullrequest_intel_19.0.5]
use SEMS-ARCHIVE-ENV:
use ATDM-ENV:
module-load sems-archive-gcc: 6.1.0
module-load sems-archive-intel: 19.0.5
module-load sems-archive-mpich: 3.2
use SEMS-ARCHIVE-DEFAULT:
module-remove sems-archive-openmpi:
use ATDM-DEFAULT:
module-purge:
module-load sems-intel: 19.0.5
module-load sems-mpich: 3.2.1
use SEMS-DEFAULT:
setenv LDFLAGS: -lifcore


Expand Down
12 changes: 5 additions & 7 deletions cmake/std/trilinosprhelpers/unittests/trilinos_pr_test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,11 @@ use ATDM-DEFAULT:


[Trilinos_pullrequest_intel_19.0.5]
use SEMS-ARCHIVE-ENV:
use ATDM-ENV:
module-load sems-archive-gcc: 6.1.0
module-load sems-archive-intel: _19.0.5
module-load sems-archive-mpich: 3.2
use SEMS-ARCHIVE-DEFAULT:
use ATDM-DEFAULT:
module-purge:
module-load sems-intel: 19.0.5
module-load sems-mpich: 3.2.1
use SEMS-DEFAULT:
setenv LDFLAGS: -lifcore



Expand Down
4 changes: 2 additions & 2 deletions packages/intrepid2/src/Cell/Intrepid2_CellGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ namespace Intrepid2
SubdivisionStrategy subdivisionStrategy = NO_SUBDIVISION,
HypercubeNodeOrdering nodeOrdering = HYPERCUBE_NODE_ORDER_TENSOR);

/** \brief Node-based constructor for straight-edged geometry.
/** \brief Node-based constructor for straight-edged geometry.
\param [in] cellTopo - the cell topology for all cells.
\param [in] cellToNodes - (C,LN) container specifying the global index of the local node.
\param [in] nodes - (GN,D) container specifying the coordinate weight for the global node in the specified dimension.
\param [in] nodes - (GN,D) container specifying the coordinate weight for the global node in the specified dimension; if cellToNodes is not allocated, this must be a (C,N,D) container
\param [in] claimAffine - whether to assume (without checking) that the mapping from reference space is affine. (If claimAffine is false, we check whether the cell topology is simplicial, and if so, set the affine_ member variable to true.)
\param [in] nodeOrdering - applicable for hypercube cell topologies; specifies whether to use the order used by Shards (and lowest-order Intrepid2 bases), or the one used by higher-order Intrepid2 bases.
*/
Expand Down
16 changes: 13 additions & 3 deletions packages/intrepid2/src/Cell/Intrepid2_CellGeometryDef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,19 @@ namespace Intrepid2
cellToNodes_(cellToNodes),
nodes_(nodes)
{
numCells_ = cellToNodes.extent_int(0);
numNodesPerCell_ = cellToNodes.extent_int(1);
INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE(numNodesPerCell_ != cellTopo.getNodeCount(), std::invalid_argument, "cellToNodes.extent(1) does not match the cell topology node count");
if(cellToNodes.is_allocated())
{
numCells_ = cellToNodes.extent_int(0);
numNodesPerCell_ = cellToNodes.extent_int(1);
INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE(numNodesPerCell_ != cellTopo.getNodeCount(), std::invalid_argument, "cellToNodes.extent(1) does not match the cell topology node count");
}
else
{
numCells_ = nodes.extent_int(0);
numNodesPerCell_ = nodes.extent_int(1);
INTREPID2_TEST_FOR_EXCEPTION_DEVICE_SAFE(numNodesPerCell_ != cellTopo.getNodeCount(), std::invalid_argument, "nodes.extent(1) does not match the cell topology node count");
}


if (!claimAffine)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,35 @@ namespace
}
}

TEUCHOS_UNIT_TEST( CellGeometry, NodeBased_Constructor )
{
const int spaceDim = 3;

using PointScalar = double;
using DeviceType = DefaultTestDeviceType;
using ExecutionSpace = DeviceType::execution_space;

const auto cellTopo = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >());

using Geometry = CellGeometry<PointScalar, spaceDim, DeviceType>;
Geometry::HypercubeNodeOrdering nodeOrdering = Geometry::HYPERCUBE_NODE_ORDER_TENSOR;

ScalarView<int,DeviceType> cellToNodes;
ScalarView<PointScalar,DeviceType> nodes("nodes", 1, 8, spaceDim);
Kokkos::parallel_for("fill nodes for CellGeometry", Kokkos::RangePolicy<ExecutionSpace>(0,nodes.extent(1)),
KOKKOS_LAMBDA (const int i) {
nodes(0,i,0) = (i%2 == 1) ? 1. : 0.;
nodes(0,i,1) = ((i/2)%2 == 1) ? 1. : 0.;
nodes(0,i,2) = (i/4 == 1) ? 1. : 0.;
});

const bool claimAffine = false;
CellGeometry<PointScalar, spaceDim, DeviceType> cellGeometry(cellTopo, cellToNodes, nodes, claimAffine, nodeOrdering);

TEST_EQUALITY(1, cellGeometry.numCells());
TEST_EQUALITY(8, cellGeometry.numNodesPerCell());
}

TEUCHOS_UNIT_TEST( CellGeometry, Jacobian_Uniform_Quads )
{
const int spaceDim = 2;
Expand Down
113 changes: 113 additions & 0 deletions packages/phalanx/test/ViewOfViews/tPhalanxViewOfViews.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#include "Kokkos_Core.hpp"
#include "Teuchos_UnitTestHarness.hpp"
#include "Phalanx_KokkosViewOfViews.hpp"
#include <vector>

// ********************************
// This test demonstrates how to create a view of views for double and FAD types.
// Original implementation
// ********************************
using exec_t = Kokkos::DefaultExecutionSpace;
using mem_t = Kokkos::DefaultExecutionSpace::memory_space;

Expand Down Expand Up @@ -58,6 +62,9 @@ TEUCHOS_UNIT_TEST(PhalanxViewOfViews,OldImpl) {
}
}

// ********************************
// New implementation (automatically adds the unmanaged memory trait to inner view)
// ********************************
TEUCHOS_UNIT_TEST(PhalanxViewOfViews,NewImpl) {

const int num_cells = 10;
Expand Down Expand Up @@ -115,3 +122,109 @@ TEUCHOS_UNIT_TEST(PhalanxViewOfViews,NewImpl) {
}

}

// ********************************
// Demonstrates an alternative path for ViewOfViews that uses a user
// defined wrapper and the assignment operator on device to disable
// the reference tracking.
// ********************************

// Force this test to always run without UVM.
// For Cuda builds, ignore the default memory space in the Cuda
// execution space since it can be set to UVM in Trilinos
// configure. For non-Cuda builds, just use the default memory space
// in the execution space.
namespace Kokkos {
class Cuda;
class CudaSpace;
}
using DeviceExecutionSpace = Kokkos::DefaultExecutionSpace;
using DeviceMemorySpace = std::conditional<std::is_same<DeviceExecutionSpace,Kokkos::Cuda>::value,
Kokkos::CudaSpace,
Kokkos::DefaultExecutionSpace::memory_space>::type;
using view = Kokkos::View<double*,DeviceMemorySpace>;
using view_host = view::HostMirror;

class Wrapper {
public:
view a_;
view b_;
KOKKOS_INLINE_FUNCTION
Wrapper() : a_(nullptr,0),b_(nullptr,0) {}

Wrapper(const view_host& a, const view_host& b)
: a_(a.label(),a.layout()),b_(b.label(),b.layout())
{
Kokkos::deep_copy(a_,a);
Kokkos::deep_copy(b_,b);
}

KOKKOS_DEFAULTED_FUNCTION
Wrapper& operator=(const Wrapper& src) = default;

KOKKOS_INLINE_FUNCTION
double multiply(int i) const {return a_(i) * b_(i);}
};

TEUCHOS_UNIT_TEST(PhalanxViewOfViews,WrapperExample) {

constexpr int num_objects = 3;
constexpr int view_size = 20;

// This object must exist for lifetime if v_of_uo to keep inner
// views in scope.
std::vector<Wrapper> uo(num_objects);
{
view_host a("a",view_size);
view_host b("b",view_size);
view_host c("c",view_size);
view_host d("d",view_size);
view_host e("e",view_size);
view_host f("f",view_size);

Kokkos::deep_copy(a,0.0);
Kokkos::deep_copy(b,1.0);
Kokkos::deep_copy(c,2.0);
Kokkos::deep_copy(d,3.0);
Kokkos::deep_copy(e,4.0);
Kokkos::deep_copy(f,5.0);

uo[0] = Wrapper(a,b);
uo[1] = Wrapper(c,d);
uo[2] = Wrapper(e,f);
}

Kokkos::View<Wrapper*,DeviceMemorySpace> v_of_uo("v_of_uo",num_objects);

for (int i=0; i < 3; ++i) {
Wrapper tmp = uo[i];
Kokkos::parallel_for("initialize view_of_uo",1,KOKKOS_LAMBDA(const int ) {
// reference counting is disabled on device
v_of_uo(i) = tmp;
});
Kokkos::fence();
}

Kokkos::View<double**,DeviceMemorySpace> results("results",num_objects,view_size);
Kokkos::MDRangePolicy<exec_t,Kokkos::Rank<2>> policy({0,0},{num_objects,view_size});
Kokkos::parallel_for("v_of_uo",policy,KOKKOS_LAMBDA(const int i,const int j) {
results(i,j) = v_of_uo(i).multiply(j) + static_cast<double>(j);
});
Kokkos::fence();

auto results_host = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(),results);

constexpr auto tol = std::numeric_limits<double>::epsilon() * 100.0;
for (int i=0; i < num_objects; ++i) {
for (int j=0; j < view_size; ++j) {

double gold_value = static_cast<double>(j);
if (i == 1)
gold_value += 6.0;
else if (i == 2)
gold_value += 20.0;

TEST_FLOATING_EQUALITY(results_host(i,j),gold_value,tol);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ Use `Pair` when comparing maps or other associative containers.
using testing::ElementsAre;
using testing::Pair;
...
std::map<string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}};
std::map<string, int> m = { {"a", 1}, {"b", 2}, {"c", 3}};
EXPECT_THAT(m, ElementsAre(Pair("a", 1), Pair("b", 2), Pair("c", 3)));
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class MachineLearningStatistics_Hex3D {
int node3 = edgeToNode(edge, 0);
int node4 = edgeToNode(edge, 1);

int numElems = elemToEdge.dimension(0);
int numElems = elemToNode.dimension(0);
for(int i=0; i<numElems; i++) {
// Set up hex nodes
int hexnode0 = elemToNode(i, 0);
Expand Down
Loading

0 comments on commit cd0d04b

Please sign in to comment.