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

Function get_devices

hls_smartInfinity/src/host/host_step_adagrad.cpp:79–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

get_xil_devicesFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected