5 #ifndef _HEBench_Harness_IDataLoader_H_0596d40a3cce4b108a81595c50eb286d 
    6 #define _HEBench_Harness_IDataLoader_H_0596d40a3cce4b108a81595c50eb286d 
   12 #include "hebench/modules/general/include/nocopy.h" 
   13 #include "hebench/modules/logging/include/logging.h" 
   19 namespace TestHarness {
 
   39         std::vector<const hebench::APIBridge::NativeDataBuffer *> 
result;
 
   48     typedef std::shared_ptr<IDataLoader> 
Ptr;
 
   80     createDataPack(std::uint64_t buffer_count, std::uint64_t param_position);
 
  205     virtual std::uint64_t 
getResultIndex(
const std::uint64_t *param_data_pack_indices) 
const = 0;
 
  243     typedef std::shared_ptr<PartialDataLoader> 
Ptr;
 
  252     std::uint64_t 
getResultIndex(
const std::uint64_t *param_data_pack_indices) 
const override;
 
  303               std::size_t input_dim,
 
  304               const std::size_t *input_sample_count_per_dim,
 
  305               const std::uint64_t *input_count_per_dim,
 
  306               std::size_t output_dim,
 
  307               const std::uint64_t *output_count_per_dim,
 
  308               bool allocate_output);
 
  335     void init(
const std::string &filename,
 
  337               std::size_t expected_input_dim,
 
  338               const std::size_t *max_input_sample_count_per_dim,
 
  339               const std::uint64_t *expected_input_count_per_dim,
 
  340               std::size_t expected_output_dim,
 
  341               const std::uint64_t *expected_output_count_per_dim);
 
  364     std::vector<std::shared_ptr<hebench::APIBridge::DataPack>> 
getResultTempDataPacks(std::uint64_t result_index) 
const;
 
  387     std::vector<std::shared_ptr<hebench::APIBridge::DataPack>> 
getResultTempDataPacks(
const std::uint64_t *param_data_pack_indices)
 const 
  436     void allocate(
const std::uint64_t *input_buffer_sizes,
 
  437                   std::size_t input_buffer_sizes_count,
 
  438                   const std::uint64_t *output_buffer_sizes,
 
  439                   std::size_t output_buffer_sizes_count,
 
  440                   bool allocate_output);
 
  442     std::vector<unique_ptr_custom_deleter<hebench::APIBridge::DataPack>> m_input_data;
 
  445     std::vector<unique_ptr_custom_deleter<hebench::APIBridge::DataPack>> m_output_data;
 
  447     std::vector<std::uint8_t> m_raw_buffer; 
 
  449     bool m_b_is_output_allocated;
 
  450     bool m_b_initialized;
 
static std::size_t sizeOf(hebench::APIBridge::DataType data_type)
std::vector< const hebench::APIBridge::NativeDataBuffer * > result
Points to the NativeDataBuffer s containing the result sample for an input sample.
std::uint64_t sample_index
Index of the result sample.
static unique_ptr_custom_deleter< hebench::APIBridge::NativeDataBuffer > createDataBuffer(std::uint64_t size, std::int64_t tag)
virtual ResultDataPtr getResultFor(const std::uint64_t *param_data_pack_indices)=0
getResultFor
virtual std::uint64_t getParameterCount() const =0
Number of parameter components (operands) for the represented operation.
static unique_ptr_custom_deleter< hebench::APIBridge::DataPackCollection > createDataPackCollection(std::uint64_t data_pack_count)
Creates shallow packed data that self cleans up.
std::shared_ptr< ResultData > ResultDataPtr
std::shared_ptr< IDataLoader > Ptr
hebench::TestHarness::unique_ptr_custom_deleter< T > unique_ptr_custom_deleter
virtual std::uint64_t getResultCount() const =0
Number of components in a result for the represented operation.
std::shared_ptr< void > reserved0
virtual const hebench::APIBridge::DataPack & getParameterData(std::uint64_t param_position) const =0
Data pack for specified operation parameter (operand).
static unique_ptr_custom_deleter< hebench::APIBridge::DataPack > createDataPack(std::uint64_t buffer_count, std::uint64_t param_position)
Creates shallow data pack that self cleans up.
virtual const hebench::APIBridge::DataPack & getResultData(std::uint64_t param_position) const =0
Data pack corresponding to the specified component of the result.
virtual std::uint64_t getResultIndex(const std::uint64_t *param_data_pack_indices) const =0
Computes the index of the result NativeDataBuffer given the indices of the input data.
virtual std::uint64_t getTotalDataLoaded() const =0
Total data loaded by this loader in bytes.
Base class for data loaders and data generators.
bool isInitialized() const
ResultDataPtr getResultFor(const std::uint64_t *param_data_pack_indices) override
getResultFor
std::vector< std::shared_ptr< hebench::APIBridge::DataPack > > getResultTempDataPacks(const std::uint64_t *param_data_pack_indices) const
Retrieves a pre-allocated result providing memory space to store a single operation result sample.
bool hasResults() const
Retrieves whether buffers to contain output data have been allocated or not.
std::vector< std::shared_ptr< hebench::APIBridge::DataPack > > getResultTempDataPacks() const
Retrieves a pre-allocated result providing memory space to store a single operation result sample.
std::uint64_t getResultCount() const override
Number of components in a result for the represented operation.
const hebench::APIBridge::DataPack & getResultData(std::uint64_t param_position) const override
Data pack corresponding to the specified component of the result.
~PartialDataLoader() override
std::uint64_t getParameterCount() const override
Number of parameter components (operands) for the represented operation.
const hebench::APIBridge::DataPack & getParameterData(std::uint64_t param_position) const override
Data pack for specified operation parameter (operand).
void init(hebench::APIBridge::DataType data_type, std::size_t input_dim, const std::size_t *input_sample_count_per_dim, const std::uint64_t *input_count_per_dim, std::size_t output_dim, const std::uint64_t *output_count_per_dim, bool allocate_output)
Initializes dimensions of inputs and outputs. No allocation is performed.
std::uint64_t getTotalDataLoaded() const override
Total data loaded by this loader in bytes.
hebench::APIBridge::DataType getDataType() const
std::shared_ptr< PartialDataLoader > Ptr
std::uint64_t getResultIndex(const std::uint64_t *param_data_pack_indices) const override
Computes the index of the result NativeDataBuffer given the indices of the input data.
DataType
Defines data types for a workload.
Defines a data package for an operation.
std::unique_ptr< T, std::function< void(T *)> > unique_ptr_custom_deleter