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

Function get_devices

hls_smartInfinity/src/host/host_step_sgd.cpp:78–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

get_xil_devicesFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected