X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/bdec1b5087c2ea922fcf62ad0591b8d784ddf3b7..86425fc23567cae046b8dbf12aab1f7934ec011c:/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);