Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .gitlab/build_dane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,37 @@

####
# PR Build jobs
dane-llvm_19_1_3-werror-debug-src:
dane-llvm_19_1_3-debug-werror-src:
Comment thread
bmhan12 marked this conversation as resolved.
variables:
COMPILER: "llvm@19.1.3"
HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake"
BUILD_TYPE: "Debug"
EXTRA_CMAKE_OPTIONS: "-DENABLE_WARNINGS_AS_ERRORS:BOOL=ON"
extends: .src_build_on_dane

dane-llvm_19_1_3-release-src:
dane-llvm_19_1_3-release-werror-src:
variables:
COMPILER: "llvm@19.1.3"
HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake"
BUILD_TYPE: "Release"
EXTRA_CMAKE_OPTIONS: "-DAXOM_QUEST_ENABLE_EXTRA_REGRESSION_TESTS:BOOL=ON"
EXTRA_CMAKE_OPTIONS: "-DAXOM_QUEST_ENABLE_EXTRA_REGRESSION_TESTS:BOOL=ON -DENABLE_WARNINGS_AS_ERRORS:BOOL=ON"
extends: .src_build_on_dane

dane-gcc_13_3_1-werror-src:
dane-gcc_13_3_1-release-werror-src:
variables:
COMPILER: "gcc@13.3.1"
HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake"
BUILD_TYPE: "Release"
EXTRA_CMAKE_OPTIONS: "-DENABLE_WARNINGS_AS_ERRORS:BOOL=ON"
extends: .src_build_on_dane

dane-sanitizers-gcc_13_3_1-src:
dane-sanitizers-gcc_13_3_1-debug-werror-src:
variables:
COMPILER: "gcc@13.3.1"
HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake"
BUILD_TYPE: "Debug"
LSAN_OPTIONS: suppressions=${CI_PROJECT_DIR}/suppressions.asan
EXTRA_CMAKE_OPTIONS: "-DAXOM_ENABLE_ASAN=ON -DAXOM_ENABLE_UBSAN=ON"
EXTRA_CMAKE_OPTIONS: "-DAXOM_ENABLE_ASAN=ON -DAXOM_ENABLE_UBSAN=ON -DENABLE_WARNINGS_AS_ERRORS:BOOL=ON"
extends: .src_build_on_dane

# TODO: turn back on
Expand Down
35 changes: 16 additions & 19 deletions src/axom/bump/tests/bump_views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,25 @@ struct test_braid2d_mat
eq_count += (end == end2) ? 1 : 0;
count++;

// Make sure the iterator order is the same as for the values we got from zoneMaterials().
// Test ArrayView version of zoneMaterials().
using IndexType = typename MatsetView::IndexType;
using FloatType = typename MatsetView::FloatType;
constexpr int ARRAY_SIZE = 10;
IndexType idStorage[ARRAY_SIZE] = {};
FloatType vfStorage[ARRAY_SIZE] = {};
axom::ArrayView<IndexType> idView(idStorage, ARRAY_SIZE);
axom::ArrayView<FloatType> vfView(vfStorage, ARRAY_SIZE);
const auto nmats = deviceViews.matsetView.zoneMaterials(index, idView, vfView);
eq_count += (nmats == ids.size()) ? 1 : 0;
count++;

// Compare against the zero-initialized ArrayView results instead of the StaticArray
// backing storage after zoneMaterials() fills the active prefix.
int i = 0;
for(auto it = deviceViews.matsetView.beginZone(index); it != end; it++, i++)
{
eq_count += (vfs[i] == it.volume_fraction() && ids[i] == it.material_id()) ? 1 : 0;
eq_count +=
(i < nmats && vfView[i] == it.volume_fraction() && idView[i] == it.material_id()) ? 1 : 0;
count++;
}

Expand All @@ -812,23 +826,6 @@ struct test_braid2d_mat
}
}

// Test ArrayView version of zoneMaterials().
using IndexType = typename MatsetView::IndexType;
using FloatType = typename MatsetView::FloatType;
constexpr int ARRAY_SIZE = 10;
IndexType idStorage[ARRAY_SIZE];
FloatType vfStorage[ARRAY_SIZE];
axom::ArrayView<IndexType> idView(idStorage, ARRAY_SIZE);
axom::ArrayView<FloatType> vfView(vfStorage, ARRAY_SIZE);
const auto nmats = deviceViews.matsetView.zoneMaterials(index, idView, vfView);
eq_count += (nmats == ids.size()) ? 1 : 0;
count++;
for(axom::IndexType j = 0; j < nmats; j++)
{
eq_count += (vfs[j] == vfView[j] && ids[j] == idView[j]) ? 1 : 0;
count++;
}

resultsView[index] = (eq_count == count) ? 1 : 0;
});

Expand Down
156 changes: 91 additions & 65 deletions src/axom/mint/execution/internal/for_all_cells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ namespace mint
{
namespace internal
{
constexpr int STRUCTURED_CELL_NODES_1D = 2;
constexpr int STRUCTURED_CELL_NODES_2D = 4;
constexpr int STRUCTURED_CELL_NODES_3D = 8;
constexpr int STRUCTURED_MAX_CELL_NODES = STRUCTURED_CELL_NODES_3D;

//------------------------------------------------------------------------------
template <typename ExecPolicy, typename KernelType>
inline void for_all_cells_impl(xargs::index, const Mesh& m, KernelType&& kernel)
Expand Down Expand Up @@ -122,16 +127,15 @@ inline void for_all_cells_impl(xargs::nodeids, const StructuredMesh& m, KernelTy
const IndexType nodeKp = m.nodeKp();
const StackArray<IndexType, 8>& offsets = m.getCellNodeOffsetsArray();

// Note: gcc@10.3.1 emits a '-Warray-bounds' warning in callers of this function
// about the sizes of nodeIds and coords not matching due to the runtime switch on dimension

if(dimension == 1)
{
for_all_cells_impl<ExecPolicy>(
xargs::index(),
m,
AXOM_LAMBDA(IndexType cellID) {
IndexType cell_connectivity[2] = {cellID, cellID + 1};
IndexType cell_connectivity[STRUCTURED_MAX_CELL_NODES] = {0};
cell_connectivity[0] = cellID;
cell_connectivity[1] = cellID + 1;
kernel(cellID, cell_connectivity, 2);
});
}
Expand All @@ -142,7 +146,7 @@ inline void for_all_cells_impl(xargs::nodeids, const StructuredMesh& m, KernelTy
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j) {
const IndexType n0 = i + j * nodeJp;
IndexType cell_connectivity[4];
IndexType cell_connectivity[STRUCTURED_MAX_CELL_NODES] = {0};

for(int ii = 0; ii < 4; ++ii)
{
Expand All @@ -161,7 +165,7 @@ inline void for_all_cells_impl(xargs::nodeids, const StructuredMesh& m, KernelTy
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j, IndexType k) {
const IndexType n0 = i + j * nodeJp + k * nodeKp;
IndexType cell_connectivity[8];
IndexType cell_connectivity[STRUCTURED_MAX_CELL_NODES] = {0};

for(int ii = 0; ii < 8; ++ii)
{
Expand Down Expand Up @@ -421,17 +425,18 @@ inline void for_all_cells_impl(xargs::coords, const UniformMesh& m, KernelType&&
const double z0 = origin[2];
const double dz = spacing[2];

// Note: gcc@10.3.1 emits a '-Warray-bounds' warning in callers of this function
// about the sizes of nodeIds and coords not matching due to the runtime switch on dimension
Comment on lines -424 to -425

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the primary issue these mint changes are resolving.


if(dimension == 1)
{
for_all_cells_impl<ExecPolicy>(
xargs::index(),
m,
AXOM_LAMBDA(IndexType cellID) {
const IndexType nodeIDs[2] = {cellID, cellID + 1};
double coords[2] = {x0 + nodeIDs[0] * dx, x0 + nodeIDs[1] * dx};
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = cellID;
nodeIDs[1] = cellID + 1;
double coords[3 * STRUCTURED_MAX_CELL_NODES] = {0.};
coords[0] = x0 + nodeIDs[0] * dx;
coords[1] = x0 + nodeIDs[1] * dx;

numerics::Matrix<double> coordsMatrix(dimension, 2, coords, NO_COPY);
kernel(cellID, coordsMatrix, nodeIDs);
Expand All @@ -444,16 +449,21 @@ inline void for_all_cells_impl(xargs::coords, const UniformMesh& m, KernelType&&
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j) {
const IndexType n0 = i + j * nodeJp;
const IndexType nodeIDs[4] = {n0, n0 + 1, n0 + 1 + nodeJp, n0 + nodeJp};

double coords[8] = {x0 + i * dx,
y0 + j * dy,
x0 + (i + 1) * dx,
y0 + j * dy,
x0 + (i + 1) * dx,
y0 + (j + 1) * dy,
x0 + i * dx,
y0 + (j + 1) * dy};
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = n0;
nodeIDs[1] = n0 + 1;
nodeIDs[2] = n0 + 1 + nodeJp;
nodeIDs[3] = n0 + nodeJp;

double coords[3 * STRUCTURED_MAX_CELL_NODES] = {0.};
coords[0] = x0 + i * dx;
coords[1] = y0 + j * dy;
coords[2] = x0 + (i + 1) * dx;
coords[3] = y0 + j * dy;
coords[4] = x0 + (i + 1) * dx;
coords[5] = y0 + (j + 1) * dy;
coords[6] = x0 + i * dx;
coords[7] = y0 + (j + 1) * dy;

numerics::Matrix<double> coordsMatrix(dimension, 4, coords, NO_COPY);
kernel(cellID, coordsMatrix, nodeIDs);
Expand All @@ -467,16 +477,17 @@ inline void for_all_cells_impl(xargs::coords, const UniformMesh& m, KernelType&&
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j, IndexType k) {
const IndexType n0 = i + j * nodeJp + k * nodeKp;
const IndexType nodeIDs[8] = {n0,
n0 + 1,
n0 + 1 + nodeJp,
n0 + nodeJp,
n0 + nodeKp,
n0 + 1 + nodeKp,
n0 + 1 + nodeJp + nodeKp,
n0 + nodeJp + nodeKp};

double coords[24] = {
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = n0;
nodeIDs[1] = n0 + 1;
nodeIDs[2] = n0 + 1 + nodeJp;
nodeIDs[3] = n0 + nodeJp;
nodeIDs[4] = n0 + nodeKp;
nodeIDs[5] = n0 + 1 + nodeKp;
nodeIDs[6] = n0 + 1 + nodeJp + nodeKp;
nodeIDs[7] = n0 + nodeJp + nodeKp;

double coords[3 * STRUCTURED_MAX_CELL_NODES] = {
x0 + i * dx, y0 + j * dy, z0 + k * dz, x0 + (i + 1) * dx,
y0 + j * dy, z0 + k * dz, x0 + (i + 1) * dx, y0 + (j + 1) * dy,
z0 + k * dz, x0 + i * dx, y0 + (j + 1) * dy, z0 + k * dz,
Expand Down Expand Up @@ -518,8 +529,12 @@ inline void for_all_cells_impl(xargs::coords, const RectilinearMesh& m, KernelTy
xargs::index(),
m,
AXOM_LAMBDA(IndexType cellID) {
const IndexType nodeIDs[2] = {cellID, cellID + 1};
double coords[2] = {x_vals_view[nodeIDs[0]], x_vals_view[nodeIDs[1]]};
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = cellID;
nodeIDs[1] = cellID + 1;
double coords[3 * STRUCTURED_MAX_CELL_NODES] = {0.};
coords[0] = x_vals_view[nodeIDs[0]];
coords[1] = x_vals_view[nodeIDs[1]];

numerics::Matrix<double> coordsMatrix(dimension, 2, coords, NO_COPY);
kernel(cellID, coordsMatrix, nodeIDs);
Expand All @@ -541,16 +556,21 @@ inline void for_all_cells_impl(xargs::coords, const RectilinearMesh& m, KernelTy
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j) {
const IndexType n0 = i + j * nodeJp;
const IndexType nodeIDs[4] = {n0, n0 + 1, n0 + 1 + nodeJp, n0 + nodeJp};

double coords[8] = {x_vals_view[i],
y_vals_view[j],
x_vals_view[i + 1],
y_vals_view[j],
x_vals_view[i + 1],
y_vals_view[j + 1],
x_vals_view[i],
y_vals_view[j + 1]};
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = n0;
nodeIDs[1] = n0 + 1;
nodeIDs[2] = n0 + 1 + nodeJp;
nodeIDs[3] = n0 + nodeJp;

double coords[3 * STRUCTURED_MAX_CELL_NODES] = {0.};
coords[0] = x_vals_view[i];
coords[1] = y_vals_view[j];
coords[2] = x_vals_view[i + 1];
coords[3] = y_vals_view[j];
coords[4] = x_vals_view[i + 1];
coords[5] = y_vals_view[j + 1];
coords[6] = x_vals_view[i];
coords[7] = y_vals_view[j + 1];

numerics::Matrix<double> coordsMatrix(dimension, 4, coords, NO_COPY);
kernel(cellID, coordsMatrix, nodeIDs);
Expand Down Expand Up @@ -580,16 +600,17 @@ inline void for_all_cells_impl(xargs::coords, const RectilinearMesh& m, KernelTy
m,
AXOM_LAMBDA(IndexType cellID, IndexType i, IndexType j, IndexType k) {
const IndexType n0 = i + j * nodeJp + k * nodeKp;
const IndexType nodeIDs[8] = {n0,
n0 + 1,
n0 + 1 + nodeJp,
n0 + nodeJp,
n0 + nodeKp,
n0 + 1 + nodeKp,
n0 + 1 + nodeJp + nodeKp,
n0 + nodeJp + nodeKp};

double coords[24] = {
IndexType nodeIDs[STRUCTURED_MAX_CELL_NODES] = {0};
nodeIDs[0] = n0;
nodeIDs[1] = n0 + 1;
nodeIDs[2] = n0 + 1 + nodeJp;
nodeIDs[3] = n0 + nodeJp;
nodeIDs[4] = n0 + nodeKp;
nodeIDs[5] = n0 + 1 + nodeKp;
nodeIDs[6] = n0 + 1 + nodeJp + nodeKp;
nodeIDs[7] = n0 + nodeJp + nodeKp;

double coords[3 * STRUCTURED_MAX_CELL_NODES] = {
x_vals_view[i], y_vals_view[j], z_vals_view[k], x_vals_view[i + 1],
y_vals_view[j], z_vals_view[k], x_vals_view[i + 1], y_vals_view[j + 1],
z_vals_view[k], x_vals_view[i], y_vals_view[j + 1], z_vals_view[k],
Expand Down Expand Up @@ -625,21 +646,24 @@ inline void for_all_cells_impl(xargs::coords, const CurvilinearMesh& m, KernelTy
const int dimension = m.getDimension();
if(dimension == 1)
{
for_all_coords<ExecPolicy, 1, 2>(for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
for_all_coords<ExecPolicy, 1, STRUCTURED_CELL_NODES_1D, STRUCTURED_MAX_CELL_NODES>(
for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
}
else if(dimension == 2)
{
for_all_coords<ExecPolicy, 2, 4>(for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
for_all_coords<ExecPolicy, 2, STRUCTURED_CELL_NODES_2D, STRUCTURED_MAX_CELL_NODES>(
for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
}
else
{
for_all_coords<ExecPolicy, 3, 8>(for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
for_all_coords<ExecPolicy, 3, STRUCTURED_CELL_NODES_3D, STRUCTURED_MAX_CELL_NODES>(
for_all_cell_nodes_functor(),
m,
std::forward<KernelType>(kernel));
}
}

Expand Down Expand Up @@ -669,7 +693,9 @@ inline void for_all_cells_impl(xargs::coords, const UnstructuredMesh<TOPO>& m, K
xargs::nodeids(),
m,
AXOM_LAMBDA(IndexType cellID, const IndexType* nodeIDs, IndexType AXOM_UNUSED_PARAM(numNodes)) {
double coords[2] = {x_vals_view[nodeIDs[0]], x_vals_view[nodeIDs[1]]};
double coords[3 * MAX_CELL_NODES] = {0.};
coords[0] = x_vals_view[nodeIDs[0]];
coords[1] = x_vals_view[nodeIDs[1]];

numerics::Matrix<double> coordsMatrix(dimension, 2, coords, NO_COPY);
kernel(cellID, coordsMatrix, nodeIDs);
Expand All @@ -690,7 +716,7 @@ inline void for_all_cells_impl(xargs::coords, const UnstructuredMesh<TOPO>& m, K
xargs::nodeids(),
m,
AXOM_LAMBDA(IndexType cellID, const IndexType* nodeIDs, IndexType numNodes) {
double coords[2 * MAX_CELL_NODES];
double coords[3 * MAX_CELL_NODES] = {0.};
for(int i = 0; i < numNodes; ++i)
{
const IndexType nodeID = nodeIDs[i];
Expand Down Expand Up @@ -725,7 +751,7 @@ inline void for_all_cells_impl(xargs::coords, const UnstructuredMesh<TOPO>& m, K
xargs::nodeids(),
m,
AXOM_LAMBDA(IndexType cellID, const IndexType* nodeIDs, IndexType numNodes) {
double coords[3 * MAX_CELL_NODES];
double coords[3 * MAX_CELL_NODES] = {0.};
for(int i = 0; i < numNodes; ++i)
{
const IndexType nodeID = nodeIDs[i];
Expand Down
Loading