18 std::vector<cl::Platform> platforms;
21 if (
err == CL_SUCCESS)
23 ATH_MSG_INFO(
"Detected OpenCL platforms: " << platforms.size());
28 return StatusCode::FAILURE;
31 std::vector<cl::Device> allDevices;
34 for (cl::Platform
pf : platforms)
39 ATH_MSG_INFO(
"Platform profile: " <<
pf.getInfo<CL_PLATFORM_PROFILE>());
40 ATH_MSG_INFO(
"Platform vendor: " <<
pf.getInfo<CL_PLATFORM_VENDOR>());
42 pf.getDevices(CL_DEVICE_TYPE_ALL, &allDevices);
43 ATH_MSG_INFO(
"There are " << allDevices.size() <<
" devices in this platform.");
47 bool foundAccelerator =
false;
48 for(
auto device : allDevices)
50 if(device.getInfo<CL_DEVICE_TYPE>() == CL_DEVICE_TYPE_ACCELERATOR)
52 ATH_MSG_INFO(
"Found an FPGA accelerator card in this platform");
54 foundAccelerator =
true;
62 ATH_MSG_ERROR(
"Couldn't find an FPGA accelerator card in this platform");
63 return StatusCode::FAILURE;
72 return StatusCode::SUCCESS;
79 return StatusCode::SUCCESS;
85 std::ifstream bin_file(xclbin, std::ios_base::binary);
89 return StatusCode::FAILURE;
92 bin_file.seekg(0, bin_file.end);
93 unsigned bin_size = bin_file.tellg();
95 bin_file.seekg(0, bin_file.beg);
97 std::vector<char> buf(bin_size);
98 bin_file.read(buf.data(), bin_size);
102 std::vector<cl_int> binaryStatus;
103 cl::Program::Binaries
bins{{buf.data(), bin_size}};
108 if (
err == CL_SUCCESS && binaryStatus.at(0) == CL_SUCCESS)
115 return StatusCode::FAILURE;
118 return StatusCode::SUCCESS;
127 ATH_MSG_FATAL(
item.documentation()<<
" is empty. Please set it to a valid value");
128 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;