There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Note that there is an asynchronous alternative to cudaMemcpy."
A block of code is set as follows:
#include<stdio.h>
#include<stdlib.h>
__global__ void print_from_gpu(void) {
printf("Hello World! from thread [%d,%d]
From device ", threadIdx.x,blockIdx.x);
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
int main(void) {
printf("Hello World from host!
");
print_from_gpu<<<1,1>>>();
cudaDeviceSynchronize();
return 0;
}
Any command-line input or output is written as follows:
$ nvcc -o hello_world hello_world.cu
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "For Windows users, in the VS project properties dialog, you can specify your GPU's compute capability at CUDA C/C++ | Device | Code Generation."