|
4 | 4 |
|
5 | 5 | - [Parallel Computing Challenges](#parallel-computing-challenges) |
6 | 6 | - [Overview](#overview) |
7 | | - - [Task 1 - Parallise `for` Loop](#task-1---parallise-for-loop) |
8 | | - - [Task 2 - Run task 1 on HPC cluster](#task-2---run-task-1-on-hpc-cluster) |
9 | | - - [Task 3 - Reduction Clause](#task-3---reduction-clause) |
10 | | - - [Task 4 - Private clause](#task-4---private-clause) |
| 7 | + - [Notice](#notice) |
| 8 | + - [Task 1 - Single Cluster Job using OpenMP](#task-1---single-cluster-job-using-openmp) |
| 9 | + - [Task 2 - Parallel `for` Loop](#task-2---parallel-for-loop) |
| 10 | + - [Task 3 - Parallel Reductions](#task-3---parallel-reductions) |
| 11 | + - [Task 4 - Laplace Equation for Calculating the Temperature of a Square Plane](#task-4---laplace-equation-for-calculating-the-temperature-of-a-square-plane) |
11 | 12 | - [Task 5 - Calculate Pi using "Monte Carlo Algorithm"](#task-5---calculate-pi-using-monte-carlo-algorithm) |
12 | | - - [Bonus - Laplace equation to calculate the temperature of a square plane](#bonus---laplace-equation-to-calculate-the-temperature-of-a-square-plane) |
13 | 13 |
|
14 | | -## Task 1 - Parallise `for` Loop |
| 14 | +## Notice |
15 | 15 |
|
16 | | -Goal: To to create an array `[0,1,2………...19]` |
| 16 | +For every challenge you will be running the programs as SLURM jobs. This is so we don't overload the login nodes. A template [SLURM job script](./job.slurm) is provided at the root of this directory which you can use to submit your own jobs to SLURM by copying it to each challenges sub-directory and filling in the missing details. You may need more than one for some challenges. This template will put the would-be-printed output in a file named `slurm-<job-name>.out`. |
17 | 17 |
|
18 | | -1. Compile array.c and execute it. Check the run time of the serial code |
19 | | -2. Add `#pragma<>` |
20 | | -3. Compile the code again |
21 | | -4. Run parallel code and check the improved run time |
| 18 | +## Task 1 - Single Cluster Job using OpenMP |
22 | 19 |
|
23 | | -## Task 2 - Run task 1 on HPC cluster |
| 20 | +Create a program in `hello.c` that prints 'Hello, world from thread: <thread-number>' to the output. Launch the job to a node SLURM. |
24 | 21 |
|
25 | | -1. Check the available partitions with `show_cluster` |
26 | | -2. Modify `RunHello.sh` |
27 | | -3. `sbatch RunHello.sh` |
28 | | -4. `cat slurm<>.out` and check the run time |
| 22 | +> Note: |
| 23 | +> |
| 24 | +> - The output of a job is put in a slurm-<job-id>.out file by default. |
| 25 | +> - The template slurm job scripts will output the results to a `slurm-<job-name>.out` file. |
29 | 26 |
|
30 | | -> You can also use [strudel web](https://beta.desktop.cvl.org.au/login) to run the script without sbatch. |
| 27 | +## Task 2 - Parallel `for` Loop |
31 | 28 |
|
32 | | -## Task 3 - Reduction Clause |
| 29 | +In `array-gen.c` implement a program that generates an array containing the numbers 0..10'000 elements (inclusive) using a `for` loop. Measure the execution time using the `time` Linux command. Now reimplement the program to utilise OpenMP's parallel `for` loop macros, measuring the execution time again. Is there any performance improvement? Are the elements still in the correct order and if not how can you fix this. Try experimenting with different sized arrays and element types. |
33 | 30 |
|
34 | | -Goal: To find the sum of the array elements |
| 31 | +> Hint: You will likely need to allocate memory from the heap. |
35 | 32 |
|
36 | | -1. Compile `reduction.c` and execute it. Check the run time |
37 | | -2. Add `#pragma<>` |
38 | | -3. Compile `reduction.c` again |
39 | | -4. Run parallel code and check the improved run time. Make sure you got the same result as the serial code |
| 33 | +## Task 3 - Parallel Reductions |
40 | 34 |
|
41 | | -> `module load gcc` to use newer version of gcc if you have error with something like `-std=c99` |
| 35 | +In the C chapter we created a sum program that summed the elements of an array together. Using this as a base, create a new program that again computes the sum of the elements of an array but using OpenMP, comparing the execution time between the sequential and parallel versions. Is there any performance improvement? How would using a different binary operator change our ability to parallelize the the reduction? |
42 | 36 |
|
43 | | -## Task 4 - Private clause |
| 37 | +If you have time, implement the sum but at each iteration, raise the current value to the power of the current accumulation divide by 100, adding this to the accumulation. Test a serial and parallel version. Is the parallel any faster? |
44 | 38 |
|
45 | | -The goal of this task is to square each value in array and find the sum of them |
| 39 | +> Note: `module load gcc` to use newer version of gcc if you have error with something like `-std=c99`. |
46 | 40 |
|
47 | | -1. Compile private.c and execute it. Check the run time. `#include` the default library `<math.h>` and link it |
48 | | -2. Add `#pragma<>` |
49 | | -3. Compile `private.c` again |
50 | | -4. Run parallel code and check the improved run time |
| 41 | +## Task 4 - Laplace Equation for Calculating the Temperature of a Square Plane |
51 | 42 |
|
52 | | -## Task 5 - Calculate Pi using "Monte Carlo Algorithm" |
53 | | - |
54 | | -Goal: To estimate the value of pi from simulation |
55 | | - |
56 | | -- No instructions on this task. Use what you have learnt in previous tasks to run a parallel code! |
57 | | -- You should get a result close to pi(3.1415…….) |
| 43 | +For this challenge you will attempt to parallelize an existing implementation of the Laplace Equation. Throughout the source files of this project there are various loops you can try and make faster by utilizing OpenMP macros. See if you can make a faster version in the `laplace2d-parallel.c`. To build these files make sure you're in that directory and use the command `make`. The executables will be in the same directory. |
58 | 44 |
|
59 | | -Short explanation of Monte Carlo algorithm: |
60 | | - |
61 | | -[https://www.youtube.com/watch?v=7ESK5SaP-bc&ab_channel=MarbleScience](https://www.youtube.com/watch?v=7ESK5SaP-bc&ab_channel=MarbleScience) |
62 | | - |
63 | | -## Bonus - Laplace equation to calculate the temperature of a square plane |
| 45 | +## Task 5 - Calculate Pi using "Monte Carlo Algorithm" |
64 | 46 |
|
65 | | -- Modify `laplace2d.c` |
66 | | -- Use Makefile to compile the code |
67 | | -- Make the program as fast as you can |
| 47 | +For this challenge you will have to try and implement the Monte Carlo algorithm with no framework or template and using everything you've learnt so far. Good luck. |
68 | 48 |
|
69 | | -Brief Algorithm of Laplace equation: |
| 49 | +[Short explanation of Monte Carlo algorithm](https://www.youtube.com/watch?v=7ESK5SaP-bc&ab_channel=MarbleScience) |
0 commit comments