class xilinx_apps::cosinesim::CosineSimBase¶
Overview¶
Non-template version of CosineSim class. More…
#include <cosinesim.hpp> class CosineSimBase { public: // construction CosineSimBase(const Options& options, unsigned valueSize); // methods void startLoadPopulation(std::int64_t numVectors); void* getPopulationVectorBuffer(RowIndex& rowIndex); void finishCurrentPopulationVector(void* pbuf); void finishLoadPopulation(); std::vector<Result> matchTargetVector(unsigned numResults, void* elements); };
Detailed Documentation¶
Non-template version of CosineSim class.
This class provides the same functionality as the template-based CosineSim class, except without the type parameter for vector elements. Use this class for situations where a template-based object would be inconvenient, such as when building a wrapper for this API for a language which does not support C++ template implementations.
Construction¶
CosineSimBase(const Options& options, unsigned valueSize)
Constructs a CosineSimBase object.
Parameters:
options |
the configuration options for consine similarity operations. See the Options struct for details. |
valueSize |
the size in bytes of each vector element. 4 is the only supported value for this release. |
Methods¶
void startLoadPopulation(std::int64_t numVectors)
Starts the procedure for loading population vectors to the Alveo accelerator card.
Call this function at the start of loading or reloading all population vectors to the Alveo accelerator card.
Parameters:
numVectors |
the total number of population vectors to load |
void* getPopulationVectorBuffer(RowIndex& rowIndex)
Allocates a buffer for the caller to fill with population vector element values.
This function is the same as CosineSim::getPopulationVectorBuffer(), except that the returned buffer is a type-free void *
instead of an array of a typed element value.
Parameters:
rowIndex |
an integer variable to receive the row index for the buffer |
Returns:
a memory buffer large enough to hold enough integers for one population vector
void finishCurrentPopulationVector(void* pbuf)
Processes a population vector buffer after the caller has filled it with population vector values.
This function is the same as CosineSim::finishCurrentPopulationVector(), except that the buffer for this function has no element type (that is, the buffer is a void *
).
Parameters:
pbuf |
the population vector buffer |
void finishLoadPopulation()
Ends the procedure for loading population vectors to the Alveo accelerator card.
Call this function after loading all population vectors to transfer the population vectors to the Alveo acclerator cards.
std::vector<Result> matchTargetVector(unsigned numResults, void* elements)
Runs a match of a given target vector against all population vectors.
This function is the same as CosineSim::matchTargetVector(), except without the type safety of the array type.
Parameters:
numResults |
the number of match results to return |
elements |
a C array of target vector elements |
Returns:
a std::vector
of Result objects, one per match result