-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathSORT.cpp
More file actions
80 lines (61 loc) · 2.13 KB
/
SORT.cpp
File metadata and controls
80 lines (61 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// 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