• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Getting Started</title>
5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Chapter 1. Boost.Compute">
8<link rel="up" href="../index.html" title="Chapter 1. Boost.Compute">
9<link rel="prev" href="../index.html" title="Chapter 1. Boost.Compute">
10<link rel="next" href="design.html" title="Design">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="design.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<a name="boost_compute.getting_started"></a><a class="link" href="getting_started.html" title="Getting Started">Getting Started</a>
28</h2></div></div></div>
29<div class="toc"><dl class="toc">
30<dt><span class="section"><a href="getting_started.html#boost_compute.getting_started.installation">Installation</a></span></dt>
31<dt><span class="section"><a href="getting_started.html#boost_compute.getting_started.compilation_and_usage">Compilation
32      and Usage</a></span></dt>
33<dt><span class="section"><a href="getting_started.html#boost_compute.getting_started.configuration_macros">Configuration
34      Macros</a></span></dt>
35<dt><span class="section"><a href="getting_started.html#boost_compute.getting_started.support">Support</a></span></dt>
36</dl></div>
37<div class="section">
38<div class="titlepage"><div><div><h3 class="title">
39<a name="boost_compute.getting_started.installation"></a><a class="link" href="getting_started.html#boost_compute.getting_started.installation" title="Installation">Installation</a>
40</h3></div></div></div>
41<p>
42        Boost.Compute is available in Boost starting with version 1.61. Visit <a href="http://www.boost.org/users/download/" target="_top">http://www.boost.org/users/download/</a>
43        for download instructions.
44      </p>
45</div>
46<div class="section">
47<div class="titlepage"><div><div><h3 class="title">
48<a name="boost_compute.getting_started.compilation_and_usage"></a><a class="link" href="getting_started.html#boost_compute.getting_started.compilation_and_usage" title="Compilation and Usage">Compilation
49      and Usage</a>
50</h3></div></div></div>
51<p>
52        Boost.Compute is a header-only library, so no linking is required. To use
53        the library just add the include directory to the compilation flags and link
54        with the system's OpenCL library. For example, with GCC:
55      </p>
56<p>
57</p>
58<pre class="programlisting"><span class="identifier">g</span><span class="special">++</span> <span class="special">-</span><span class="identifier">I</span><span class="special">/</span><span class="identifier">path</span><span class="special">/</span><span class="identifier">to</span><span class="special">/</span><span class="identifier">compute</span><span class="special">/</span><span class="identifier">include</span> <span class="identifier">main</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">-</span><span class="identifier">lOpenCL</span>
59</pre>
60<p>
61      </p>
62<p>
63        All of the Boost.Compute headers can be included with the following directive:
64      </p>
65<p>
66</p>
67<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">compute</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
68</pre>
69<p>
70      </p>
71<p>
72        If you only want to include the core OpenCL wrapper headers (which have minimal
73        dependencies on the rest of Boost), use the following directive:
74      </p>
75<p>
76</p>
77<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">compute</span><span class="special">/</span><span class="identifier">core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
78</pre>
79<p>
80      </p>
81<p>
82        All of the classes and functions in Boost.Compute live in the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">compute</span></code> namespace and can be brought into
83        global scope with:
84      </p>
85<p>
86</p>
87<pre class="programlisting"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">compute</span><span class="special">;</span>
88</pre>
89<p>
90      </p>
91</div>
92<div class="section">
93<div class="titlepage"><div><div><h3 class="title">
94<a name="boost_compute.getting_started.configuration_macros"></a><a class="link" href="getting_started.html#boost_compute.getting_started.configuration_macros" title="Configuration Macros">Configuration
95      Macros</a>
96</h3></div></div></div>
97<p>
98        Boost.Compute provides a number of optional features which can be configured
99        with the following macros.
100      </p>
101<div class="informaltable"><table class="table">
102<colgroup>
103<col>
104<col>
105</colgroup>
106<thead><tr>
107<th>
108                <p>
109                  Macro
110                </p>
111              </th>
112<th>
113                <p>
114                  Description
115                </p>
116              </th>
117</tr></thead>
118<tbody>
119<tr>
120<td>
121                <p>
122                  <code class="literal">BOOST_COMPUTE_DEBUG_KERNEL_COMPILATION</code>
123                </p>
124              </td>
125<td>
126                <p>
127                  When defined, if program::build() fails, the program source and
128                  build log will be written to stdout.
129                </p>
130              </td>
131</tr>
132<tr>
133<td>
134                <p>
135                  <code class="literal">BOOST_COMPUTE_HAVE_THREAD_LOCAL</code>
136                </p>
137              </td>
138<td>
139                <p>
140                  Enables the use of C++11 <code class="literal">thread_local</code> storage
141                  specifier.
142                </p>
143              </td>
144</tr>
145<tr>
146<td>
147                <p>
148                  <code class="literal">BOOST_COMPUTE_THREAD_SAFE</code>
149                </p>
150              </td>
151<td>
152                <p>
153                  Builds Boost.Compute in a thread-safe mode. This requires either
154                  support for C++11 thread-local storage (via defining the <code class="literal">BOOST_COMPUTE_HAVE_THREAD_LOCAL</code>
155                  macro) or linking with Boost.Thread.
156                </p>
157              </td>
158</tr>
159<tr>
160<td>
161                <p>
162                  <code class="literal">BOOST_COMPUTE_USE_OFFLINE_CACHE</code>
163                </p>
164              </td>
165<td>
166                <p>
167                  Enables the offline-cache which stores compiled binaries on disk.
168                  This option requires linking with Boost.Filesystem and Boost.System.
169                </p>
170              </td>
171</tr>
172</tbody>
173</table></div>
174</div>
175<div class="section">
176<div class="titlepage"><div><div><h3 class="title">
177<a name="boost_compute.getting_started.support"></a><a class="link" href="getting_started.html#boost_compute.getting_started.support" title="Support">Support</a>
178</h3></div></div></div>
179<p>
180        Bugs and issues can be reported to the <a href="https://github.com/boostorg/compute/issues?state=open" target="_top">issue
181        tracker</a>.
182      </p>
183<p>
184        There is also a mailing list for users and developers at <a href="https://groups.google.com/forum/#!forum/boost-compute" target="_top">https://groups.google.com/forum/#!forum/boost-compute</a>.
185      </p>
186<p>
187        Look through the <a class="link" href="faq.html" title="Frequently Asked Questions">FAQ</a> to see if you're
188        encountering a known or common issue.
189      </p>
190</div>
191</div>
192<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
193<td align="left"></td>
194<td align="right"><div class="copyright-footer">Copyright © 2013, 2014 Kyle Lutz<p>
195        Distributed under the Boost Software License, Version 1.0. (See accompanying
196        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
197      </p>
198</div></td>
199</tr></table>
200<hr>
201<div class="spirit-nav">
202<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="design.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
203</div>
204</body>
205</html>
206