From a88e8ed052daa33b2e1d92e97ffe6954342a3f87 Mon Sep 17 00:00:00 2001 From: UnciaBit Date: Mon, 1 May 2023 12:15:03 +1000 Subject: [PATCH 1/3] Update challenges.md --- src/chapter4/challenges.md | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/chapter4/challenges.md b/src/chapter4/challenges.md index 78fce0f..5e16242 100644 --- a/src/chapter4/challenges.md +++ b/src/chapter4/challenges.md @@ -4,20 +4,22 @@ ## Task 1 - Parallise `for` Loop -Goal: To to create an array `[0,1,2...19]` +Goal: To to create an array `[0,1,2...100000]` 1. Git clone [HPC-Training-Challenges](https://github.com/MonashDeepNeuron/HPC-Training-Challenges) -2. Go to the directory “challenges/parallel-computing”. Compile array.c and execute it. Check the run time of the serial code -3. Add `#pragma<>` -4. Compile the code again -5. Run parallel code and check the improved run time +2. Go to the directory “challenges/parallel-computing” and open `array.c` file +3. Implement the code to create an array `[0,1,2...100000]` without parallelisation +4. Measure the run time of the code +5. Use `#pragma<>` and potentially other clauses to parallelise the code +6. Compile the code again and check the run time and observe the result ## Task 2 - Run task 1 on HPC cluster -1. Check the available partitions with `show_cluster` -2. Modify `RunHello.sh ` -3. `sbatch RunHello.sh` -4. `cat slurm<>.out` and check the run time +1. Log into M3 +2. Check the available partitions with `show_cluster` +3. Modify `RunHello.sh` to you can run `array.c` on HPC cluster +4. Submit the job to M3 +5. Check the slurm output file >You can also use [strudel web](https://beta.desktop.cvl.org.au/login) to run the script without sbatch @@ -25,27 +27,34 @@ Goal: To to create an array `[0,1,2...19]` Goal: To find the sum of the array elements -1. Compile `reduction.c` and execute it. Check the run time -2. Add `#pragma<>` -3. Compile `reduction.c` again -4. Run parallel code and check the improved run time. Make sure you got the same result as the serial code +1. Implement the code in `reduction.c` to find the sum of the array elements without parallelisation +2. Measure the run time of the code +3. Add `#pragma<>` and potentially other clauses to parallelise the code +4. Compile and run `reduction.c` again +5. Check the run time and observe the result >`module load gcc` to use newer version of gcc if you have error with something like `-std=c99` ## Task 4 - Private clause The goal of this task is to square each value in array and find the sum of them -1. Compile private.c and execute it. Check the run time. `#include` the default library `` and link it -2. Add `#pragma<>` -3. Compile `private.c` again -4. Run parallel code and check the improved run time + +1. Implement the code in `private.c` to square each value in array and find the sum of them without parallelisation +2. Measure the run time of the code. (You may need to link the math library with `-lm`) +3. Add `#pragma<>` and potentially other clauses to parallelise the code +4. Compile `private.c` again and check the run time and observe the result ## Task 5 - Calculate Pi using "Monte Carlo Algorithm" Goal: To estimate the value of pi from simulation -- No instructions on this task. Use what you have learnt in previous tasks to run a parallel code! -- You should get a result close to pi(3.1415…….) +1. Implement Monte Carlo in `MonteCarlo.c` without parallelisation +2. Measure the run time of the code +3. Parallelise the code +4. Compile and run `MonteCarlo.c` again +5. Check the run time and observe the result + +> You should get a result close to pi(3.1415…….) Short explanation of Monte Carlo algorithm: @@ -55,9 +64,9 @@ Short explanation of Monte Carlo algorithm: ## Bonus - Laplace equation to calculate the temperature of a square plane -- Modify `laplace2d.c` -- Use Makefile to compile the code -- Make the program as fast as you can +1. Modify `laplace2d.c` and implement the laplace algorithm +2. Use Makefile to compile the code +3. Make the program as fast as you can Brief Algorithm of Laplace equation: ![](imgs/Pasted%20image%2020230326142826.png) \ No newline at end of file From fea1d94bdfea1025010c7b2f2781c4184de5d2fc Mon Sep 17 00:00:00 2001 From: UnciaBit Date: Mon, 1 May 2023 13:48:34 +1000 Subject: [PATCH 2/3] Update challenges.md --- src/chapter4/challenges.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter4/challenges.md b/src/chapter4/challenges.md index 5e16242..a6e6590 100644 --- a/src/chapter4/challenges.md +++ b/src/chapter4/challenges.md @@ -7,7 +7,7 @@ Goal: To to create an array `[0,1,2...100000]` 1. Git clone [HPC-Training-Challenges](https://github.com/MonashDeepNeuron/HPC-Training-Challenges) -2. Go to the directory “challenges/parallel-computing” and open `array.c` file +2. Go to the directory `challenges/parallel-computing` and open `array.c` file 3. Implement the code to create an array `[0,1,2...100000]` without parallelisation 4. Measure the run time of the code 5. Use `#pragma<>` and potentially other clauses to parallelise the code From d2517f703cff8aca852824f588f37dee1f9cffaa Mon Sep 17 00:00:00 2001 From: oraqlle <41113853+oraqlle@users.noreply.github.com> Date: Tue, 2 May 2023 13:25:13 +1000 Subject: [PATCH 3/3] Removed `.DS_Store` Updated `.gitignore`. --- .gitignore | 1 + src/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 1 insertion(+) delete mode 100644 src/.DS_Store diff --git a/.gitignore b/.gitignore index 9494988..a306d42 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ # mdBook Output book +# MacOS Meta Files .DS_Store diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index be1ef9468340e633cbbd7315fb331b8277c00c4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKPjAyO6o2jtO*bJ`f=Rnfvc$C-Z8{i;OIF5#1DAzALV!xrL@ZinS53Mcs!BPt z@3611E1!h#!U^89J*iDMdaD5WRnI^Fc|W`U#j#@mVEswd1!w_)gHBlA#N-B}cJd{w znHu6T)rW)vQivgfuS?Ok!YW`D_}dhqclSO7FoaVOF#rC>aE5QPfE+T|!+i8AmBTQV zAu?#YI7Hw3r3`blMGWBtdm14lhB0(2@mDM2-NkseyCS|d=S1%;$qNx@Is0_NJKnVgd~bF zu^Obee(1JI`poUL`F`)oY}RzPA3l11JUC6y zg#3ncKx4R@D!XU!8fcDHoqOm0SfoMu;l`CjD`TF6MQdwNz^pQ7YYk)BA*=#cfqzQ@+8;PNp=Yqv zsJ0GF)D-}+j@8OAPag-w;RZc}rABN)W15Pnsmxq4n5JVrH*uc9Qlq8=GnWr$MrP)Q z!qn*4KUd+vJdHNB3Rnde71+?l7M=euZ@>R9l5EK;U={eU6kzou|EP~sGH2`3