20 return StatusCode::SUCCESS;
27 int MAX_DATA_SIZE = 46219;
35 for (
int i = 0; i < 10; i++)
37 ATH_MSG_DEBUG(
"inputTV[" << std::dec << i <<
"] = " << std::hex << spacePointsTV.
inputTV[i]<<std::dec);
44 cl::Buffer acc_inbuff(
m_context, CL_MEM_READ_ONLY, spacePointsTV.
inputTV.size() *
sizeof(uint64_t), NULL, &err);
45 cl::Buffer acc_outbuff(
m_context, CL_MEM_READ_WRITE, spacePointsTV.
inputTV.size() *
sizeof(uint64_t), NULL, &err);
50 acc_kernel.setArg(0, acc_inbuff);
51 acc_kernel.setArg(1, acc_outbuff);
52 acc_kernel.setArg<
int>(2, spacePointsTV.
inputTV.size());
57 acc_queue.enqueueWriteBuffer(acc_inbuff, CL_TRUE, 0, spacePointsTV.
inputTV.size() *
sizeof(uint64_t), spacePointsTV.
inputTV.data(), NULL, NULL);
60 acc_queue.enqueueTask(acc_kernel);
64 std::vector<uint64_t> output(spacePointsTV.
inputTV.size(), 0);
66 acc_queue.enqueueReadBuffer(acc_outbuff, CL_TRUE, 0, spacePointsTV.
inputTV.size() *
sizeof(uint64_t), output.data(), NULL, NULL);
71 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode loadProgram(const std::string &xclbin)
Find the xclbin file and load it into the OpenCL program object.
cl::Program m_program
Program object containing the kernel.
virtual StatusCode initialize() override
Detect the OpenCL devices and prepare OpenCL context.
cl::Context m_context
Context object for the application.
StatusCode precheck(const std::vector< Gaudi::Property< std::string > > &inputs) const
Check if the the desired Gaudi properties are set.
cl::Device m_accelerator
Device object for the accelerator card.
Gaudi::Property< std::string > m_kernelName
Kernel name.
Gaudi::Property< std::string > m_inputTV
Input TestVector.
ToolHandle< TestVectorTool > m_testVectorTool
Tool handle for TestVectorTool.
StatusCode execute(const EventContext &ctx) const override
Should be overriden by derived classes to perform meaningful work.
Gaudi::Property< std::string > m_xclbin
Path and name of the xclbin file.
StatusCode initialize() override
Detect the OpenCL devices and prepare OpenCL context.
Gaudi::Property< std::string > m_refTV
Reference TestVector.
std::vector< uint64_t > refTV
std::vector< uint64_t > inputTV