General-purpose computing on graphics processing units: Difference between revisions

Content deleted Content added
fmt headings; rm spam link
Autodmc (talk | contribs)
Kernels: Added loop pseudocode for example...
Line 57:
Kernels can be thought of as the body of loops. For example, if the programmer was operating on a grid on the CPU he might have code that looked like this:
 
<pre>
(To Be Done)
/* Pseudocode */
 
x = 1000
y = 1000
 
make array x by y
 
for each "x" { // Loop this block 1000 times
for each "y" { // Loop this block 1000 times
do_some_hard_work(x, y) // This is done 1000x1000 times (1 000 000)
}
} </pre>
 
On the GPU, the programmer only specifies the body of the loop as the kernel and what data to loop over by drawing geometry. For example, if the programmer wanted to run the kernel over the entire grid, he would draw a full screen quad to create fragments over each grid cell (i.e. over each pixel).