Register a Target
Once the host is up and running with all the needed software. You will need to register your GitLab Runner to the dAIEdge-VLab. This step is not yet automated, thus, you will need to contact the dAIEdge-VLab team for them to give you the register token.
Request a target UID
The target UID is used to identify the target in the dAIEdge-VLab. This UID is registered in the blockchain and is used to identify the results produced by the target. This UID must be unique and provided by the dAIEdge-VLab register service. If the target UID is not genuine, the dAIEdge-VLab scheduled benchmark will not run and the results will not be stored in the blockchain.
target.json file of your host configuration file.Gather mandatory information
The mandatory information are :
Target name: The name of the target, mainly the processor/accelerator reference.Runtime: The runtime used by the developed target.Extensions: File extensions supported by the Runtime as input.Description: A brief description of the hardware and runtime that compose the target. Focused mainly on the elements relevant for the dAIEdge-VLab (memory, specific hardware for AI application).
Register the target
To register a target using the API, you can use the Python client provided by the dAIEdge-VLab to interact with the API. Have a look at the Python client here to understand how to set it up and use it. You can use the following code snippet to register a target using the API. Make sure to fill in the necessary information for your target and to provide the correct path to the setup.yaml file that contains the API credentials.
Create the ResourceConfigurator class that will be used to register the target as follows:
from daiedge_vlab import dAIEdgeVLabAPI
from daiedge_vlab.resources import ResourceConfigurator
api = dAIEdgeVLabAPI("setup.yaml")
configurator = ResourceConfigurator(api)Then, check if the target family and runtime already exist with the following code snippet. You will need to use the family and runtime name to register your target.
configurator.get_available_edge_device_families()
configurator.get_available_runtimes_families()This output two tables with the available families and runtimes. If you find a family and runtime that match your target, you can use them to register your target. If not, you can create a new family and runtime using the following code snippet :
configurator.create_edge_device_family("test_family", "Test family", "Test family description")
configurator.create_runtime_family("test_runtime", "Test runtime", "Test runtime description", supported_file_extensions=["onnx", "tflite"])Finally, you can register your target using the following code snippet :
configurator.create_edge_device_instance(
"test_family",
["test_runtime"], # Multiple runtimes can be associated to the same target if needed
"My personal notes for this instance",
"The target serial number this is optional."
)This will create the new target instance and will return the target UID that you will need to use in the target.json file of your host configuration file.
You can list all the registered targets using the following code snippet :
r = configurator.get_my_edge_device_instances()
for instance in r:
print(instance["inventory_id"])Setup the target.json file
Once the target is registered, you will need to fill in the target.json file with the necessary information for your target. The most important information is the target_uid (or inventory_id) that you will get from the registration process. This UID is used to identify your target in the dAIEdge-VLab and to link the results produced by your target to the correct target in the inventory.
To retrive a template of the target.json file, you can use the following code snippet. This will provide you with a template that you can fill in with the necessary information for your target.
import json
config = configurator.get_default_configuration("inventory_id")
print(json.dumps(config, indent=4))Once you have the template, have a look at the target configuration file documentation to understand how to fill in the necessary information for your target.
Access the configuration
The target.json file is located in the nomad folder of the cloned repository (see Setup a Host). This file is used to configure the target and to provide the necessary information for the dAIEdge-VLab to run the benchmarks on the target. You will need to fill in this file with the necessary information for your target.
This is where you use the template provided by the API or the web interface with the necessary information for your target.
target.json file is not mandatory, you can choose to put it in another location as long as you provide the correct path in the /etc/nomad/nomad.hcl configuration file of the Nomad agent.Test the configuration
Once you have filled the target.json file with the necessary information, you should be able to see your newly integrated target as a selectable target in the web interface. Try to benchmark it, you should be able to see the results of the benchmark in the web interface. As nothing is implemented yet, the results should be empty or show some errors.
If you picked an existing family and runtime, you should try to run the benchmark using the target_uid provided by the dAIEdge-VLab to force the use of your target and not the existing one. If you don’t do that, the dAIEdge-VLab may use an existing target that have the same family and runtime as yours, and you won’t be able to see the results of your target in the web interface. To do that, you should launch the benchmark using the Python Client and specify the target_uid in the request.
Troubleshooting
Common issues that you might encounter include:
- The target is not visible in the web interface : This may be due to an error in the
target.jsonfile. Make sure that the file is valid and that all the necessary information is provided. You can use a json validator to check the validity of your json file.
If you run the command systemctl status nomad on the host machine, you should be able to see the logs of the Nomad agent. If there is an error in the target.json file, you should see an error message indicating that the plugin edgedevice cannot load the inventory. Fix the error in the target.json file and saving it should allow the Nomad agent to load the inventory.
The target.json file is periodically read by the Nomad agent, so if you make changes to the file, you should wait a few seconds for the Nomad agent to read the file and to update the inventory.
Once the target is registered and the target.json file is filled with the necessary information, you can start implementing the benchmarking scripts and test your implementation by simulating the pipeline locally or by running the benchmarks on the dAIEdge-VLab. See the next steps for more information on how to implement the benchmarking scripts and how to test your implementation.