HEBench
|
#include <hebench_idata_loader.h>
Classes | |
struct | ResultData |
Public Types | |
template<typename T > | |
using | unique_ptr_custom_deleter = hebench::TestHarness::unique_ptr_custom_deleter< T > |
typedef std::shared_ptr< ResultData > | ResultDataPtr |
typedef std::shared_ptr< IDataLoader > | Ptr |
Public Member Functions | |
virtual | ~IDataLoader () |
virtual std::uint64_t | getParameterCount () const =0 |
Number of parameter components (operands) for the represented operation. More... | |
virtual const hebench::APIBridge::DataPack & | getParameterData (std::uint64_t param_position) const =0 |
Data pack for specified operation parameter (operand). More... | |
virtual std::uint64_t | getResultCount () const =0 |
Number of components in a result for the represented operation. More... | |
virtual const hebench::APIBridge::DataPack & | getResultData (std::uint64_t param_position) const =0 |
Data pack corresponding to the specified component of the result. More... | |
virtual ResultDataPtr | getResultFor (const std::uint64_t *param_data_pack_indices)=0 |
getResultFor More... | |
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. More... | |
virtual std::uint64_t | getTotalDataLoaded () const =0 |
Total data loaded by this loader in bytes. More... | |
Static Public Member Functions | |
static std::size_t | sizeOf (hebench::APIBridge::DataType data_type) |
static unique_ptr_custom_deleter< hebench::APIBridge::DataPackCollection > | createDataPackCollection (std::uint64_t data_pack_count) |
Creates shallow packed data that self cleans up. More... | |
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. More... | |
static unique_ptr_custom_deleter< hebench::APIBridge::NativeDataBuffer > | createDataBuffer (std::uint64_t size, std::int64_t tag) |
Protected Member Functions | |
IDataLoader () | |
Definition at line 21 of file hebench_idata_loader.h.
struct hebench::TestHarness::IDataLoader::ResultData |
Definition at line 33 of file hebench_idata_loader.h.
typedef std::shared_ptr<IDataLoader> hebench::TestHarness::IDataLoader::Ptr |
Definition at line 48 of file hebench_idata_loader.h.
typedef std::shared_ptr<ResultData> hebench::TestHarness::IDataLoader::ResultDataPtr |
Definition at line 46 of file hebench_idata_loader.h.
using hebench::TestHarness::IDataLoader::unique_ptr_custom_deleter = hebench::TestHarness::unique_ptr_custom_deleter<T> |
Definition at line 31 of file hebench_idata_loader.h.
|
inlinevirtual |
Definition at line 50 of file hebench_idata_loader.h.
|
inlineprotected |
Definition at line 213 of file hebench_idata_loader.h.
|
static |
Definition at line 121 of file hebench_idata_loader.cpp.
|
static |
Creates shallow data pack that self cleans up.
[in] | buffer_count | Number of NativeDataBuffer objects pointed to by this DataPack. |
[in] | param_position | Parameter position of this DataPack. |
The returned DataPack will self clean up its p_buffers field when it goes out of scope.
Clients can use the created DataPack by pointing to their NativeDataBuffer objects in the pre-allocated p_buffers field array.
Definition at line 87 of file hebench_idata_loader.cpp.
|
static |
Creates shallow packed data that self cleans up.
[in] | data_pack_count | Number of DataPack objects that will be pointed to by this DataPackCollection. |
The returned DataPackCollection will self clean up its p_data_packs field when it goes out of scope.
Clients can use the created DataPackCollection by pointing to their DataPack objects in the pre-allocated p_data_packs field array.
Definition at line 54 of file hebench_idata_loader.cpp.
|
pure virtual |
Number of parameter components (operands) for the represented operation.
This is the number of operands for the operation. For example, a unary operation has 1 operand, binary has 2, n-ary has n.
Implemented in hebench::TestHarness::PartialDataLoader.
|
pure virtual |
Data pack for specified operation parameter (operand).
[in] | param_position | Zero-based position of the parameter. |
The parameter position for an operation is zero-based starting from the leftmost parameter. i.e. For an operation such as:
R is the result, A is parameter 0, B, is parameter 1, C is parameter 2, etc.
Implemented in hebench::TestHarness::PartialDataLoader.
|
pure virtual |
Number of components in a result for the represented operation.
Shape of result is always 2D: [getResultCount(), ?].
For example, if the represented operation has getParameterCount() = 3 input parameters and getResultCount() = 2 outputs, then, the shape of the result is
Implemented in hebench::TestHarness::PartialDataLoader.
|
pure virtual |
Data pack corresponding to the specified component of the result.
[in] | param_position | Zero-based position of the component to return. |
Implemented in hebench::TestHarness::PartialDataLoader.
|
pure virtual |
getResultFor
[in] | param_data_pack_indices | Collection of indices for data sample to use inside each parameter pack. Number of elements pointed must be, at least, getParameterCount() . |
std::out_of_range | if any index is out of range. |
std::invalid_argument | if param_data_pack_indices is null. |
instance | of std::exception on any other error. |
The shape of result is always 2D: [n = getResultCount(), ?], so, the result for an operation is
where r_i is the index of the NativeDataBuffer
s for the result in the second dimension.
Implemented in hebench::TestHarness::PartialDataLoader, and hebench::TestHarness::DataLoaderCompute.
|
pure virtual |
Computes the index of the result NativeDataBuffer given the indices of the input data.
[in] | param_data_pack_indices | Collection of indices for data sample to use inside each parameter pack. Number of elements pointed must be, at least, parameterCount() . |
std::out_of_range | if any index is out of range. |
std::invalid_argument | if param_data_pack_indices is null. |
The shape of result is always 2D: [n = resultCount(), ?], so, the result for an operation is
where r_i is the index of the data buffer for the result in the second dimension.
By specification definition, the result index (r_i) is computed in a row-major fashion, where the most significant parameter moves faster.
In general:
For example, given the operation op()
that returns a result of the shape [1, ?]:
Then, r_i
, the index in the second dimension that corresponds to the NativeDataBuffer in getResultData(0)
where the result of the operation using the specified indices will be placed, is computed in row-major order as:
then, Result
is actually:
For complete details, see Ordering of Results Based on Input Batch Sizes .
Implemented in hebench::TestHarness::PartialDataLoader.
|
pure virtual |
Total data loaded by this loader in bytes.
Implemented in hebench::TestHarness::PartialDataLoader.
|
static |
Definition at line 23 of file hebench_idata_loader.cpp.