Skip to content

Commit

Permalink
Merge branch 'master' into f/fm-kernel-ex
Browse files Browse the repository at this point in the history
  • Loading branch information
psakievich committed Apr 18, 2024
2 parents 0d0eceb + dc893fa commit e36d154
Show file tree
Hide file tree
Showing 153 changed files with 704 additions and 683 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check formatting
uses: DoozyX/clang-format-lint-action@v0.13
uses: DoozyX/clang-format-lint-action@v0.17
with:
source: 'nalu.C unit_tests.C ./include ./src ./unit_tests'
extensions: 'H,h,cpp,C'
clangFormatVersion: 13
clangFormatVersion: 17
CPU-Trilinos:
needs: Formatting
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions include/Algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Realm;
class MasterElement;
class SupplementalAlgorithm;
class Kernel;
class FieldManager;

class Algorithm
{
Expand All @@ -43,6 +44,7 @@ class Algorithm

Realm& realm_;
stk::mesh::PartVector partVec_;
const FieldManager& fieldManager_;
std::vector<SupplementalAlgorithm*> supplementalAlg_;

std::vector<Kernel*> activeKernels_;
Expand Down
2 changes: 1 addition & 1 deletion include/AssembleElemSolverAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AssembleElemSolverAlgorithm : public SolverAlgorithm
auto& b = ngpMesh.get_bucket(entityRank, bktId);

#if !defined(KOKKOS_ENABLE_GPU)
ThrowAssertMsg(
STK_ThrowAssertMsg(
b.topology().num_nodes() == (unsigned)nodesPerEntity_,
"AssembleElemSolverAlgorithm expected nodesPerEntity_ = "
<< nodesPerEntity_
Expand Down
4 changes: 2 additions & 2 deletions include/AssembleFaceElemSolverAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AssembleFaceElemSolverAlgorithm : public SolverAlgorithm
auto& b = ngpMesh.get_bucket(sideRank, bktId);

#if !defined(KOKKOS_ENABLE_GPU)
ThrowAssertMsg(
STK_ThrowAssertMsg(
b.topology().num_nodes() == (unsigned)nodesPerFace_,
"AssembleFaceElemSolverAlgorithm expected nodesPerEntity_ = "
<< nodesPerFace_
Expand Down Expand Up @@ -111,7 +111,7 @@ class AssembleFaceElemSolverAlgorithm : public SolverAlgorithm
stk::mesh::Entity face =
b[bktIndex * simdLen + numFacesProcessed + simdFaceIndex];
const auto ngpFaceIndex = ngpMesh.fast_mesh_index(face);
// ThrowAssertMsg(
// STK_ThrowAssertMsg(
// bulk.num_elements(face) == 1,
// "Expecting just 1 element attached to face!");
int thisElemFaceOrdinal =
Expand Down
18 changes: 9 additions & 9 deletions include/CopyAndInterleave.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ copy_and_interleave(
for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) {
for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) {
src[simdIndex] = data[simdIndex]->get_1D_view_by_index(viewIndex).data();
NGP_ThrowAssert(
STK_NGP_ThrowAssert(
data[simdIndex]->get_1D_view_by_index(viewIndex).size() ==
simdData.get_1D_view_by_index(viewIndex).size());
NGP_ThrowAssert(src[simdIndex] != nullptr);
NGP_ThrowAssert(
STK_NGP_ThrowAssert(src[simdIndex] != nullptr);
STK_NGP_ThrowAssert(
src[simdIndex][0] ==
data[simdIndex]->get_1D_view_by_index(viewIndex).data()[0]);
}
Expand All @@ -74,11 +74,11 @@ copy_and_interleave(
for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) {
for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) {
src[simdIndex] = data[simdIndex]->get_2D_view_by_index(viewIndex).data();
NGP_ThrowAssert(
STK_NGP_ThrowAssert(
data[simdIndex]->get_2D_view_by_index(viewIndex).size() ==
simdData.get_2D_view_by_index(viewIndex).size());
NGP_ThrowAssert(src[simdIndex] != nullptr);
NGP_ThrowAssert(
STK_NGP_ThrowAssert(src[simdIndex] != nullptr);
STK_NGP_ThrowAssert(
src[simdIndex][0] ==
data[simdIndex]->get_2D_view_by_index(viewIndex).data()[0]);
}
Expand All @@ -89,11 +89,11 @@ copy_and_interleave(
for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) {
for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) {
src[simdIndex] = data[simdIndex]->get_3D_view_by_index(viewIndex).data();
NGP_ThrowAssert(
STK_NGP_ThrowAssert(
data[simdIndex]->get_3D_view_by_index(viewIndex).size() ==
simdData.get_3D_view_by_index(viewIndex).size());
NGP_ThrowAssert(src[simdIndex] != nullptr);
NGP_ThrowAssert(
STK_NGP_ThrowAssert(src[simdIndex] != nullptr);
STK_NGP_ThrowAssert(
src[simdIndex][0] ==
data[simdIndex]->get_3D_view_by_index(viewIndex).data()[0]);
}
Expand Down
2 changes: 1 addition & 1 deletion include/ElemDataRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class ElemDataRequests
get_coordinates_field(const COORDS_TYPES cType) const
{
auto it = coordsFields_.find(cType);
NGP_ThrowRequireMsg(
STK_NGP_ThrowRequireMsg(
it != coordsFields_.end(),
"ElemDataRequests:get_coordinates_field: Coordinates field "
"must be registered to ElemDataRequests before access");
Expand Down
1 change: 1 addition & 0 deletions include/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ static const std::string EquationTypeMap[] = {
"PNG_U",
"PNG_TKE",
"Wall_Distance",
"Gamma_Transition",
"Volume_of_Fluid"};

enum UserDataType {
Expand Down
16 changes: 5 additions & 11 deletions include/FieldManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class FieldManager
const std::string& name,
const stk::mesh::PartVector& parts,
const void* initVal = nullptr,
stk::mesh::FieldState state = stk::mesh::FieldState::StateNone)
stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const
{
const int numStates = 0;
const int numComponents = 0;
Expand All @@ -69,7 +69,7 @@ class FieldManager
}

/// Check to see if the field has been registered.
bool field_exists(const std::string& name);
bool field_exists(const std::string& name) const;

unsigned size() const { return meta_.get_fields().size(); }
/// Register a Generic field.
Expand All @@ -82,9 +82,9 @@ class FieldManager
const int numStates,
const int numComponents,
const void* initVal = nullptr,
stk::mesh::FieldState state = stk::mesh::FieldState::StateNone)
stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const
{
register_field(name, parts, numStates, numComponents, init_val);
register_field(name, parts, numStates, numComponents, initVal);
return get_field_ptr<GenericFieldType::value_type>(name, state);
}

Expand Down Expand Up @@ -123,19 +123,13 @@ class FieldManager
const stk::mesh::PartVector& parts,
const int numStates = 0,
const int numComponents = 0,
const void* initVal = nullptr) const;

FieldPointerTypes register_field(
const std::string& name,
stk::mesh::Part* part,
const int numStates = 0,
const int numComponents = 0,
const void* initVal = nullptr) const
{
stk::mesh::PartVector parts;
parts.push_back(part);
register_field(name, parts, numStates, numComponents, initVal);
}


/// Given the named field that has already been registered on the CPU
/// return the GPU version of the same field.
Expand Down
10 changes: 5 additions & 5 deletions include/MultiDimViews.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MultiDimViews
views_3D_size(0),
views_4D_size(0)
{
NGP_ThrowRequireMsg(
STK_NGP_ThrowRequireMsg(
(numNeededViews.num1DViews <= maxViewsPerDim ||
numNeededViews.num2DViews <= maxViewsPerDim ||
numNeededViews.num3DViews <= maxViewsPerDim ||
Expand Down Expand Up @@ -176,7 +176,7 @@ class MultiDimViews
KOKKOS_FUNCTION
void add_1D_view(unsigned ordinal, const SharedMemView1D& view)
{
NGP_ThrowRequire(ordinal < maxFieldOrdinals);
STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals);
#if !defined(KOKKOS_ENABLE_GPU)
views_1D[views_1D_size] = new SharedMemView1D;
*views_1D[views_1D_size] = view;
Expand All @@ -190,7 +190,7 @@ class MultiDimViews
KOKKOS_FUNCTION
void add_2D_view(unsigned ordinal, const SharedMemView2D& view)
{
NGP_ThrowRequire(ordinal < maxFieldOrdinals);
STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals);
#if !defined(KOKKOS_ENABLE_GPU)
views_2D[views_2D_size] = new SharedMemView2D;
*views_2D[views_2D_size] = view;
Expand All @@ -204,7 +204,7 @@ class MultiDimViews
KOKKOS_FUNCTION
void add_3D_view(unsigned ordinal, const SharedMemView3D& view)
{
NGP_ThrowRequire(ordinal < maxFieldOrdinals);
STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals);
#if !defined(KOKKOS_ENABLE_GPU)
views_3D[views_3D_size] = new SharedMemView3D;
*views_3D[views_3D_size] = view;
Expand All @@ -218,7 +218,7 @@ class MultiDimViews
KOKKOS_FUNCTION
void add_4D_view(unsigned ordinal, const SharedMemView4D& view)
{
NGP_ThrowRequire(ordinal < maxFieldOrdinals);
STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals);
#if !defined(KOKKOS_ENABLE_GPU)
views_4D[views_4D_size] = new SharedMemView4D;
*views_4D[views_4D_size] = view;
Expand Down
Loading

0 comments on commit e36d154

Please sign in to comment.