Skip to content

Commit

Permalink
Merge Pull Request #13640 from vqd8a/Trilinos/adelus-forward-out-of-b…
Browse files Browse the repository at this point in the history
…ound-fix

Automatically Merged using Trilinos Pull Request AutoTester
PR Title: b'Adelus: Fix out-of-bound access on RHS in forward'
PR Author: vqd8a
  • Loading branch information
trilinos-autotester authored Dec 5, 2024
2 parents e5c77c1 + 519dbe4 commit 1171455
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/adelus/src/Adelus_forward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ void forward(HandleType& ahandle, ZViewType& Z, RHSViewType& RHS)
// count_row++;
//}
int curr_lrid = k/nprocs_col;//note: nprocs_col (global var) cannot be read in a device function
Kokkos::parallel_for(Kokkos::RangePolicy<execution_space>(0,RHS.extent(1)), KOKKOS_LAMBDA (const int i) {
ck(0,i) = RHS(curr_lrid,i);
});
if (curr_lrid < static_cast<int>(RHS.extent(0))) { //note: to avoid out-of-bounds access on the RHS
Kokkos::parallel_for(Kokkos::RangePolicy<execution_space>(0,RHS.extent(1)), KOKKOS_LAMBDA (const int i) {
ck(0,i) = RHS(curr_lrid,i);
});
}

#if defined(ADELUS_HOST_PINNED_MEM_MPI) && (defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP))
Kokkos::deep_copy(h_ck,ck);
Expand Down

0 comments on commit 1171455

Please sign in to comment.