File: manual-installation.html

package info (click to toggle)
viennacl 1.7.1%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 114,428 kB
  • sloc: sh: 454,206; cpp: 109,088; ansic: 2,103; perl: 104; makefile: 22
file content (320 lines) | stat: -rw-r--r-- 26,825 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ViennaCL - The Vienna Computing Library: Installation</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ViennaCL - The Vienna Computing Library
   &#160;<span id="projectnumber">1.7.1</span>
   </div>
   <div id="projectbrief">Free open-source GPU-accelerated linear algebra and solver library.</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('manual-installation.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Installation </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This chapter shows how ViennaCL can be integrated into a project and how the examples are built. The necessary steps are outlined for several different platforms, but we could not check every possible combination of hardware, operating system and compiler. If you experience any trouble, please write to the maining list at <br/>
 </p>
<center> <code><a href="#" onclick="location.href='mai'+'lto:'+'vie'+'nn'+'acl'+'-s'+'upp'+'or'+'t@l'+'is'+'ts.'+'so'+'urc'+'ef'+'org'+'e.'+'net'; return false;">vienn<span style="display: none;">.nosp@m.</span>acl-<span style="display: none;">.nosp@m.</span>suppo<span style="display: none;">.nosp@m.</span>rt@l<span style="display: none;">.nosp@m.</span>ists.<span style="display: none;">.nosp@m.</span>sour<span style="display: none;">.nosp@m.</span>cefor<span style="display: none;">.nosp@m.</span>ge.n<span style="display: none;">.nosp@m.</span>et</a></code> </center><h1><a class="anchor" id="manual-installation-dependencies"></a>
Dependencies</h1>
<p>ViennaCL uses the CMake build system for multi-platform support. Thus, before you proceed with the installation of ViennaCL, make sure you have a recent version of CMake installed.</p>
<p>To use ViennaCL, only a fairly recent C++ compiler (e.g. GCC version 4.2.x or above and Visual C++ 2008 and 2010 are known to work) is required.</p>
<p>The full potential of ViennaCL is available with the following optional libraries:</p>
<ul>
<li>CMake <a class="el" href="citelist.html#CITEREF_cmake">[8]</a> as build system (optional, but highly recommended for building examples)</li>
<li>OpenCL <a class="el" href="citelist.html#CITEREF_khronoscl">[18]</a> <a class="el" href="citelist.html#CITEREF_nvidiacl">[24]</a> for accessing compute devices (GPUs); see <a class="el" href="manual-installation.html#manual-installation-opencl">the section on OpenCL</a> for details.</li>
<li>CUDA <a class="el" href="citelist.html#CITEREF_nvidiacuda">[23]</a> for using CUDA-accelerated operations.</li>
<li>OpenMP <a class="el" href="citelist.html#CITEREF_openmp">[25]</a> for directive-based parallelism on CPUs.</li>
<li>ublas (shipped with Boost <a class="el" href="citelist.html#CITEREF_boost">[6]</a> ) provides the same interface as ViennaCL and allows to switch between CPU and GPU seamlessly, see the tutorials.</li>
<li>Armadillo <a class="el" href="citelist.html#CITEREF_armadillo">[1]</a>, Eigen <a class="el" href="citelist.html#CITEREF_eigen">[11]</a>, or MTL 4 <a class="el" href="citelist.html#CITEREF_mtl4">[22]</a> can be used to fill ViennaCL types directly. Moreover, the iterative solvers in ViennaCL can directly be used with objects from these libraries.</li>
</ul>
<h1><a class="anchor" id="manual-installation-generic"></a>
Generic Installation of ViennaCL</h1>
<p>Since ViennaCL is a header-only library, it is sufficient to copy the folder <code>viennacl/</code> either into your project folder or to your global system include path. On Unix-based systems, this is often <code>/usr/include/</code> or <code>/usr/local/include/</code>. If the OpenCL headers are not installed on your system, you should repeat the above procedure with the folder <code>CL/</code>.</p>
<p>The situation on Windows strongly depends on your development environment. We advise users to consult the documentation of their compiler on how to set the include path correctly. With Visual Studio this is usually something like <code>C:\Program Files\Microsoft Visual Studio 9.0\VC\include</code> and can be set in <code>Tools -&gt; Options -&gt; Projects and Solutions -&gt; VC++&ndash;Directories</code>. For using the CUDA backend, make sure that the CUDA SDK is installed properly and supports your host compiler suite. If you intend to use the OpenCL backend, the include and library directories of your OpenCL SDK should also be added there.</p>
<p>Note: If multiple OpenCL libraries are available on the host system, ViennaCL uses the first platform returned by the system by default. Consult <a class="el" href="manual-multi-device.html">the chapter on using multiple devices</a> for configuring the use of other platforms.</p>
<h1><a class="anchor" id="manual-installation-opencl"></a>
Get the OpenCL Library</h1>
<p>In order to compile and run OpenCL applications, a corresponding library (e.g. <code>libOpenCL.so</code> under Unix based systems) is required. If OpenCL is to be used with GPUs, suitable drivers have to be installed. This section describes how these can be acquired. For Mac OS X systems there is no need to install an OpenCL capable driver and the corresponding library. The OpenCL library is already present if a suitable graphics card is present. The setup of ViennaCL on Mac OS X is outlined <a class="el" href="manual-installation.html#manual-installation-examples-macos">Mac OS X</a> here.</p>
<h2><a class="anchor" id="manual-installation-opencl-nvidia"></a>
NVIDIA Driver</h2>
<p>NVIDIA provides the OpenCL library with the GPU driver. Therefore, if an NVIDIA driver is installed on the system, the OpenCL library is <em>usually</em> installed as well. However, not all of the released drivers contain the OpenCL library. A driver known to support OpenCL and hence providing the required library is <code>260.19.21</code>. Note that the latest NVIDIA drivers no longer include the OpenCL headers anymore. Therefore, the official OpenCL headers from the Khronos group <a class="el" href="citelist.html#CITEREF_khronoscl">[18]</a> are also shipped with ViennaCL in the folder <code>CL/</code> to simplify the installation process.</p>
<h2><a class="anchor" id="manual-installation-opencl-amd"></a>
AMD Accelerated Parallel Processing SDK (formerly Stream SDK)</h2>
<p>AMD has provided the OpenCL library with the Accelerated Parallel Processing (APP) SDK~<a class="el" href="citelist.html#CITEREF_atistream">[3]</a> earlier. Currently the OpenCL library is also included in the GPU driver. In doubt, make sure you have both the AMD APP SDK and the latest GPU driver installed. The latest tested version of the AMD APP SDK is 2.9, yet newer releases usually work as well. If ViennaCL is to be run on multi-core CPUs with OpenCL, no additional GPU driver is required. The installation notes of the APP SDK provides guidance throughout the installation process <a class="el" href="citelist.html#CITEREF_atistreamdocu">[4]</a>.</p>
<p>If the AMD APP SDK is installed in a non-system wide location on UNIX-based systems, be sure to add the OpenCL library path to the <code>LD_LIBRARY_PATH</code> environment variable. Otherwise, linker errors will occur as the required library cannot be found.</p>
<p>Note that the AMD APP SDK may not provide OpenCL certified double precision support <a class="el" href="citelist.html#CITEREF_atidouble">[2]</a> on some older GPUs.</p>
<dl class="section warning"><dt>Warning</dt><dd><b>Unfortunately, some versions of the AMD APP SDK are known to have bugs. For example, APP SDK 2.7 on Linux causes BiCGStab to fail on some devices.</b></dd></dl>
<h2><a class="anchor" id="manual-installation-opencl-intel"></a>
INTEL OpenCL SDK</h2>
<p>ViennaCL works fine with the INTEL OpenCL SDK on Windows and Linux. The correct linker path is set automatically in <code>CMakeLists.txt</code> when using the CMake build system.</p>
<h1><a class="anchor" id="manual-installation-backends"></a>
Enabling OpenMP, OpenCL, or CUDA Backends</h1>
<p><b>The default behavior since ViennaCL 1.4.0 is to use the CPU backend. OpenCL and CUDA backends need to be enabled by appropriate preprocessor #<code>define</code>s.</b></p>
<center> <table class="doxtable">
<tr>
<th>Preprocessor #<code>define</code> </th><th>Default computing backend </th></tr>
<tr>
<td>none </td><td>CPU, single-threaded </td></tr>
<tr>
<td><code>VIENNACL_WITH_OPENMP</code> </td><td>CPU with OpenMP (compiler flags required) </td></tr>
<tr>
<td><code>VIENNACL_WITH_OPENCL</code> </td><td>OpenCL </td></tr>
<tr>
<td><code>VIENNACL_WITH_CUDA</code> </td><td>CUDA </td></tr>
</table>
</center><p>The preprocessor constants can be either defined at the beginning of the source file (prior to any ViennaCL-includes), or passed to the compiler as command line argument. For example, on <code>g++</code> the respective command line option for enabling the OpenCL backend is <code>-DVIENNACL_WITH_OPENCL</code>. <b>Note that CUDA requires the <code>nvcc</code> compiler.</b> Furthermore, the use of OpenMP usually requires additional compiler flags (on <code>g++</code> this is for example <code>-fopenmp</code>).</p>
<p>Multiple backends can be used simultaneously. In such case, CUDA has higher priority than OpenCL, which has higher priority over the CPU backend when it comes to selecting the default backend.</p>
<h1><a class="anchor" id="manual-installation-examples"></a>
Building the Examples and Tutorials</h1>
<p>ViennaCL provides several examples for users to get started quickly. A list of examples and tutorials including their dependencies are as follows:</p>
<center> <table class="doxtable">
<tr>
<th>Example/Tutorial </th><th>Dependencies  </th></tr>
<tr>
<td><code><a class="el" href="amg_8cpp.html">tutorial/amg.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="armadillo-with-viennacl_8cpp.html">tutorial/armadillo-with-viennacl.cpp</a></code></td><td>Armadillo  </td></tr>
<tr>
<td><code><a class="el" href="bandwidth-reduction_8cpp.html">tutorial/bandwidth-reduction.cpp</a></code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2bisect_8cpp.html">tutorial/bisect.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2blas1_8cpp.html">tutorial/blas1.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2blas2_8cpp.html">tutorial/blas2.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2blas3_8cpp.html">tutorial/blas3.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="custom-context_8cpp.html">tutorial/custom-context.cpp</a></code> </td><td>OpenCL  </td></tr>
<tr>
<td><code>tutorial/custom-cuda.cu</code> </td><td>CUDA  </td></tr>
<tr>
<td><code><a class="el" href="custom-kernels_8cpp.html">tutorial/custom-kernels.cpp</a></code> </td><td>OpenCL  </td></tr>
<tr>
<td><code><a class="el" href="eigen-with-viennacl_8cpp.html">tutorial/eigen-with-viennacl.cpp</a></code> </td><td>Eigen  </td></tr>
<tr>
<td><code><a class="el" href="fft_8cpp.html">tutorial/fft.cpp</a>/cu</code> </td><td>OpenCL  </td></tr>
<tr>
<td><code><a class="el" href="iterative_8cpp.html">tutorial/iterative.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="iterative-armadillo_8cpp.html">tutorial/iterative-armadillo.cpp</a></code> </td><td>Armadillo  </td></tr>
<tr>
<td><code><a class="el" href="iterative-custom_8cpp.html">tutorial/iterative-custom.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="iterative-ublas_8cpp.html">tutorial/iterative-ublas.cpp</a></code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="iterative-eigen_8cpp.html">tutorial/iterative-eigen.cpp</a></code> </td><td>Eigen  </td></tr>
<tr>
<td><code><a class="el" href="iterative-mtl4_8cpp.html">tutorial/iterative-mtl4.cpp</a></code> </td><td>MTL  </td></tr>
<tr>
<td><code><a class="el" href="lanczos_8cpp.html">tutorial/lanczos.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="least-squares_8cpp.html">tutorial/least-squares.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="libviennacl_8cpp.html">tutorial/libviennacl.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="matrix-free_8cpp.html">tutorial/matrix-free.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="matrix-range_8cpp.html">tutorial/matrix-range.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="mtl4-with-viennacl_8cpp.html">tutorial/mtl4-with-viennacl.cpp</a></code> </td><td>MTL  </td></tr>
<tr>
<td><code><a class="el" href="multithreaded_8cpp.html">tutorial/multithreaded.cpp</a>/cu</code> </td><td>Boost  </td></tr>
<tr>
<td><code><a class="el" href="multithreaded__cg_8cpp.html">tutorial/multithreaded_cg.cpp</a>/cu</code> </td><td>Boost  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2nmf_8cpp.html">tutorial/nmf.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="power-iter_8cpp.html">tutorial/power-iter.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="tutorial_2qr_8cpp.html">tutorial/qr.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="tutorial_2scheduler_8cpp.html">tutorial/scheduler.cpp</a></code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="spai_8cpp.html">tutorial/spai.cpp</a></code> </td><td>OpenCL, uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2sparse_8cpp.html">tutorial/sparse.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="examples_2tutorial_2structured-matrices_8cpp.html">tutorial/structured-matrices.cpp</a></code> </td><td>OpenCL, uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="tql2_8cpp.html">tutorial/tql2.cpp</a>/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="vector-range_8cpp.html">tutorial/vector-range.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="viennacl-info_8cpp.html">tutorial/viennacl-info.cpp</a></code> </td><td>OpenCL  </td></tr>
<tr>
<td><code>tutorial/wrap-cuda-buffer.cu</code> </td><td>CUDA  </td></tr>
<tr>
<td><code><a class="el" href="wrap-host-buffer_8cpp.html">tutorial/wrap-host-buffer.cpp</a></code> </td><td>-  </td></tr>
<tr>
<td><code>benchmarks/blas3.cpp/cu</code> </td><td>-  </td></tr>
<tr>
<td><code><a class="el" href="opencl_8cpp.html">benchmarks/opencl.cpp</a></code> </td><td>OpenCL  </td></tr>
<tr>
<td><code><a class="el" href="solver_8cpp.html">benchmarks/solver.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code><a class="el" href="examples_2benchmarks_2sparse_8cpp.html">benchmarks/sparse.cpp</a>/cu</code> </td><td>uBLAS  </td></tr>
<tr>
<td><code>benchmarks/vector.cpp/cu</code> </td><td>-  </td></tr>
</table>
<p><b>Dependencies for the examples in the <code>examples/</code> folder. Examples using the CUDA-backend use the <code>.cu</code> file extension. Note that all examples can be built and run using either of the CPU, OpenCL, and CUDA backend (if .cu file available) unless an explicit OpenCL-dependency is stated.</b> </center><p>These examples can be built and run either manually, or using the provided CMake build setup. We recommend the CMake builds for all first-time users of ViennaCL.</p>
<dl class="section note"><dt>Note</dt><dd>It is not required to build any of the examples. Feel free to just take the <code>viennacl/</code> source folder and start your project!</dd></dl>
<h2><a class="anchor" id="manual-installation-examples-manual"></a>
Manual Builds (no CMake)</h2>
<p>The manual way of building the examples and tutorials is to directly invoke the compiler. For example, to build `examples/tutorial/amg.cpp using GCC or Clang it is enough to issue </p>
<pre class="fragment">$&gt; g++ /path/to/ViennaCL/examples/tutorial/amg.hpp -I/path/to/ViennaCL
</pre><p>where '/path/to/ViennaCL/` needs to be replaced with a proper absolute or relative path. This will then result in a binary executable <code>a.out</code>, in which the CPU-backend of ViennaCL will be used. To enable OpenCL or CUDA, pass the additional flags <code>-DVIENNACL_WITH_OPENCL</code> or <code>-DVIENNACL_WITH_CUDA</code>. In the former case you also need to pass <code>-lOpenCL</code> and eventually <code>-L/path/to/libOpenCL.so</code>. In the latter case you need to use the NVIDIA compiler wrapper <code>nvcc</code> instead of GCC or Clang in order to properly compile all CUDA kernels.</p>
<p>In a GUI-assisted integrated development environment (IDE) such as Visual Studio you need to set the include-directory for the source file appropriately. Please consult your IDE's manual for further information on how to do that.</p>
<p>Since such a manual compilation gets fairly tedious quickly, we recommend for a start to use the CMake-assisted builds described next.</p>
<h2><a class="anchor" id="manual-installation-examples-cmake"></a>
CMake-Assisted Builds</h2>
<p>For building the examples, we suppose that CMake is properly set up on your system.</p>
<p>Before building the examples, customize the CMake setup according to your needs. Per default, all examples using uBLAS, Eigen and MTL4 are turned off. Please enable the respective examples based on the libraries available on your machine. A brief overview of the most important flags is as follows:</p>
<center> <table class="doxtable">
<tr>
<th>CMake Flag </th><th><p class="starttd">Purpose </p>
<p class="endtd"></p>
</th></tr>
<tr>
<td><code>ENABLE_CUDA</code> </td><td>Builds examples with the CUDA backend enabled </td></tr>
<tr>
<td><code>ENABLE_OPENCL</code> </td><td>Builds examples with the OpenCL backend enabled </td></tr>
<tr>
<td><code>ENABLE_OPENMP</code> </td><td><p class="starttd">Builds examples with OpenMP for the CPU backend enabled</p>
<p class="endtd"></p>
</td></tr>
<tr>
<td><code>ENABLE_EIGEN</code> </td><td>Builds examples depending on Eigen </td></tr>
<tr>
<td><code>ENABLE_MTL4</code> </td><td>Builds examples depending on MTL </td></tr>
<tr>
<td><code>ENABLE_UBLAS</code> </td><td>Builds examples depending on uBLAS </td></tr>
</table>
</center><h2><a class="anchor" id="manual-installation-examples-linux"></a>
Linux</h2>
<p>To build the examples, open a terminal and change to: </p>
<pre class="fragment">$&gt; cd /your-ViennaCL-path/build/
</pre><p>Execute </p>
<pre class="fragment">$&gt; cmake ..
</pre><p>to obtain a Makefile and type </p>
<pre class="fragment">$&gt; make
</pre><p>to build the examples. If some of the dependencies in the table of examples above are not fulfilled, you can build each example separately: </p>
<pre class="fragment">$&gt; make blas1             #builds the blas level 1 tutorial
$&gt; make vectorbench       #builds vector benchmarks
</pre><p>Speed up the building process by using jobs, e.g. <code>make -j4</code>.</p>
<p>Execute the examples from the <code>build/</code> folder as follows: </p>
<pre class="fragment">$&gt; examples/tutorial/blas1
$&gt; examples/benchmarks/vectorbench
</pre><p>Note that all benchmark executables carry the suffix <code>bench</code>.</p>
<p>You may also use the CMake-GUI via <code>cmake-gui ..</code> within the <code>build/</code> folder in order to enable or disable optional libraries conveniently.</p>
<h2><a class="anchor" id="manual-installation-examples-macos"></a>
Mac OS X</h2>
<p>For the GCC compiler suite the Xcode <a class="el" href="citelist.html#CITEREF_xcode">[29]</a> package has to be installed. To install CMake and Boost, external portation tools have to be used, for example, Fink <a class="el" href="citelist.html#CITEREF_fink">[12]</a> , DarwinPorts <a class="el" href="citelist.html#CITEREF_darwinports">[10]</a> , or MacPorts <a class="el" href="citelist.html#CITEREF_macports">[21]</a> . Such portation tools provide the aforementioned packages, CMake and Boost, for Mac OS.</p>
<p>If the CMake build system has problems detecting your Boost libraries, determine the location of your Boost folder. Provide the path using either the CMake GUI, or by passing <code>-DBOOST_DIR=/path/to/boost/</code> to the CMake executable.</p>
<p>The build process of ViennaCL on Mac OS is similar to Linux.</p>
<h2><a class="anchor" id="manual-installation-examples-windows"></a>
Windows</h2>
<p>In the following the procedure is outlined for Visual Studio: Assuming that an OpenCL SDK and CMake are already installed, Visual Studio solution and project files can be created using CMake as follows:</p>
<ul>
<li>Open the CMake GUI.</li>
<li>Set the ViennaCL base directory as source directory.</li>
<li>Set the <code>build/</code> directory as build directory.</li>
<li>Click on 'Configure' and select the appropriate generator (e.g. Visual Studio 9 2008).</li>
<li>If you set <code>ENABLE_CUDA</code>, <code>ENABLE_EIGEN</code>, <code>ENABLE_MTL4</code>, <code>ENABLE_UBLAS</code>, or <code>ENABLE_OPENCL</code> and the paths cannot be found, please select the advanced view and provide the required paths manually. You may have to specify the linker path for Boost manually within your Visual Studio IDE.</li>
<li>Click again on 'Configure'. You should not receive an error at this point.</li>
<li>Click on 'Generate'.</li>
<li>The project files can now be found in the ViennaCL build directory, where they can be opened and compiled with Visual Studio (provided that the include and library paths are set correctly.</li>
</ul>
<p>The examples and tutorials should be executed from within the <code>build/</code> directory of ViennaCL, otherwise the sample data files cannot be found. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Wed Jan 20 2016 22:32:44 for ViennaCL - The Vienna Computing Library by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>