-
Notifications
You must be signed in to change notification settings - Fork 16
Resolve compiler warnings when building with CUDA #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 4 commits
fb48823
e34a560
c8f91cc
f8a58b6
477c325
95cd841
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ class MeshFieldBackendImpl : public MeshFieldBackend | |
| Kokkos::deep_copy(data_d, Kokkos::View<const Real*, HostMemorySpace>( | ||
| data.data_handle(), data.size())); | ||
| Omega_h::parallel_for( | ||
| mesh_.nents(dim), OMEGA_H_LAMBDA(size_t ent) { | ||
| mesh_.nents(dim), KOKKOS_CLASS_LAMBDA(size_t ent) { | ||
| for (size_t n = 0; n < num_nodes; ++n) { | ||
| for (size_t c = 0; c < num_components; ++c) { | ||
| shape_field_(ent, n, c, topo) = | ||
|
|
@@ -52,7 +52,7 @@ class MeshFieldBackendImpl : public MeshFieldBackend | |
| Kokkos::View<Real*, DefaultExecutionSpace::memory_space> data_d( | ||
| "data_d", data.size()); | ||
| Omega_h::parallel_for( | ||
| mesh_.nents(dim), OMEGA_H_LAMBDA(size_t ent) { | ||
| mesh_.nents(dim), KOKKOS_CLASS_LAMBDA(size_t ent) { | ||
| for (size_t n = 0; n < num_nodes; ++n) { | ||
| for (size_t c = 0; c < num_components; ++c) { | ||
| data_d[ent * stride + n * num_components + c] = | ||
|
|
@@ -122,6 +122,7 @@ struct FillCoordinatesAndIndicesFunctor | |
| Kokkos::View<Real**> coordinates_; | ||
| Kokkos::View<LO*> indices_; | ||
| Kokkos::View<GridPointSearch::Result*> search_results_; | ||
| Omega_h::Int dim_; | ||
|
|
||
| FillCoordinatesAndIndicesFunctor( | ||
| Omega_h::Mesh& mesh, Kokkos::View<LO*> elem_counts, | ||
|
|
@@ -133,21 +134,23 @@ struct FillCoordinatesAndIndicesFunctor | |
| offsets_(offsets), | ||
| coordinates_(coordinates), | ||
| indices_(indices), | ||
| search_results_(search_results) | ||
| search_results_(search_results), | ||
| dim_(mesh.dim()) | ||
| { | ||
| } | ||
|
|
||
| KOKKOS_INLINE_FUNCTION | ||
| void operator()(LO i) const | ||
| { | ||
| auto [dim, elem_idx, coord] = search_results_(i); | ||
| // disable the host assertion macro for device code | ||
| // currently don't handle case where point is on a boundary | ||
| PCMS_ALWAYS_ASSERT(static_cast<int>(dim) == mesh_.dim()); | ||
| // PCMS_ALWAYS_ASSERT(static_cast<int>(dim) == mesh_.dim()); | ||
| // element should be inside the domain (positive) | ||
| PCMS_ALWAYS_ASSERT(elem_idx >= 0 && elem_idx < mesh_.nelems()); | ||
| // PCMS_ALWAYS_ASSERT(elem_idx >= 0 && elem_idx < mesh_.nelems()); | ||
| LO count = Kokkos::atomic_sub_fetch(&elem_counts_(elem_idx), 1); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we define a Host macro that only evaluates on host? |
||
| LO index = offsets_(elem_idx) + count - 1; | ||
| for (int j = 0; j < (mesh_.dim() + 1); ++j) { | ||
| for (int j = 0; j < (dim_ + 1); ++j) { | ||
| coordinates_(index, j) = coord[j]; | ||
| } | ||
| indices_(index) = i; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,9 +72,9 @@ void client1(MPI_Comm comm, Omega_h::Mesh& mesh, std::string comm_name, | |
| const auto n = layout->GetNumOwnedDofHolder(); | ||
| Omega_h::HostWrite<Real> ids(n); | ||
| PCMS_ALWAYS_ASSERT(n == gids.size()); | ||
| Kokkos::parallel_for( | ||
| "id gid", Kokkos::RangePolicy<pcms::HostMemorySpace::execution_space>(0, n), | ||
| KOKKOS_LAMBDA(int i) { ids[i] = gids[i]; }); | ||
| for (size_t i = 0; i < static_cast<size_t>(n); ++i) { | ||
|
||
| ids[i] = gids[i]; | ||
| } | ||
|
|
||
| auto field = layout->CreateField(); | ||
| field->SetDOFHolderData(pcms::make_const_array_view(ids)); | ||
|
|
@@ -157,9 +157,9 @@ void server(MPI_Comm comm, Omega_h::Mesh& mesh, std::string comm_name, | |
| pcms::CoordinateSystem::Cartesian); | ||
| const auto n = layout->GetNumOwnedDofHolder(); | ||
| Omega_h::HostWrite<Real> ids(n); | ||
| Kokkos::parallel_for( | ||
| "id 0", Kokkos::RangePolicy<pcms::HostMemorySpace::execution_space>(0, n), | ||
| KOKKOS_LAMBDA(int i) { ids[i] = 0; }); | ||
| for (size_t i = 0; i < static_cast<size_t>(n); ++i) { | ||
|
||
| ids[i] = 0; | ||
| } | ||
|
|
||
| auto field = layout->CreateField(); | ||
| pcms::FieldLayoutCommunicator<pcms::Real> layout_comm1( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,9 +23,9 @@ void test_copy(Omega_h::CommPtr world, int dim, int order, int num_components) | |
| pcms::CoordinateSystem::Cartesian); | ||
| int ndata = layout->GetNumOwnedDofHolder() * num_components; | ||
| Omega_h::HostWrite<Real> ids(ndata); | ||
| Kokkos::parallel_for( | ||
| Kokkos::RangePolicy<pcms::HostMemorySpace::execution_space>(0, ndata), | ||
| KOKKOS_LAMBDA(int i) { ids[i] = i; }); | ||
| for (size_t i = 0; i < static_cast<size_t>(ndata); ++i) { | ||
| ids[i] = i; | ||
| } | ||
|
||
|
|
||
| auto original = layout->CreateField(); | ||
| original->SetDOFHolderData(pcms::make_const_array_view(ids)); | ||
|
|
@@ -36,12 +36,11 @@ void test_copy(Omega_h::CommPtr world, int dim, int order, int num_components) | |
|
|
||
| REQUIRE(copied_array.size() == ndata); | ||
| int sum = 0; | ||
| Kokkos::parallel_reduce( | ||
| Kokkos::RangePolicy<pcms::HostMemorySpace::execution_space>(0, ndata), | ||
| KOKKOS_LAMBDA(int i, int& local_sum) { | ||
| local_sum += std::abs(ids[i] - copied_array[i]) < 1e-12; | ||
| }, | ||
| sum); | ||
| for (size_t i = 0; i < static_cast<size_t>(ndata); ++i) { | ||
| if (std::abs(ids[i] - copied_array[i]) < 1e-12) { | ||
| sum++; | ||
| } | ||
| } | ||
|
||
| REQUIRE(sum == ndata); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ TEST_CASE("Test Interpolation on LTX Mesh", "[interpolation]") | |
| output_xgc_vtu_filename.c_str()); | ||
|
|
||
| // ------------------ Verification ------------------ // | ||
| double tol = 10.0 / 100.0; // 10 percent tolerance | ||
| // double tol = 10.0 / 100.0; // 10 percent tolerance | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is unused, just delete it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is intended to be used with the commented-out verification code. Would you like me to remove that entire block? |
||
| // XGC Originated Values | ||
| /* | ||
| for (int i = 0; i < xgc_num_nodes; ++i) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to swap out the
Omega_h::parallel_forwithKokkos::parallel_forif we are using the Kokkos macros?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I think we should be consistent and use only one of them if possible.