Introduction to Programming with OpenMP --------------------------------------- Practical Exercise 4 (Simple SPMD etc.) --------------------------------------- Use similar commands to compile and run the program as in practical exercise 2. Question 1 ---------- 1.1 Starting with Programs/Mandelbrot.f90 or Programs/Mandelbrot.c, add directives to parallelise the outer loop in the main program, using a combined parallel and DO/for directive. Put a 'schedule(static)' on the directive. C programmers should change the '-ansi' option to '-std=c99'. Test it with an argument 0.1 or 0.01 and time it with an argument of 0.003 or less; the time taken is roughly proportional to 1/(argument^2), so do not overdo it. Note that it takes nearly as long to run as it takes in CPU, and so is almost serial. 1.2 Change the scheduling clause to 'schedule(static,1)' and rerun, noting that the problem is resolved. This example is actually too easy, as both this and 'schedule(dynamic,???)' solve the problem. In practice, a lot more experimentation would be needed. Question 2 ---------- 2.1 Take a copy of the program you wrote in question 2.2 in practical exercise 3 that was called 'Britomart', and change the program to use plain parallel directives instead of combined ones, assigning iterations to the threads explicitly. Once you have got this working, you are recommended to make the thread number a threadprivate variable if you have not already done so, just as an exercise in using that.