-As GPUs have their own memory, the first step consists in allocating memory on
-the GPU. A call to \texttt{cudaMalloc}\index{Cuda~functions!cudaMalloc} allows
-to allocate memory on the GPU. The first parameter of this function is a pointer
-on a memory on the device (i.e. the GPU). In this example, \texttt{d\_} is added
-on each variable allocated on the GPU, meaning this variable is on the GPU. The
-second parameter represents the size of the allocated variables, this size is expressed in
-bits.
+As GPUs have their own memory, the first step consists of allocating memory on
+the GPU. A call to \texttt{cudaMalloc}\index{CUDA~functions!cudaMalloc}
+allocates memory on the GPU. The second parameter represents the size of the
+allocated variables, this size is expressed in bits.
+
+\lstinputlisting[label=ch2:lst:ex1,caption=simple example]{Chapters/chapter2/ex1.cu}
+