CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
tfaot::Wrapper Class Referenceabstract

#include <Wrapper.h>

Public Member Functions

AllocMode allocMode () const
 
int argCount (size_t batchSize, size_t argIndex) const
 
int argCountNoBatch (size_t argIndex) const
 
virtual const std::map< size_t, std::vector< size_t > > & argCounts () const =0
 
virtual const std::vector< size_t > & argCountsNoBatch () const =0
 
template<typename T >
TargData (size_t batchSize, size_t argIndex)
 
template<typename T >
const TargData (size_t batchSize, size_t argIndex) const
 
virtual const std::vector< size_t > & batchSizes () const =0
 
bool hasBatchSize (size_t batchSize) const
 
const std::string & name () const
 
virtual size_t nArgs () const =0
 
size_t nBatchSizes () const
 
virtual size_t nResults () const =0
 
Wrapperoperator= (const Wrapper &)=delete
 
Wrapperoperator= (Wrapper &&)=delete
 
int resultCount (size_t batchSize, size_t resultIndex) const
 
int resultCountNoBatch (size_t resultIndex) const
 
virtual const std::map< size_t, std::vector< size_t > > & resultCounts () const =0
 
virtual const std::vector< size_t > & resultCountsNoBatch () const =0
 
template<typename T >
TresultData (size_t batchSize, size_t resultIndex)
 
template<typename T >
const TresultData (size_t batchSize, size_t resultIndex) const
 
void run (size_t batchSize)
 
virtual bool runSilent (size_t batchSize)=0
 
 Wrapper (const std::string &name)
 
 Wrapper (const Wrapper &)=delete
 
virtual ~Wrapper ()=default
 

Protected Member Functions

void unknownArgument (size_t argIndex, const std::string &method) const
 
void unknownBatchSize (size_t batchSize, const std::string &method) const
 
void unknownResult (size_t resultIndex, const std::string &method) const
 

Private Attributes

AllocMode allocMode_
 
std::string name_
 

Detailed Description

Definition at line 25 of file Wrapper.h.

Constructor & Destructor Documentation

◆ Wrapper() [1/2]

tfaot::Wrapper::Wrapper ( const std::string &  name)
inlineexplicit

Definition at line 28 of file Wrapper.h.

29  : name_(name), allocMode_(AllocMode::ARGS_VARIABLES_RESULTS_PROFILES_AND_TEMPS) {}
const std::string & name() const
Definition: Wrapper.h:44
AllocMode allocMode_
Definition: Wrapper.h:143
std::string name_
Definition: Wrapper.h:142

◆ Wrapper() [2/2]

tfaot::Wrapper::Wrapper ( const Wrapper )
delete

◆ ~Wrapper()

virtual tfaot::Wrapper::~Wrapper ( )
virtualdefault

Member Function Documentation

◆ allocMode()

AllocMode tfaot::Wrapper::allocMode ( ) const
inline

Definition at line 47 of file Wrapper.h.

References allocMode_.

47 { return allocMode_; }
AllocMode allocMode_
Definition: Wrapper.h:143

◆ argCount()

int tfaot::Wrapper::argCount ( size_t  batchSize,
size_t  argIndex 
) const

Definition at line 14 of file Wrapper.cc.

References argCounts(), HLT_FULL_cff::batchSize, dqmiodumpmetadata::counts, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, unknownArgument(), and unknownBatchSize().

14  {
15  const auto& counts = argCounts();
16  const auto it = counts.find(batchSize);
17  if (it == counts.end()) {
18  unknownBatchSize(batchSize, "argCount()");
19  }
20  if (argIndex >= it->second.size()) {
21  unknownArgument(argIndex, "argCount()");
22  }
23  return it->second.at(argIndex);
24  }
virtual const std::map< size_t, std::vector< size_t > > & argCounts() const =0
void unknownBatchSize(size_t batchSize, const std::string &method) const
Definition: Wrapper.h:124
void unknownArgument(size_t argIndex, const std::string &method) const
Definition: Wrapper.h:130

◆ argCountNoBatch()

int tfaot::Wrapper::argCountNoBatch ( size_t  argIndex) const

Definition at line 26 of file Wrapper.cc.

References argCountsNoBatch(), dqmiodumpmetadata::counts, and unknownArgument().

26  {
27  const auto& counts = argCountsNoBatch();
28  if (argIndex >= counts.size()) {
29  unknownArgument(argIndex, "argCountNoBatch()");
30  }
31  return counts.at(argIndex);
32  }
virtual const std::vector< size_t > & argCountsNoBatch() const =0
void unknownArgument(size_t argIndex, const std::string &method) const
Definition: Wrapper.h:130

◆ argCounts()

virtual const std::map<size_t, std::vector<size_t> >& tfaot::Wrapper::argCounts ( ) const
pure virtual

Referenced by argCount().

◆ argCountsNoBatch()

virtual const std::vector<size_t>& tfaot::Wrapper::argCountsNoBatch ( ) const
pure virtual

Referenced by argCountNoBatch().

◆ argData() [1/2]

template<typename T >
T* tfaot::Wrapper::argData ( size_t  batchSize,
size_t  argIndex 
)

◆ argData() [2/2]

template<typename T >
const T* tfaot::Wrapper::argData ( size_t  batchSize,
size_t  argIndex 
) const

◆ batchSizes()

virtual const std::vector<size_t>& tfaot::Wrapper::batchSizes ( ) const
pure virtual

Referenced by hasBatchSize(), and nBatchSizes().

◆ hasBatchSize()

bool tfaot::Wrapper::hasBatchSize ( size_t  batchSize) const
inline

Definition at line 57 of file Wrapper.h.

References HLT_FULL_cff::batchSize, batchSizes(), and cms::cuda::bs.

57  {
58  const auto& bs = batchSizes();
59  return std::binary_search(bs.begin(), bs.end(), batchSize);
60  }
virtual const std::vector< size_t > & batchSizes() const =0

◆ name()

const std::string& tfaot::Wrapper::name ( void  ) const
inline

Definition at line 44 of file Wrapper.h.

References name_.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

44 { return name_; }
std::string name_
Definition: Wrapper.h:142

◆ nArgs()

virtual size_t tfaot::Wrapper::nArgs ( ) const
pure virtual

◆ nBatchSizes()

size_t tfaot::Wrapper::nBatchSizes ( ) const
inline

Definition at line 53 of file Wrapper.h.

References batchSizes().

53 { return batchSizes().size(); }
virtual const std::vector< size_t > & batchSizes() const =0

◆ nResults()

virtual size_t tfaot::Wrapper::nResults ( ) const
pure virtual

◆ operator=() [1/2]

Wrapper& tfaot::Wrapper::operator= ( const Wrapper )
delete

◆ operator=() [2/2]

Wrapper& tfaot::Wrapper::operator= ( Wrapper &&  )
delete

◆ resultCount()

int tfaot::Wrapper::resultCount ( size_t  batchSize,
size_t  resultIndex 
) const

Definition at line 34 of file Wrapper.cc.

References HLT_FULL_cff::batchSize, dqmiodumpmetadata::counts, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, resultCounts(), unknownBatchSize(), and unknownResult().

34  {
35  const auto& counts = resultCounts();
36  const auto it = counts.find(batchSize);
37  if (it == counts.end()) {
38  unknownBatchSize(batchSize, "resultCount()");
39  }
40  if (resultIndex >= it->second.size()) {
41  unknownResult(resultIndex, "resultCount()");
42  }
43  return it->second.at(resultIndex);
44  }
void unknownResult(size_t resultIndex, const std::string &method) const
Definition: Wrapper.h:136
void unknownBatchSize(size_t batchSize, const std::string &method) const
Definition: Wrapper.h:124
virtual const std::map< size_t, std::vector< size_t > > & resultCounts() const =0

◆ resultCountNoBatch()

int tfaot::Wrapper::resultCountNoBatch ( size_t  resultIndex) const

Definition at line 46 of file Wrapper.cc.

References dqmiodumpmetadata::counts, resultCountsNoBatch(), and unknownResult().

46  {
47  const auto& counts = resultCountsNoBatch();
48  if (resultIndex >= counts.size()) {
49  unknownResult(resultIndex, "resultCountNoBatch()");
50  }
51  return counts[resultIndex];
52  }
void unknownResult(size_t resultIndex, const std::string &method) const
Definition: Wrapper.h:136
virtual const std::vector< size_t > & resultCountsNoBatch() const =0

◆ resultCounts()

virtual const std::map<size_t, std::vector<size_t> >& tfaot::Wrapper::resultCounts ( ) const
pure virtual

Referenced by resultCount().

◆ resultCountsNoBatch()

virtual const std::vector<size_t>& tfaot::Wrapper::resultCountsNoBatch ( ) const
pure virtual

Referenced by resultCountNoBatch().

◆ resultData() [1/2]

template<typename T >
T* tfaot::Wrapper::resultData ( size_t  batchSize,
size_t  resultIndex 
)

◆ resultData() [2/2]

template<typename T >
const T* tfaot::Wrapper::resultData ( size_t  batchSize,
size_t  resultIndex 
) const

◆ run()

void tfaot::Wrapper::run ( size_t  batchSize)

Definition at line 54 of file Wrapper.cc.

References HLT_FULL_cff::batchSize, Exception, name_, and runSilent().

54  {
55  if (!runSilent(batchSize)) {
56  throw cms::Exception("FailedRun") << "evaluation with batch size " << batchSize << " failed for model '" << name_;
57  }
58  }
virtual bool runSilent(size_t batchSize)=0
std::string name_
Definition: Wrapper.h:142

◆ runSilent()

virtual bool tfaot::Wrapper::runSilent ( size_t  batchSize)
pure virtual

Referenced by run().

◆ unknownArgument()

void tfaot::Wrapper::unknownArgument ( size_t  argIndex,
const std::string &  method 
) const
inlineprotected

Definition at line 130 of file Wrapper.h.

References Exception, AlcaSiPixelAliHarvester0T_cff::method, and name_.

Referenced by argCount(), and argCountNoBatch().

130  {
131  throw cms::Exception("UnknownArgument")
132  << "argument " << argIndex << " not known to model '" << name_ << "' in '" << method << "'";
133  }
std::string name_
Definition: Wrapper.h:142

◆ unknownBatchSize()

void tfaot::Wrapper::unknownBatchSize ( size_t  batchSize,
const std::string &  method 
) const
inlineprotected

Definition at line 124 of file Wrapper.h.

References HLT_FULL_cff::batchSize, Exception, AlcaSiPixelAliHarvester0T_cff::method, and name_.

Referenced by argCount(), and resultCount().

124  {
125  throw cms::Exception("UnknownBatchSize")
126  << "batch size " << batchSize << " not known to model '" << name_ << "' in '" << method << "'";
127  }
std::string name_
Definition: Wrapper.h:142

◆ unknownResult()

void tfaot::Wrapper::unknownResult ( size_t  resultIndex,
const std::string &  method 
) const
inlineprotected

Definition at line 136 of file Wrapper.h.

References Exception, AlcaSiPixelAliHarvester0T_cff::method, and name_.

Referenced by resultCount(), and resultCountNoBatch().

136  {
137  throw cms::Exception("UnknownResult")
138  << "result " << resultIndex << " not known to model '" << name_ << "' in '" << method << "'";
139  }
std::string name_
Definition: Wrapper.h:142

Member Data Documentation

◆ allocMode_

AllocMode tfaot::Wrapper::allocMode_
private

Definition at line 143 of file Wrapper.h.

Referenced by allocMode().

◆ name_

std::string tfaot::Wrapper::name_
private

Definition at line 142 of file Wrapper.h.

Referenced by name(), run(), unknownArgument(), unknownBatchSize(), and unknownResult().