design.qbk 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. [/===========================================================================
  2. Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com>
  3. Distributed under the Boost Software License, Version 1.0
  4. See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt
  6. =============================================================================/]
  7. [section:design Design]
  8. [section Library Architecture]
  9. The Boost Compute library consists of several different components. The core
  10. layer provides a "thin" C++ wrapper over the OpenCL API. This includes classes
  11. to manage OpenCL objects such as
  12. [classref boost::compute::device device]'s,
  13. [classref boost::compute::device kernel]'s and
  14. [classref boost::compute::device command_queue]'s.
  15. On top of the core layer is a partial implementation of the C++ standard
  16. library providing common containers (e.g.
  17. [classref boost::compute::vector vector<T>],
  18. [classref boost::compute::array array<T, N>]) along with common algorithms
  19. (e.g. [funcref boost::compute::transform transform()] and
  20. [funcref boost::compute::sort sort()]).
  21. The library also provides a number of "fancy" iterators (e.g.
  22. [classref boost::compute::transform_iterator transform_iterator] and
  23. [classref boost::compute::permutation_iterator permutation_iterator]) which
  24. enhance the functionality of the standard algorithms.
  25. Boost.Compute also supplies a number of facilities for interoperation with
  26. other C and C++ libraries. See the section on [link boost_compute.interop
  27. interoperability] for more information.
  28. See the [link boost_compute.reference.api_overview API Overview] section for
  29. a full list of functions, classes, and macros provided by Boost.Compute.
  30. [endsect] [/ library architecture]
  31. [section Why OpenCL]
  32. Boost.Compute uses [@http://en.wikipedia.org/wiki/OpenCL OpenCL] as its
  33. interface for executing code on parallel devices such as GPUs and multi-core
  34. CPUs.
  35. OpenCL was chosen for a number of reasons:
  36. * Vendor-neutral, standard C/C++, and doesn't require a special compiler,
  37. non-standard pragmas, or compiler extensions.
  38. * It is not just another parallel-library abstraction layer, it provides direct
  39. access to the underlying hardware.
  40. * Its runtime compilation model allows for kernels to be optimized and tuned
  41. dynamically for the device present when the application is run rather that the
  42. device that was present when the code was compiled (which is often a separate
  43. machine).
  44. * Using OpenCL allows Boost.Compute to directly interoperate with other OpenCL
  45. libraries (such as VexCL and OpenCV), as well as existing code written with
  46. OpenCL.
  47. * The "thin" C++ wrapper provided by Boost.Compute allows the user to break-out
  48. and write their own custom kernels when the provided APIs are not suitable.
  49. [endsect] [/ why opencl]
  50. [endsect]