Skip to content
Draft
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
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ blt_add_executable(
NAME raja-perf-omptarget.exe
SOURCES RAJAPerfSuiteDriver.cpp
apps/AppsData.cpp
apps/TRANSPORT3DMC.cpp
apps/TRANSPORT3DMC-Seq.cpp
apps/CONVECTION3DPA.cpp
apps/CONVECTION3DPA-Seq.cpp
apps/DEL_DOT_VEC_2D.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
blt_add_library(
NAME apps
SOURCES AppsData.cpp
TRANSPORT3DMC.cpp
TRANSPORT3DMC-Seq.cpp
CONVECTION3DPA.cpp
CONVECTION3DPA-Cuda.cpp
CONVECTION3DPA-Hip.cpp
Expand Down
100 changes: 100 additions & 0 deletions src/apps/TRANSPORT3DMC-Seq.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// 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 "TRANSPORT3DMC.hpp"

#include "RAJA/RAJA.hpp"

#include <iostream>

namespace rajaperf
{
namespace apps
{


void TRANSPORT3DMC::runSeqVariant(VariantID vid)
{
const Index_type run_reps = getRunReps();
const Index_type ibegin = 0;
const Index_type iend = getActualProblemSize();

TRANSPORT3DMC_DATA_SETUP;

#if defined(RUN_RAJA_SEQ)
auto transport3dmc_lam = [=](Index_type i) {
TRANSPORT3DMC_BODY;
};
#endif

switch ( vid ) {

case Base_Seq : {

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

for (Index_type i = ibegin; i < iend; ++i ) {
TRANSPORT3DMC_BODY;
}

}
stopTimer();

break;
}

#if defined(RUN_RAJA_SEQ)
case Lambda_Seq : {

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

for (Index_type i = ibegin; i < iend; ++i ) {
transport3dmc_lam(i);
}

}
stopTimer();

break;
}

case RAJA_Seq : {

auto res{getHostResource()};

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

RAJA::forall<RAJA::seq_exec>( res,
RAJA::RangeSegment(ibegin, iend), transport3dmc_lam);

}
stopTimer();

break;
}
#endif // RUN_RAJA_SEQ

default : {
getCout() << "\n TRANSPORT3DMC : Unknown variant id = " << vid << std::endl;
}

}

}

RAJAPERF_DEFAULT_TUNING_DEFINE_BOILERPLATE(TRANSPORT3DMC, Seq, Base_Seq, Lambda_Seq, RAJA_Seq)

} // end namespace apps
} // end namespace rajaperf
82 changes: 82 additions & 0 deletions src/apps/TRANSPORT3DMC.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// 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 "TRANSPORT3DMC.hpp"

#include "RAJA/RAJA.hpp"

#include "common/DataUtils.hpp"

namespace rajaperf
{
namespace apps
{


TRANSPORT3DMC::TRANSPORT3DMC(const RunParams& params)
: KernelBase(rajaperf::Apps_TRANSPORT3DMC, params)
{
setDefaultProblemSize(1000000);
setDefaultReps(1000);

setSize(params.getTargetSize(getDefaultProblemSize()),
params.getReps(getDefaultReps()));

setChecksumConsistency(ChecksumConsistency::ConsistentPerVariantTuning);
setChecksumTolerance(ChecksumTolerance::tight);

setComplexity(Complexity::N);

setMaxPerfectLoopDimensions(1);
setProblemDimensionality(1);

setUsesFeature(Forall);

addVariantTunings();
}

void TRANSPORT3DMC::setSize(Index_type target_size, Index_type target_reps)
{
setActualProblemSize( target_size );
setRunReps( target_reps );

setItsPerRep( getActualProblemSize() );
setKernelsPerRep(1);

setBytesAllocatedPerRep( 2*sizeof(Real_type) * getActualProblemSize() ); // in, out
setBytesReadPerRep( 1*sizeof(Real_type) * getActualProblemSize() ); // in
setBytesWrittenPerRep( 1*sizeof(Real_type) * getActualProblemSize() ); // out
setBytesModifyWrittenPerRep( 0 );
setBytesAtomicModifyWrittenPerRep( 0 );
setFLOPsPerRep( 0 );
}

TRANSPORT3DMC::~TRANSPORT3DMC()
{
}

void TRANSPORT3DMC::setUp(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx))
{
allocAndInitData(m_in, getActualProblemSize(), vid);
allocAndInitDataConst(m_out, getActualProblemSize(), 0.0, vid);
}

void TRANSPORT3DMC::updateChecksum(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx))
{
addToChecksum(m_out, getActualProblemSize(), vid);
}

void TRANSPORT3DMC::tearDown(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx))
{
deallocData(m_in, vid);
deallocData(m_out, vid);
}

} // end namespace apps
} // end namespace rajaperf
65 changes: 65 additions & 0 deletions src/apps/TRANSPORT3DMC.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// 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)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

///
/// TRANSPORT3DMC placeholder reference implementation:
///
/// for (Index_type i = ibegin; i < iend; ++i ) {
/// out[i] = in[i];
/// }
///

#ifndef RAJAPerf_Apps_TRANSPORT3DMC_HPP
#define RAJAPerf_Apps_TRANSPORT3DMC_HPP


#define TRANSPORT3DMC_DATA_SETUP \
Real_ptr in = m_in; \
Real_ptr out = m_out;

// Placeholder body. Replace this statement with the target kernel operation.
#define TRANSPORT3DMC_BODY \
out[i] = in[i];


#include "common/KernelBase.hpp"

namespace rajaperf
{
class RunParams;

namespace apps
{

class TRANSPORT3DMC : public KernelBase
{
public:

TRANSPORT3DMC(const RunParams& params);

~TRANSPORT3DMC();

void setSize(Index_type target_size, Index_type target_reps);
void setUp(VariantID vid, size_t tune_idx);
void updateChecksum(VariantID vid, size_t tune_idx);
void tearDown(VariantID vid, size_t tune_idx);

void defineSeqVariantTunings();

void runSeqVariant(VariantID vid);

private:
Real_ptr m_in;
Real_ptr m_out;
};

} // end namespace apps
} // end namespace rajaperf

#endif // closing endif for header file include guard
7 changes: 7 additions & 0 deletions src/common/RAJAPerfSuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
//
// Apps kernels...
//
#include "apps/TRANSPORT3DMC.hpp"
#include "apps/CONVECTION3DPA.hpp"
#include "apps/DEL_DOT_VEC_2D.hpp"
#include "apps/DIFFUSION3DPA.hpp"
Expand Down Expand Up @@ -243,6 +244,7 @@ static const std::string KernelNames [] =
//
// Apps kernels...
//
std::string("Apps_TRANSPORT3DMC"),
std::string("Apps_CONVECTION3DPA"),
std::string("Apps_DEL_DOT_VEC_2D"),
std::string("Apps_DIFFUSION3DPA"),
Expand Down Expand Up @@ -1158,6 +1160,11 @@ KernelBase* getKernelObject(KernelID kid,
//
// Apps kernels...
//
case Apps_TRANSPORT3DMC : {
kernel = new apps::TRANSPORT3DMC(run_params);
break;
}

case Apps_CONVECTION3DPA : {
kernel = new apps::CONVECTION3DPA(run_params);
break;
Expand Down
1 change: 1 addition & 0 deletions src/common/RAJAPerfSuite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ enum KernelID {
//
// Apps kernels...
//
Apps_TRANSPORT3DMC,
Apps_CONVECTION3DPA,
Apps_DEL_DOT_VEC_2D,
Apps_DIFFUSION3DPA,
Expand Down
Loading