# CartesianIndices, Convolution and other "moving window" computations on GPU

**URL:** <https://discourse.julialang.org/t/cartesianindices-convolution-and-other-moving-window-computations-on-gpu/19474>\
**Category:** New to Julia\
**Tags:** gpu, indexing\
**Created:** [January 10, 2019, 2:27pm UTC](https://discourse.julialang.org/t/cartesianindices-convolution-and-other-moving-window-computations-on-gpu/19474 "2019-01-10T14:27:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapus95](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rapus95/32/3773_2.png) [@rapus95](https://discourse.julialang.org/u/rapus95)\
**Post date:** [January 10, 2019, 2:27pm UTC](https://discourse.julialang.org/t/cartesianindices-convolution-and-other-moving-window-computations-on-gpu/19474/1 "2019-01-10T14:27:47Z")

</div>

Hey, I want to move some code to the GPU that’s heavy on image processing (using convolution & similar stuff)  
On the CPU I was doing it manually using a for loop over CartesianIndices. So I’m curious whether that’s the right for for the GPU aswell or if there are other solutions for that scenario:  
I’ve got an array (2d single color channel or 3d with multiple color channels) and now I want to create a new image by computing every pixel from a given n\*n surrounding in the orginal image. This can be similar as doing a linear combination or as complex as counting the values around the pixel and returning the value that showed up most often.
