Programming Parallel Computers

Dummy

MF9a: better algorithm ★★★

You need to log in to make submissions.

What you will need to do in this task

Please read the general instructions for this exercise first. Here are the additional instructions specific to this task:

Design a better algorithm that does not recalculate the median separately for each pixel. Make it as efficient as possible, also for very large window sizes. You are encouraged to use all resources that you have in the CPU.

What I will try to do with your code

I will first run all kinds of tests to see that your code works correctly. You can try it out locally by running ./grading test, but please note that your code has to compile and work correctly not only on your own computer but also on our machines.

If all is fine, I will run the benchmarks. You can try it out on your own computer by running ./grading benchmark, but of course the precise running time on your own computer might be different from the performance on our grading hardware.

Benchmarks

Name Parameters
benchmarks/1 hx = 10, hy = 10, nx = 500, ny = 500
the input contains 500 × 500 pixels and the window dimensions are 21 × 21 pixels
benchmarks/2 hx = 10, hy = 10, nx = 1500, ny = 1500
the input contains 1500 × 1500 pixels and the window dimensions are 21 × 21 pixels
benchmarks/3 hx = 10, hy = 10, nx = 4000, ny = 4000
the input contains 4000 × 4000 pixels and the window dimensions are 21 × 21 pixels
benchmarks/4 hx = 50, hy = 50, nx = 4000, ny = 4000
the input contains 4000 × 4000 pixels and the window dimensions are 101 × 101 pixels

Grading

In this task your submission will be graded using benchmarks/4: the input contains 4000 × 4000 pixels and the window dimensions are 101 × 101 pixels.

The point thresholds are as follows. If you submit your solution no later than on Sunday, 30 May 2021, at 23:59:59 (Helsinki), your score will be:

Running timePoints
≤ 50.000 sec 1
≤ 20.000 sec 2
≤ 10.000 sec 3
≤ 2.000 sec 4
≤ 1.000 sec 5

If you submit your solution after the deadline, but before the course ends on Sunday, 30 May 2021, at 23:59:59 (Helsinki), your score will be:

Running timePoints
≤ 50.000 sec 1
≤ 10.000 sec 2
≤ 1.000 sec 3