Device Enumeration¶
In order to run any of the models, they must be associated with a particular hardware device. The DeviceManager utility class made available and is used to discover the devices available on a given system.
The following is an example to show how to enumerate ALL available Xilinx devices on a system:
#include <vector> #include "xf_fintech_api.hpp" using namespace xf::fintech; std::vector<Device*> deviceList; Device* pChosenDevice; deviceList = DeviceManager::getDeviceList(); if (deviceList.size() == 0) { printf("No matching devices found\n"); exit(0); } printf("Found %zu matching devices\n", deviceList.size()); //we'll just pick the first device in the list... pChosenDevice = deviceList[0];
This next example shows how to enumerate specific types of Xilinx devices based on their device name. This is useful if you have multiple types of cards installed on your system.
The getDeviceList method takes a string parameter that is used to perform a substring comparison on the full names of each of the available devices.
NOTE - the string parameter is case-sensitive:
#include <vector> #include "xf_fintech_api.hpp" using namespace xf::fintech; std::vector<Device*> deviceList; Device* pChosenDevice; // Get a list of U250s available on the system // (just because our current bitstreams are built for U250s) deviceList = DeviceManager::getDeviceList("u250"); if (deviceList.size() == 0) { printf("No matching devices found\n"); exit(0); } printf("Found %zu matching devices\n", deviceList.size()); //we'll just pick the first device in the list... pChosenDevice = deviceList[0];