Question: This question considers a 2D grid of floating point numbers with dimensions width and height. Find the position of this grid that has the highest

 This question considers a 2D grid of floating point numbers with

This question considers a 2D grid of floating point numbers with dimensions width and height. Find the position of this grid that has the highest magnitude average. This function computes the sum of the neighbouring values in the 2D grid (NorthWest, North, NorthEast, East, SouthEast, South, SouthWest West) plus the centre and divides this by 9. Neighbours outside the dimensions of the array are treated as value zero. The grid is given as a 1D array which stores the 2D grid positions row-major order. NULL is returned in found x or found y if there is an error. The error can arise if the input array is NULL, dimensions are 0, or found.x or found y are NULL values themselves. The 1D array sequence: 1, 2, 3, 4, 5, 6, 7, 8,9 represents the grid: 4 5 6 f(x, y)- y-10h o /I returns the position of the highest magnitude average of the array // in variables found? and found-y void get_hma (float array, int w, int h, int *found_x, int *found_y) Question 8B Parallel part - 7 marks Consider a parallelisation of this problem. Describe in words how you would use 2 or more threads to gain a speedup > 1 In your answer, you should explain if the approach is task parallel, data parallel, or both and also provide a drawing of a task-dependency graph that supports your description. Question 8C Parallel part - 7 marks Write a parallel solution using exactly 4 threads to gain a speedup > 1. Write your solution with notation that is similar to pthreads. thread create), thread-join(), lock(mutex), unlock(mutex). sem-wait(s), sem post(s), sem init(s, value) This question considers a 2D grid of floating point numbers with dimensions width and height. Find the position of this grid that has the highest magnitude average. This function computes the sum of the neighbouring values in the 2D grid (NorthWest, North, NorthEast, East, SouthEast, South, SouthWest West) plus the centre and divides this by 9. Neighbours outside the dimensions of the array are treated as value zero. The grid is given as a 1D array which stores the 2D grid positions row-major order. NULL is returned in found x or found y if there is an error. The error can arise if the input array is NULL, dimensions are 0, or found.x or found y are NULL values themselves. The 1D array sequence: 1, 2, 3, 4, 5, 6, 7, 8,9 represents the grid: 4 5 6 f(x, y)- y-10h o /I returns the position of the highest magnitude average of the array // in variables found? and found-y void get_hma (float array, int w, int h, int *found_x, int *found_y) Question 8B Parallel part - 7 marks Consider a parallelisation of this problem. Describe in words how you would use 2 or more threads to gain a speedup > 1 In your answer, you should explain if the approach is task parallel, data parallel, or both and also provide a drawing of a task-dependency graph that supports your description. Question 8C Parallel part - 7 marks Write a parallel solution using exactly 4 threads to gain a speedup > 1. Write your solution with notation that is similar to pthreads. thread create), thread-join(), lock(mutex), unlock(mutex). sem-wait(s), sem post(s), sem init(s, value)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!