MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / get_devices

Function get_devices

hls_smartInfinity/src/host/host_step_adam.cpp:81–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79
80namespace xcl {
81 std::vector<cl::Device> get_devices(const std::string& vendor_name) {
82 size_t i;
83 cl_int err;
84 std::vector<cl::Platform> platforms;
85 OCL_CHECK(err, err = cl::Platform::get(&platforms));
86 cl::Platform platform;
87 for (i = 0 ; i < platforms.size(); i++){
88 platform = platforms[i];
89 OCL_CHECK(err, std::string platformName = platform.getInfo<CL_PLATFORM_NAME>(&err));
90 if (platformName == vendor_name){
91 std::cout << "Found Platform" << std::endl;
92 std::cout << "Platform Name: " << platformName.c_str() << std::endl;
93 break;
94 }
95 }
96 if (i == platforms.size()) {
97 std::cout << "Error: Failed to find Xilinx platform" << std::endl;
98 exit(EXIT_FAILURE);
99 }
100
101 //Getting ACCELERATOR Devices and selecting 1st such device
102 std::vector<cl::Device> devices;
103 OCL_CHECK(err, err = platform.getDevices(CL_DEVICE_TYPE_ACCELERATOR, &devices));
104 return devices;
105 }
106
107 std::vector<cl::Device> get_xil_devices() {
108 return get_devices("Xilinx");

Callers 1

get_xil_devicesFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected