//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // 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 "SORT.hpp" #include "RAJA/RAJA.hpp" #include "common/DataUtils.hpp" namespace rajaperf { namespace algorithm { SORT::SORT(const RunParams& params) : KernelBase(rajaperf::Algorithm_SORT, params) { setDefaultProblemSize(1000000); setDefaultReps(20); setSize(params.getTargetSize(getDefaultProblemSize()), params.getReps(getDefaultReps())); setChecksumConsistency(ChecksumConsistency::Consistent); // sort is not stable but values are equal if equivalent setChecksumTolerance(ChecksumTolerance::zero); setComplexity(Complexity::N_logN); setMaxPerfectLoopDimensions(1); setProblemDimensionality(1); setUsesFeature(Sort); addVariantTunings( ); } void SORT::setSize(Index_type target_size, Index_type target_reps) { setActualProblemSize( target_size ); setRunReps( target_reps ); setItsPerRep( getActualProblemSize() ); setKernelsPerRep(1); setBytesAllocatedPerRep( 1*sizeof(Real_type) * getActualProblemSize() ); // x // not useful in this case due to O(n*log(n)) algorithm setBytesReadPerRep( 0 ); setBytesWrittenPerRep( 0 ); setBytesModifyWrittenPerRep( 1*sizeof(Real_type) * getActualProblemSize() ); // x setBytesAtomicModifyWrittenPerRep( 0 ); setFLOPsPerRep(0); } SORT::~SORT() { } void SORT::setUp(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx)) { allocAndInitDataRandValue(m_x, getActualProblemSize()*getRunReps(), vid); } void SORT::updateChecksum(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx)) { addToChecksum(m_x, getActualProblemSize()*getRunReps(), vid); } void SORT::tearDown(VariantID vid, size_t RAJAPERF_UNUSED_ARG(tune_idx)) { deallocData(m_x, vid); } } // end namespace algorithm } // end namespace rajaperf