OpenCL Programming by Example
上QQ阅读APP看书,第一时间看更新

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: " Each OpenCL vendor, ships this library and the corresponding OpenCL.dll or libOpenCL.so library in its SDK."

A block of code is set as follows:

void saxpy(int n, float a, float *b, float *c)
{
    for (int i = 0; i < n; ++i)
        y[i] = a*x[i] + y[i];
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#include <CL/cl.h>
#endif
#define VECTOR_SIZE 1024

//OpenCL kernel which is run for every work item created.
const char *saxpy_kernel =
"__kernel \n"
"void saxpy_kernel(float alpha, \n"
" __global float *A, \n"
" __global float *B, \n"
" __global float *C) \n"
"{ \n"
" //Get the index of the work-item \n"
" int index = get_global_id(0); \n"
" C[index] = alpha* A[index] + B[index]; \n"
"} \n";

int main(void) {
  int i;

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
 /etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking on the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.