X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/bdec1b5087c2ea922fcf62ad0591b8d784ddf3b7..d62bf95f0be0f7fb4d47af9d48c1da6be3d8f132:/BookGPU/Chapters/chapter17/code/collem_kernel_diffuse.cl diff --git a/BookGPU/Chapters/chapter17/code/collem_kernel_diffuse.cl b/BookGPU/Chapters/chapter17/code/collem_kernel_diffuse.cl index 93de319..2bfa979 100644 --- a/BookGPU/Chapters/chapter17/code/collem_kernel_diffuse.cl +++ b/BookGPU/Chapters/chapter17/code/collem_kernel_diffuse.cl @@ -15,7 +15,8 @@ kernel void diffuse( // _syncthreads() in CUDA barrier(CLK_GLOBAL_MEM_FENCE); - // Retrieve neighbors surplus and add them to the current cell population + // Retrieve neighbors surplus and add them to the current cell + // population int surplus = OVERFLOW(world, overflows, i + 1, j) + OVERFLOW(world, overflows, i - 1, j) + OVERFLOW(world, overflows, i, j - 1) + OVERFLOW(world, overflows, i, j + 1); CELL(world, newPopulations, i, j) = CELL(world, populations, i, j) + surplus / 8.0 - OVERFLOW(world, overflows, i, j);