Skip to content

Commit

Permalink
Add resource in omp target variants
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornung67 committed Oct 30, 2024
1 parent 9203121 commit 3e97895
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/lcals/DIFF_PREDICT-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ void DIFF_PREDICT::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
DIFF_PREDICT_BODY;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/EOS-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ void EOS::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
EOS_BODY;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/FIRST_DIFF-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ void FIRST_DIFF::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_AR

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
FIRST_DIFF_BODY;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/FIRST_MIN-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ void FIRST_MIN::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

using VL_TYPE = RAJA::expt::ValLoc<Real_type>;

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

VL_TYPE tloc(m_xmin_init, m_initloc);

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend),
RAJA::expt::Reduce<RAJA::operators::minimum>(&tloc),
[=](Index_type i, VL_TYPE& loc) {
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/FIRST_SUM-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ void FIRST_SUM::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
FIRST_SUM_BODY;
});
Expand Down
6 changes: 4 additions & 2 deletions src/lcals/GEN_LIN_RECUR-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ void GEN_LIN_RECUR::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(0, N), [=] (Index_type k) {
GEN_LIN_RECUR_BODY1;
});

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(1, N+1), [=] (Index_type i) {
GEN_LIN_RECUR_BODY2;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/HYDRO_1D-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ void HYDRO_1D::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
HYDRO_1D_BODY;
});
Expand Down
11 changes: 8 additions & 3 deletions src/lcals/HYDRO_2D-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ void HYDRO_2D::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

HYDRO_2D_VIEWS_RAJA;

using EXECPOL =
Expand All @@ -81,23 +83,26 @@ void HYDRO_2D::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG(
startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::kernel<EXECPOL>(
RAJA::kernel_resource<EXECPOL>(
RAJA::make_tuple( RAJA::RangeSegment(kbeg, kend),
RAJA::RangeSegment(jbeg, jend)),
res,
[=] (Index_type k, Index_type j) {
HYDRO_2D_BODY1_RAJA;
});

RAJA::kernel<EXECPOL>(
RAJA::kernel_resource<EXECPOL>(
RAJA::make_tuple( RAJA::RangeSegment(kbeg, kend),
RAJA::RangeSegment(jbeg, jend)),
res,
[=] (Index_type k, Index_type j) {
HYDRO_2D_BODY2_RAJA;
});

RAJA::kernel<EXECPOL>(
RAJA::kernel_resource<EXECPOL>(
RAJA::make_tuple( RAJA::RangeSegment(kbeg, kend),
RAJA::RangeSegment(jbeg, jend)),
res,
[=] (Index_type k, Index_type j) {
HYDRO_2D_BODY3_RAJA;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/INT_PREDICT-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ void INT_PREDICT::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_A

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
INT_PREDICT_BODY;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/PLANCKIAN-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ void PLANCKIAN::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_ARG

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
PLANCKIAN_BODY;
});
Expand Down
4 changes: 3 additions & 1 deletion src/lcals/TRIDIAG_ELIM-OMPTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ void TRIDIAG_ELIM::runOpenMPTargetVariant(VariantID vid, size_t RAJAPERF_UNUSED_

} else if ( vid == RAJA_OpenMPTarget ) {

auto res{getOmpTargetResource()};

startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {

RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>(
RAJA::forall<RAJA::omp_target_parallel_for_exec<threads_per_team>>( res,
RAJA::RangeSegment(ibegin, iend), [=](Index_type i) {
TRIDIAG_ELIM_BODY;
});
Expand Down

0 comments on commit 3e97895

Please sign in to comment.