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
1 change: 0 additions & 1 deletion src/apps-kokkos/NODAL_ACCUMULATION_3D-Kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace apps
void NODAL_ACCUMULATION_3D::runKokkosVariant(VariantID vid)
{
const Index_type run_reps = getRunReps();
const Index_type ibegin = 0;
Comment thread
MrBurmark marked this conversation as resolved.
const Index_type iend = getActualProblemSize(); //m_domain->n_real_zones;

NODAL_ACCUMULATION_3D_DATA_SETUP;
Expand Down
1 change: 0 additions & 1 deletion src/lcals-kokkos/GEN_LIN_RECUR-Kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace lcals {

void GEN_LIN_RECUR::runKokkosVariant(VariantID vid) {
const Index_type run_reps = getRunReps();
const Index_type ibegin = 1;
Comment thread
MrBurmark marked this conversation as resolved.
const Index_type iend = getActualProblemSize();

GEN_LIN_RECUR_DATA_SETUP;
Expand Down
1 change: 1 addition & 0 deletions src/polybench-kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
blt_add_library(
NAME polybench-kokkos
SOURCES
POLYBENCH_GEMM-Kokkos.cpp
POLYBENCH_HEAT_3D-Kokkos.cpp
POLYBENCH_JACOBI_1D-Kokkos.cpp
POLYBENCH_JACOBI_2D-Kokkos.cpp
Expand Down
75 changes: 75 additions & 0 deletions src/polybench-kokkos/POLYBENCH_GEMM-Kokkos.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) Lawrence Livermore National Security, LLC and other
// RAJA Project Developers. See top-level LICENSE and COPYRIGHT
// files for dates and other details. No copyright assignment is required
// to contribute to RAJA Performance Suite.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

#include "POLYBENCH_GEMM.hpp"

#if defined(RUN_KOKKOS)

#include "common/KokkosViewUtils.hpp"

#include <iostream>

namespace rajaperf {
namespace polybench {

void POLYBENCH_GEMM::runKokkosVariant(VariantID vid) {
const Index_type run_reps = getRunReps();

POLYBENCH_GEMM_DATA_SETUP;

auto A_view = getViewFromPointer(A, ni, nk);
auto B_view = getViewFromPointer(B, nk, nj);
auto C_view = getViewFromPointer(C, ni, nj);

switch (vid) {
case Kokkos_Lambda: {

Kokkos::fence();
startTimer();

// Loop counter increment uses macro to quiet C++20 compiler warning
for (RepIndex_type irep = 0; irep < run_reps; RP_REPCOUNTINC(irep)) {

Kokkos::parallel_for(
"POLYBENCH_GEMM Kokkos_Lambda",
Kokkos::MDRangePolicy<Kokkos::Rank<2>,
Kokkos::IndexType<Index_type>>({0, 0},
{ni, nj}),
KOKKOS_LAMBDA(Index_type i, Index_type j) {
Real_type dot = 0.0;
C_view(i, j) *= beta;
for (Index_type k = 0; k < nk; ++k) {
dot += alpha * A_view(i, k) * B_view(k, j);
}
C_view(i, j) = dot;
});
}

Kokkos::fence();
stopTimer();

break;
}

default: {
std::cout << "\n POLYBENCH_GEMM : Unknown variant id = " << vid
<< std::endl;
}
}

moveDataToHostFromKokkosView(A, A_view, ni, nk);
moveDataToHostFromKokkosView(B, B_view, nk, nj);
moveDataToHostFromKokkosView(C, C_view, ni, nj);
}

RAJAPERF_DEFAULT_TUNING_DEFINE_BOILERPLATE(POLYBENCH_GEMM, Kokkos, Kokkos_Lambda)

} // end namespace polybench
} // end namespace rajaperf
#endif // RUN_KOKKOS
6 changes: 3 additions & 3 deletions src/polybench-kokkos/POLYBENCH_HEAT_3D-Kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ void POLYBENCH_HEAT_3D::runKokkosVariant(VariantID vid) {
Kokkos::fence();
stopTimer();

moveDataToHostFromKokkosView(A, A_view, N, N, N);
moveDataToHostFromKokkosView(B, B_view, N, N, N);

break;
}

default: {
std::cout << "\n POLYBENCH_HEAT_3D : Unknown variant id = " << vid
<< std::endl;
}

moveDataToHostFromKokkosView(A, A_view, N, N, N);
moveDataToHostFromKokkosView(B, B_view, N, N, N);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/polybench-kokkos/POLYBENCH_JACOBI_1D-Kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ void POLYBENCH_JACOBI_1D::runKokkosVariant(VariantID vid) {
Kokkos::fence();
stopTimer();

moveDataToHostFromKokkosView(A, A_view, N);
moveDataToHostFromKokkosView(B, B_view, N);

break;
}

Expand All @@ -67,6 +64,9 @@ void POLYBENCH_JACOBI_1D::runKokkosVariant(VariantID vid) {
<< std::endl;
}
}

moveDataToHostFromKokkosView(A, A_view, N);
moveDataToHostFromKokkosView(B, B_view, N);
}

RAJAPERF_DEFAULT_TUNING_DEFINE_BOILERPLATE(POLYBENCH_JACOBI_1D, Kokkos, Kokkos_Lambda)
Expand Down
6 changes: 3 additions & 3 deletions src/polybench-kokkos/POLYBENCH_JACOBI_2D-Kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ void POLYBENCH_JACOBI_2D::runKokkosVariant(VariantID vid) {
Kokkos::fence();
stopTimer();

moveDataToHostFromKokkosView(A, A_view, N, N);
moveDataToHostFromKokkosView(B, B_view, N, N);

break;
}

Expand All @@ -73,6 +70,9 @@ void POLYBENCH_JACOBI_2D::runKokkosVariant(VariantID vid) {
<< std::endl;
}
}

moveDataToHostFromKokkosView(A, A_view, N, N);
moveDataToHostFromKokkosView(B, B_view, N, N);
}

RAJAPERF_DEFAULT_TUNING_DEFINE_BOILERPLATE(POLYBENCH_JACOBI_2D, Kokkos, Kokkos_Lambda)
Expand Down
2 changes: 2 additions & 0 deletions src/polybench/POLYBENCH_GEMM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ class POLYBENCH_GEMM : public KernelBase
void defineSeqVariantTunings();
void defineOpenMPVariantTunings();
void defineOpenMPTargetVariantTunings();
void defineKokkosVariantTunings();
void defineCudaVariantTunings();
void defineHipVariantTunings();
void defineSyclVariantTunings();

void runSeqVariant(VariantID vid);
void runOpenMPVariant(VariantID vid);
void runOpenMPTargetVariant(VariantID vid);
void runKokkosVariant(VariantID vid);

template < size_t block_size >
void runCudaVariantImpl(VariantID vid);
Expand Down
Loading