1 [/===========================================================================
2 Copyright (c) 2013-2015 Kyle Lutz <kyle.r.lutz@gmail.com>
4 Distributed under the Boost Software License, Version 1.0
5 See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt
7 =============================================================================/]
9 [section:tutorial Tutorial]
13 The hello world example gives a simple application that prints the name of
14 the default compute device on the system.
16 The [classref boost::compute::system] class provides access to the OpenCL
17 platforms and devices present on the host system.
19 Compute devices are represented with the
20 [classref boost::compute::device device] class.
22 [import ../example/hello_world.cpp]
25 [endsect] [/ hello world]
27 [section Transferring Data]
29 Before any computation occurs, data must be transferred from the host to the
30 compute device. The generic [funcref boost::compute::copy copy()] function
31 provides a simple interface for transfering data and the generic
32 [classref boost::compute::vector vector<T>] class provides a container for
33 storing data on a compute device.
35 The following example shows how to transfer data from an array on the host to
36 a [classref boost::compute::vector vector<T>] on the device and then back to
37 a separate `std::vector<T>` on the host. At the end of the example both
38 `host_array` and `host_vector` contain the same values which were copied
39 through the memory on the compute device.
41 [import ../example/copy_data.cpp]
44 [endsect] [/ transferring data]
46 [section Transforming Data]
48 The following example shows how to calculate the square-root of a vector of
49 `float`s on a compute device using the [funcref boost::compute::transform
50 transform()] function.
52 [import ../example/transform_sqrt.cpp]
53 [transform_sqrt_example]
55 [endsect] [/ transforming data]
56 [endsect] [/ tutorial ]