foreach[_tiled] seems to work now

This commit is contained in:
Evghenii
2013-11-14 16:29:40 +01:00
parent 48644813d4
commit af75afeb7a
5 changed files with 164 additions and 95 deletions

View File

@@ -142,7 +142,7 @@ int main(int argc, char *argv[]) {
deviceFree(d_buf);
printf("[mandelbrot ispc+tasks]:\t[%.3f] million cycles\n", minISPC);
writePPM(buf, width, height, "mandelbrot-ispc.ppm");
writePPM(buf, width, height, "mandelbrot-cuda.ppm");
//

View File

@@ -73,7 +73,8 @@ mandelbrot_scanline(uniform float x0, uniform float dx,
const uniform int ystart = taskIndex1 * yspan;
const uniform int yend = min(ystart + yspan, height);
#if 0
for (uniform int yi = ystart; yi < yend; yi++)
for (uniform int xi = xstart; xi < xend; xi += programCount)
{
@@ -85,6 +86,17 @@ mandelbrot_scanline(uniform float x0, uniform float dx,
if (xi + programIndex < xend)
output[index] = res;
}
#else
foreach (yi = ystart ... yend, xi = xstart ... xend)
{
const float x = x0 + xi * dx;
const float y = y0 + yi * dy;
const int res = mandel(x,y,maxIterations);
const int index = yi * width + xi;
output[index] = res;
}
#endif
}