Skip to content
Snippets Groups Projects
Commit cc2d27fa authored by dansa828's avatar dansa828
Browse files

lab3 measurements and pics

parent 1bda9451
No related branches found
No related tags found
No related merge requests found
Showing
with 7 additions and 6 deletions
......@@ -51,11 +51,11 @@ unsigned char gaussian_kernel(skepu::Region1D<unsigned char> m, const skepu::Vec
// If the kernel is row wise
if(m.oi*2+1 != (int)stencil.size) {
printf("%i\n", (int)stencil.size);
//printf("%i\n", (int)stencil.size);
stepsize = (int)elemPerPx;
}
else {
printf("%s\n", "col");
//printf("%s\n", "col");
}
float res = 0;
......
......@@ -59,12 +59,12 @@ int main(int argc, const char* argv[])
/* Compute and measure time */
float resComb, resSep;
auto timeComb = skepu::benchmark::measureExecTime([&]
auto timeComb = skepu::benchmark::measureExecTimeIdempotent([&]
{
resComb = dotprodMap(v1, v2);
});
auto timeSep = skepu::benchmark::measureExecTime([&]
auto timeSep = skepu::benchmark::measureExecTimeIdempotent([&]
{
multMap(v3, v1, v2);
resSep = addReduce(v3);
......
Lab3/resultpics/CPU33x33-average.png

42.3 KiB

Lab3/resultpics/CPU33x33-gaussian.png

48.5 KiB

Lab3/resultpics/CPU33x33-median.png

51.3 KiB

Lab3/resultpics/CPU33x33-separable.png

43 KiB

Lab3/resultpics/CUDA33x33-average.png

42.3 KiB

Lab3/resultpics/CUDA33x33-gaussian.png

48.5 KiB

Lab3/resultpics/CUDA33x33-median.png

51.3 KiB

Lab3/resultpics/CUDA33x33-separable.png

43 KiB

Lab3/resultpics/OPENCL33x33-average.png

42.3 KiB

Lab3/resultpics/OPENCL33x33-gaussian.png

48.5 KiB

Lab3/resultpics/OPENCL33x33-median.png

51.3 KiB

Lab3/resultpics/OPENCL33x33-separable.png

43 KiB

Lab3/resultpics/OPENMP33x33-average.png

42.3 KiB

Lab3/resultpics/OPENMP33x33-gaussian.png

48.5 KiB

Lab3/resultpics/OPENMP33x33-median.png

51.3 KiB

Lab3/resultpics/OPENMP33x33-separable.png

43 KiB

......@@ -47,7 +47,6 @@ ReadAndPadPngFileToMatrix(std::string filePath, int kernelRadius, LodePNGColorTy
std::cout << "decoder error " << error << ": " << lodepng_error_text(error) << std::endl;
int elementsPerPixel = (colorType == LCT_GREY) ? 1 : 3;
std::cout << "Här: " << imageHeight << ", " << imageWidth << ", " << kernelRadius << std::endl;
// Create a matrix which fits the image and the padding needed.
skepu::Matrix<unsigned char> inputMatrix(imageHeight + 2*kernelRadius, (imageWidth + 2*kernelRadius) * elementsPerPixel);
......
......@@ -40,9 +40,11 @@ CPU: Small problems sizes will be faster because the clock frequency of the CPU
GPU: Big problem sizes will be faster because there are many more cores in the GPU. Need big problems parallelizable to make use of the GPU, it takes time to send from CPU to GPU.
#### Question 1.4: Try measuring the parallel back-ends with measureExecTime exchanged for measureExecTimeIdempotent. This measurement does a "cold run"of the lambda expression before running the proper measurement. Do you see a difference for some backends, and if so, why?
Especially for OpenCL, the bottleneck is loading the data from the CPU to the GPU.
Combined for GPU is a big difference when measuring with measureExecTimeIdempotent. It is almost the same speed as separate then.
Separable can possibly be parallelized better than combined.
#### Question 2.1: Which version of the averaging filter (unified, separable) is the most efficient? Why?
Separable, because it can be parallelized better.
#### Question 3.1: In data-parallel skeletons like MapOverlap, all elements are processed independently of each other. Is this a good fit for the median filter? Why/why not?
Could be more efficient if the current pixel checked its neighbours instead of processing it independently. With median filtering, large areas of almost the same color appears.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment