This file is indexed.

/usr/share/doc/libclblas-doc/html/example_sspr2_8c-example.html is in libclblas-doc 2.10-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
<!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.11"/>
<title>clBLAS: example_sspr2.c</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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="/usr/share/javascript/mathjax/MathJax.js"></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 id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">clBLAS
   &#160;<span id="projectnumber">2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <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>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</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">example_sspr2.c</div>  </div>
</div><!--header-->
<div class="contents">
<p>Example of how to use the <a class="el" href="group__SPR2.html#ga3cdfb1ef40a2212ffd70de92e6b5002c">clblasSspr2</a> function.</p>
<div class="fragment"><div class="line"><span class="comment">/* ************************************************************************</span></div><div class="line"><span class="comment"> * Copyright 2013 Advanced Micro Devices, Inc.</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><span class="comment"> * you may not use this file except in compliance with the License.</span></div><div class="line"><span class="comment"> * You may obtain a copy of the License at</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><span class="comment"> *</span></div><div class="line"><span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><span class="comment"> * See the License for the specific language governing permissions and</span></div><div class="line"><span class="comment"> * limitations under the License.</span></div><div class="line"><span class="comment"> * ************************************************************************/</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;sys/types.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"></div><div class="line"><span class="comment">/* Include CLBLAS header. It automatically includes needed OpenCL header,</span></div><div class="line"><span class="comment"> * so we can drop out explicit inclusion of cl.h header.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="preprocessor">#include &lt;clBLAS.h&gt;</span></div><div class="line"></div><div class="line"><span class="comment">/* This example uses predefined matrices and their characteristics for</span></div><div class="line"><span class="comment"> * simplicity purpose.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="group__TYPES.html#ga1dbfdbd0c5cdb78aa8de5c98b3a9a3a6">clblasOrder</a> order = <a name="a0"></a><a class="code" href="group__TYPES.html#gga328154140ca4c90e84db33436448ee57aaf3d27934570f7ea906670a8958e6c46">clblasRowMajor</a>;</div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">size_t</span> N = 5;</div><div class="line"><span class="keyword">static</span> cl_float alpha = 10.0;</div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="group__TYPES.html#gaa02dfe8aa057f00fd6014b6ac80cfdff">clblasUplo</a> uplo = <a name="a1"></a><a class="code" href="group__TYPES.html#ggac5c0222eae342844f95ad6efc9c49837a52ecf6a06c8d6b505fb27dfdd5ed3887">clblasUpper</a>;</div><div class="line"></div><div class="line"><span class="keyword">static</span> cl_float AP[] = {</div><div class="line">    01.0, 02.0, 03.0, 04.0, 05.0,</div><div class="line">          06.0, 07.0, 08.0, 09.0,</div><div class="line">                10.0, 11.0, 12.0,</div><div class="line">                      13.0, 14.0,</div><div class="line">                            15.0</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> cl_float X[] = {</div><div class="line">    1.0,</div><div class="line">    2.0,</div><div class="line">    3.0,</div><div class="line">    4.0,</div><div class="line">    5.0</div><div class="line">};</div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> incx = 1;</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> cl_float Y[] = {</div><div class="line">    5.0,</div><div class="line">    4.0,</div><div class="line">    3.0,</div><div class="line">    2.0,</div><div class="line">    1.0</div><div class="line">};</div><div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> incy = 1;</div><div class="line"></div><div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span></div><div class="line">printResult(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    <span class="keywordtype">size_t</span> i, j, off;</div><div class="line">    printf(<span class="stringliteral">&quot;\nResult:\n&quot;</span>);</div><div class="line"></div><div class="line">    off = 0;</div><div class="line">    <span class="keywordflow">for</span> (i = 0; i &lt; N; i++) {</div><div class="line">        <span class="keywordflow">for</span>(j = 0; j &lt; N; j++)  {</div><div class="line">            <span class="keywordflow">if</span>( ( (uplo == <a class="code" href="group__TYPES.html#ggac5c0222eae342844f95ad6efc9c49837a52ecf6a06c8d6b505fb27dfdd5ed3887">clblasUpper</a>) &amp;&amp; (i &gt; j)) || ((uplo == <a name="a2"></a><a class="code" href="group__TYPES.html#ggac5c0222eae342844f95ad6efc9c49837ae317d7a34f51ac118fb8e93039114d9f">clblasLower</a>) &amp;&amp; (j &gt; i)) )</div><div class="line">            {</div><div class="line">                printf(<span class="stringliteral">&quot;\t\t&quot;</span>);</div><div class="line">                <span class="keywordflow">continue</span>;</div><div class="line">            }</div><div class="line"></div><div class="line">            printf(<span class="stringliteral">&quot;%8.2lf\t&quot;</span>, AP[ off ]);</div><div class="line">            off ++ ;</div><div class="line">        }</div><div class="line">        printf(<span class="stringliteral">&quot;\n&quot;</span>);</div><div class="line">    }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">int</span></div><div class="line">main(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    cl_int err;</div><div class="line">    cl_platform_id platform = 0;</div><div class="line">    cl_device_id device = 0;</div><div class="line">    cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 };</div><div class="line">    cl_context ctx = 0;</div><div class="line">    cl_command_queue queue = 0;</div><div class="line">    cl_mem bufAP, bufX, bufY;</div><div class="line">    cl_event <span class="keyword">event</span> = NULL;</div><div class="line">    <span class="keywordtype">int</span> ret = 0, numElementsAP;</div><div class="line"></div><div class="line">    <span class="comment">/* Setup OpenCL environment. */</span></div><div class="line">    err = clGetPlatformIDs(1, &amp;platform, NULL);</div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf( <span class="stringliteral">&quot;clGetPlatformIDs() failed with %d\n&quot;</span>, err );</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &amp;device, NULL);</div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf( <span class="stringliteral">&quot;clGetDeviceIDs() failed with %d\n&quot;</span>, err );</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    props[1] = (cl_context_properties)platform;</div><div class="line">    ctx = clCreateContext(props, 1, &amp;device, NULL, NULL, &amp;err);</div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf( <span class="stringliteral">&quot;clCreateContext() failed with %d\n&quot;</span>, err );</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    queue = clCreateCommandQueue(ctx, device, 0, &amp;err);</div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf( <span class="stringliteral">&quot;clCreateCommandQueue() failed with %d\n&quot;</span>, err );</div><div class="line">        clReleaseContext(ctx);</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Setup clblas. */</span></div><div class="line">    err = <a name="a3"></a><a class="code" href="group__INIT.html#gab0c597e62144c27ea6f9c100ee40bb6d">clblasSetup</a>();</div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf(<span class="stringliteral">&quot;clblasSetup() failed with %d\n&quot;</span>, err);</div><div class="line">        clReleaseCommandQueue(queue);</div><div class="line">        clReleaseContext(ctx);</div><div class="line">        <span class="keywordflow">return</span> 1;</div><div class="line">    }</div><div class="line"></div><div class="line">    numElementsAP = (N * (N+1)) / 2;    <span class="comment">// To get number of elements in a packed matrix</span></div><div class="line"></div><div class="line">    <span class="comment">/* Prepare OpenCL memory objects and place matrices inside them. */</span></div><div class="line">    bufAP = clCreateBuffer(ctx, CL_MEM_READ_WRITE, (numElementsAP * <span class="keyword">sizeof</span>(cl_float)),</div><div class="line">                            NULL, &amp;err);</div><div class="line">    bufX = clCreateBuffer(ctx, CL_MEM_READ_ONLY, N * <span class="keyword">sizeof</span>(cl_float),</div><div class="line">                            NULL, &amp;err);</div><div class="line">    bufY = clCreateBuffer(ctx, CL_MEM_READ_ONLY, N * <span class="keyword">sizeof</span>(cl_float),</div><div class="line">                            NULL, &amp;err);</div><div class="line"></div><div class="line">    err = clEnqueueWriteBuffer(queue, bufAP, CL_TRUE, 0,</div><div class="line">                numElementsAP * <span class="keyword">sizeof</span>(cl_float), AP, 0, NULL, NULL);</div><div class="line">    err = clEnqueueWriteBuffer(queue, bufX, CL_TRUE, 0,</div><div class="line">                N * <span class="keyword">sizeof</span>(cl_float), X, 0, NULL, NULL);</div><div class="line">    err = clEnqueueWriteBuffer(queue, bufY, CL_TRUE, 0,</div><div class="line">                N * <span class="keyword">sizeof</span>(cl_float), Y, 0, NULL, NULL);</div><div class="line"></div><div class="line">    err = <a name="a4"></a><a class="code" href="group__SPR2.html#ga3cdfb1ef40a2212ffd70de92e6b5002c">clblasSspr2</a>(order, uplo, N, alpha, bufX, 0 <span class="comment">/*offx */</span>, incx, bufY, 0 <span class="comment">/*offy*/</span>, incy,</div><div class="line">                                bufAP, 0 <span class="comment">/*offa */</span>, 1, &amp;queue, 0, NULL, &amp;event);</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (err != CL_SUCCESS) {</div><div class="line">        printf(<span class="stringliteral">&quot;clblasSspr2() failed with %d\n&quot;</span>, err);</div><div class="line">        ret = 1;</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span> {</div><div class="line">        <span class="comment">/* Wait for calculations to be finished. */</span></div><div class="line">        err = clWaitForEvents(1, &amp;event);</div><div class="line"></div><div class="line">        <span class="comment">/* Fetch results of calculations from GPU memory. */</span></div><div class="line">        err = clEnqueueReadBuffer(queue, bufAP, CL_TRUE, 0, (numElementsAP * <span class="keyword">sizeof</span>(cl_float)),</div><div class="line">                                  AP, 0, NULL, NULL);</div><div class="line">        <span class="comment">/* At this point you will get the result of SSPR2 placed in A array. */</span></div><div class="line">        printResult();</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Release OpenCL events. */</span></div><div class="line">    clReleaseEvent(event);</div><div class="line"></div><div class="line">    <span class="comment">/* Release OpenCL memory objects. */</span></div><div class="line">    clReleaseMemObject(bufX);</div><div class="line">    clReleaseMemObject(bufAP);</div><div class="line">    clReleaseMemObject(bufY);</div><div class="line"></div><div class="line">    <span class="comment">/* Finalize work with clblas. */</span></div><div class="line">    <a name="a5"></a><a class="code" href="group__INIT.html#ga737647d266623bb1aa27043fdaa9298f">clblasTeardown</a>();</div><div class="line"></div><div class="line">    <span class="comment">/* Release OpenCL working objects. */</span></div><div class="line">    clReleaseCommandQueue(queue);</div><div class="line">    clReleaseContext(ctx);</div><div class="line"></div><div class="line">    <span class="keywordflow">return</span> ret;</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>