C++ APIο
-
class SimaMlsocApiο
Public Functions
-
void setLogVerbosity(SiMaLogLevel level) noexceptο
Set the logs level.
- Parameters:
level β Verbosity of the logs
-
vector<string> enumerateDeviceGuids() noexceptο
Enumerates all device guids Lists all sima device in the system.
- Parameters:
void β
- Return values:
Vector β of guids of all sima device in the system
-
shared_ptr<SiMaDevice> openDevice(string guid) noexceptο
Open sima device.
- Parameters:
guid β GUID of the device to be opened
- Return values:
Shared_ptr β SiMaDevice
Load Custom/Pre parsed Model.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
SiMaModel β Parsed Model containing input and output shapes
- Return values:
shared_ptr β SiMaBundle
@breif Will parse given bundle file and load it
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
bundlePath β MPK file path
data_qid β Data queue ID
- Return values:
shared_ptr β SiMaBundle
@breif Will deploy given mpk file and load preparsed bundle
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
bundlePath β path to Sima mpk file
- Return values:
shared_ptr β SiMaBundle
Unload Model.
- Parameters:
shared_ptr β SiMaBundle
- Return values:
sima β error code SiMaErrorCode
Check if runtime app is active on soc.
- Parameters:
shared_ptr β SiMaBundle
- Return values:
bool β true if active else false
Check if runtime app is active on soc.
- Parameters:
shared_ptr β simaDevicePtr
- Return values:
bool β true if active else false
Check if device is already open.
- Parameters:
shared_ptr β simaDevicePtr
- Return values:
bool β true if opened else false
Run synchronous inference Transfers data frames synchronously.
- Parameters:
bundle β Shared ptr of class SiMaBundle
inputTensors β Vector of class SiMaTensor Holds batch of input tensors
metaData β Vector of uint8_t
outputTensors β Vector of class SiMaTensor Holds batch of output tensors
- Return values:
sima β error code SiMaErrorCode
Run asynchronous inference Transfers data frames asynchronously.
- Parameters:
bundle β Shared ptr of class SiMaBundle
inputTensors β Vector of class SiMaTensor Holds batch of input tensors
metaData β Vector of uint8_t
function β Callback function to be called after receiving the response for the txed frame
- Return values:
sima β error code SiMaErrorCode
Close sima device.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β overflow
SiMaErrorCode β success
Reset sima device.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β overflow
SiMaErrorCode β success
Logs the given log string.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
SiMaLogLevel β Shared ptr of SiMaDevice class
file β Name of file of calling function(FILE)
line β Line of the calling function(LINE)
function β Function name of the calling function(__FUNCTION_)
log β Log string that needs to be passed
-
SiMaErrorCode getLastErrorCode()ο
Returns last error code.
- Return values:
Last β error code
Set maximum outstanding i/o requests.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
maxRequests β Maximum number of outstanding requests. maxRequests will number of queue entries in each data queue.
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β success
Get maximum outstanding i/o requests.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
maxRequests β Pointer in which maximum number of outstanding requests will stored by the API. maxRequests will number of queue entries in each data queue.
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β success
Set i/o request abort timeout.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
timeout β i/o request abort timeout. Default value for timeout is 40 seconds. Minimum value for timeout is 2 seconds. Maximum value for timeout is 0xFFFFFFFF.
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β success
Get i/o request abort timeout.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
timeout β Pointer in which i/o request abort timeout will be stored by the API.
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β success
Resets specific data queue.
- Parameters:
simaDevicePtr β Shared ptr of SiMaDevice class
- Return values:
SiMaErrorCode β invalid_input
SiMaErrorCode β success
-
SimaMlsocApi(SimaMlsocApi&) = deleteο
-
void operator=(SimaMlsocApi&) = deleteο
-
SimaMlsocApi(SimaMlsocApi&&) = deleteο
-
void operator=(SimaMlsocApi&&) = deleteο
Public Static Functions
-
static shared_ptr<SimaMlsocApi> getInstance()ο
Get Instance of SimaMlsocApi class.
- Parameters:
void β
- Return values:
Shared_ptr β of SimaMlsocApi class
-
void setLogVerbosity(SiMaLogLevel level) noexceptο
-
class SiMaDeviceο
Contains Device details.
-
class SiMaModel : public SiMaBundleο
Derived class of SiMaBundle. TODO: Obsolete this.
-
template<typename T>
class SiMaTensorο Contains SiMa tensor information.
Public Functions
-
inline SiMaTensor(std::vector<uint32_t> shape)ο
constructor: Allocates a shared_ptr to a malloced blob and assigns free as the deleter for the blob
- Parameters:
shape β Vector of shapes, for example, if you want a tensor of (224, 224, 3) then you need to pass in a vector<uint32_t> shape{224, 224, 3}
-
inline void reset(std::vector<uint32_t> shape)ο
resets memory allocated by simatensor class with help shape vector
- Parameters:
shape β vector of shapes
-
inline SiMaTensor(T *blob, uint32_t blob_size, std::vector<uint32_t> shape)ο
constructor Allocates a shared_ptr to the input blob and assigns free as the deleter for the blob side_effect: This constructor consumes the give malloced memory and will be automatically deleted when all copies of this SiMaTensor is destroyed.
- Parameters:
blob β Pointer to a malloced memory which can be freed with free
blob_size β Size of the malloced memory in bytes
shape β Vector of shapes, for example, if you want a tensor of (224, 224, 3) then you need to pass in a vector<uint32_t> shape{224, 224, 3}
-
inline void reset(T *blob, uint32_t blob_size, std::vector<uint32_t> shape)ο
Resets memory allocated by SiMaTensor class with help memory blob, memory blob size and shape vector.
- Parameters:
blob β Pointer to memeroy blob
blob_size β Memory blob size
shape β Vector of shapes
-
inline std::shared_ptr<T> getPtr() constο
Get memory blob pointer.
- Parameters:
void β
- Return values:
Shared β pointer to memory blob
-
inline std::vector<uint32_t> getShape() constο
Get shape vector.
- Parameters:
void β
- Return values:
Vector β of shape
-
inline uint32_t getSizeInBytes() constο
Get size of memory blob in bytes.
- Parameters:
void β
- Return values:
Size β of memory blob in bytes
-
inline uint32_t getSeqId() constο
Get sequence ID of tensor.
- Parameters:
void β
- Return values:
Sequence β ID of tensor
-
inline uint32_t getAppId() constο
Get application ID of the tensor.
- Parameters:
void β
- Return values:
Application β ID of the tensor
-
inline void setSeqId(uint32_t seq_id)ο
Get sequence ID of tensor.
- Parameters:
uint32_t β Sequence ID of the tensor
- Return values:
void β
-
inline void setAppId(uint32_t app_id)ο
Set application ID of the tensor.
- Parameters:
uint32_t β Application ID of the tensor
- Return values:
void β
-
inline SiMaTensor(std::vector<uint32_t> shape)ο