Let's see how the equivalent would be implemented using the GPU with Boost Compute. In order to implement it, we have to perform a few extra steps:
- Inform Boost Compute of the content of the Circle struct
- Implement an OpenCL equivalent of the circle_area_cpu() function
- Copy the data back and forth to the GPU
Note that circle_area_gpu() and boost::compute::plus<float> are compiled by the OpenCL driver at runtime, although the binary can be stored for future use.