Skip to content

Commit

Permalink
spgemm: add profiling regions to native implementations (#2253)
Browse files Browse the repository at this point in the history
* spgemm: add profiling regions to native implementations

* Add profiling region to KokkosSPGEMM::KokkosSPGEMM_symbolic
  • Loading branch information
cwpearson authored Jun 25, 2024
1 parent e9f7913 commit 31be658
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sparse/impl/KokkosSparse_spgemm_impl_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
a_scalar_nnz_view_t_, b_lno_row_view_t_, b_lno_nnz_view_t_,
b_scalar_nnz_view_t_>::KokkosSPGEMM_symbolic(c_row_view_t
rowmapC_) {
Kokkos::Profiling::pushRegion("KokkosSparse::spgemm_symbolic[NATIVE]");
{
if (KOKKOSKERNELS_VERBOSE) {
std::cout << "SYMBOLIC PHASE" << std::endl;
Expand Down Expand Up @@ -162,6 +163,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
}
#endif
}
Kokkos::Profiling::popRegion();
}

template <typename HandleType, typename a_row_view_t_,
Expand Down
2 changes: 2 additions & 0 deletions sparse/impl/KokkosSparse_spgemm_impl_kkmem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
c_row_view_t rowmapC_, c_lno_nnz_view_t entriesC_,
c_scalar_nnz_view_t valuesC_,
KokkosKernels::Impl::ExecSpaceType lcl_my_exec_space) {
Kokkos::Profiling::pushRegion("KokkosSparse::spgemm_numeric[NATIVE/HASH]");
if (KOKKOSKERNELS_VERBOSE) {
std::cout << "\tHASH MODE" << std::endl;
}
Expand Down Expand Up @@ -1699,6 +1700,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
if (KOKKOSKERNELS_VERBOSE) {
std::cout << "\t\tNumeric TIME:" << timer1.seconds() << std::endl;
}
Kokkos::Profiling::popRegion();
}

// 01/30/2020: this code seems to be unused within any of the kokkos-kernels
Expand Down
5 changes: 5 additions & 0 deletions sparse/impl/KokkosSparse_spgemm_impl_seq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ void spgemm_debug_symbolic(KernelHandle *handle,
bool /* transposeA */, blno_row_view_t_ row_mapB,
blno_nnz_view_t_ entriesB, bool /* transposeB */,
clno_row_view_t_ row_mapC) {
Kokkos::Profiling::pushRegion("KokkosSparse::spgemm_symbolic[NATIVE/DEBUG]");

typename alno_row_view_t_::HostMirror h_rma =
Kokkos::create_mirror_view(row_mapA);
Kokkos::deep_copy(h_rma, row_mapA);
Expand Down Expand Up @@ -100,6 +102,7 @@ void spgemm_debug_symbolic(KernelHandle *handle,
handle->get_spgemm_handle()->set_c_nnz(result_index);
Kokkos::deep_copy(row_mapC, h_rmc);
Kokkos::fence();
Kokkos::Profiling::popRegion();
}

template <typename KernelHandle, typename alno_row_view_t_,
Expand All @@ -119,6 +122,7 @@ void spgemm_debug_numeric(KernelHandle * /* handle */,
bscalar_nnz_view_t_ valuesB, bool /* transposeB */,
clno_row_view_t_ row_mapC, clno_nnz_view_t_ entriesC,
cscalar_nnz_view_t_ valuesC) {
Kokkos::Profiling::pushRegion("KokkosSparse::spgemm_numeric[NATIVE/DEBUG]");
typename alno_row_view_t_::HostMirror h_rma =
Kokkos::create_mirror_view(row_mapA);
Kokkos::deep_copy(h_rma, row_mapA);
Expand Down Expand Up @@ -199,6 +203,7 @@ void spgemm_debug_numeric(KernelHandle * /* handle */,
Kokkos::deep_copy(entriesC, h_entc);
Kokkos::deep_copy(valuesC, h_valc);
Kokkos::fence();
Kokkos::Profiling::popRegion();
}

} // namespace Impl
Expand Down
2 changes: 2 additions & 0 deletions sparse/impl/KokkosSparse_spgemm_impl_speed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
c_row_view_t rowmapC_, c_lno_nnz_view_t entriesC_,
c_scalar_nnz_view_t valuesC_,
KokkosKernels::Impl::ExecSpaceType my_exec_space_) {
Kokkos::Profiling::pushRegion("KokkosSparse::spgemm_numeric[NATIVE/SPEED]");
if (KOKKOSKERNELS_VERBOSE) {
std::cout << "\tSPEED MODE" << std::endl;
}
Expand Down Expand Up @@ -604,6 +605,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
std::cout << "\t\tNumeric SPEED TIME WITH FREE:"
<< numeric_speed_timer_with_free.seconds() << std::endl;
}
Kokkos::Profiling::popRegion();
}
} // namespace Impl
} // namespace KokkosSparse

0 comments on commit 31be658

Please sign in to comment.