![]() |
liblarod
3.6.78
|
larod-client is a small program that uses the larod API in the same way as a typical application would do. Command line options and an interactive mode makes it easy to interact with the larod service. Some use case examples are listed in this file; please refer to the tool help (--help option) and ultimately the source code for nitty-gritty-details.
A useful sanity check of larod service running is to just list the available larodDevices in the system:
Also the backend names listed are the identifiers that should be passed as the backend name as the -c option in most other larod-client use-cases.
Here is an example of loading a model and executing an inference job using the TFLite CPU backend:
This will load the MobileNetV2 model on the TFLite CPU backend, then perform one inference of the test image goldfish_224x224_uint8_RGB.bin. The binary output from the model is written to the file goldfish-result.bin.
It is possible to instruct larod-client to generate random input data for you, instead of having to supply an input file. This can be achieved by passing an empty string as input file for a job:
This command will run an inference using random data as input, and write the output from this inference to the file random-data-output.bin.
The option --random-seed allows you to specify the seed number to use for the random input data. If this option is omitted larod-client will use the system clock as seed. For a given seed the random numbers generated will always be the same. This can be useful for debugging.
larod-client can be used to benchmark job times for a model. Here is an example:
Command line above loads the model and executes 1000 inference jobs on the model, then reports the average time per job.
One can achieve higher utilization (and thus performance) by ensuring that the device always has a job request ready after finishing a previous one. This can be accomplished by running the jobs asynchronously (i.e. queuing up the requests) with option -q:
One can instruct larod to cache tensors for a model. This often results in fewer maintenance calls, yielding slightly higher performance and load. The options -X and -Y tracks the input and output tensors, respectively:
larod-client can be instructed to run jobs continuously. This can be used to add load to a system, e.g. to measure power consumption and temperature for a particular device. Set number-of-rounds to 0 to run continuously (note the use of options -q, -X and -Y for maximum load, see section ["Running asynchronously for maximum device utilization"](#running-asynchronously-for-maximum-device-utilization) and
["Minimizing overhead by tracking the tensors"](#minimizing-overhead-by-tracking-the-tensors) above):
One can use larod-client to execute an image pre-processing job as well. Here is an example using the libyuv backend (cpu-proc) to convert an image from nv12/YCbCr to RGB interleaved:
Image pre-processing models models are specified by supplying set of key/value pairs when loading the model: these key/value pairs are supplied by the -b option. Please refer to the preprocessing.md documentation for details on how to specify a pre-processing model.
The "interactive mode" in larod-client can be started by providing the -r option. The interactive mode parses the input provided by the user on stdin and parses the lines like they were passed as command-line options. Here is an example interactive session:
--interactive option in larod-client?The interactive modes uses libreadline to read the commands from stdin. This library is not always present e.g. when building for an embedded target, thus the larod meson files are written to pick up libreadline optionally. If it's present in build environment the interactive mode will be included when building larod-client. Please check that libreadline is present in your build environment if you want to use the interactive mode.
larod supports using dma-buf buffers for input and output. larod-client can allocate and run jobs with such buffers. Here is an example of running a convolutional neural network inference on Ambarella CV25 DLPU using larod-allocated dma-buf for input and output:
The options --output-buf-type and --input-buf-type are used to select the types of buffers. When types other than larod-disk are used, larod-client will allocate buffers and then copy data into the input buffer(s) before starting the job. Similarly, output data in the temporary buffers is written to disk when the job is done. Please refer to dma-buf.md for details on the buffer handling.