X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/4f8020b1c6324b056b53b4325cd80d59bb7cf19f..11f93a2e8880680f6b192298e5ce0697d2596a31:/BookGPU/Chapters/chapter5/code/ex1.cu?ds=inline diff --git a/BookGPU/Chapters/chapter5/code/ex1.cu b/BookGPU/Chapters/chapter5/code/ex1.cu index 13d4322..847d20a 100644 --- a/BookGPU/Chapters/chapter5/code/ex1.cu +++ b/BookGPU/Chapters/chapter5/code/ex1.cu @@ -1,29 +1,29 @@ -#include - -__global__ void add(double* a, double const* b, int N) -{ - int i = blockDim.x*blockIdx.x + threadIdx.x; - if(i>>(a1, b1, N); - - // gpulab example - gpulab::vector a2(N, 2.0); - gpulab::vector b2(N, 3.0); - a2.axpy(1.0, b2); // BLAS1: a2 = 1*b2 + a2 - - return 0; +#include + +__global__ void add(double* a, double const* b, int N) +{ + int i = blockDim.x*blockIdx.x + threadIdx.x; + if(i>>(a1, b1, N); + + // gpulab example + gpulab::vector a2(N, 2.0); + gpulab::vector b2(N, 3.0); + a2.axpy(1.0, b2); // BLAS1: a2 = 1*b2 + a2 + + return 0; } \ No newline at end of file