Skip to content

Commit

Permalink
MATLAB: exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
pojeda committed Aug 7, 2024
1 parent 80f3791 commit 78c051c
Showing 1 changed file with 41 additions and 3 deletions.
44 changes: 41 additions & 3 deletions docs/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,51 @@
The first time you access Matlab on Kebnekaise, you need to configure it by following these guidelines
[Configuring Matlab](https://www.hpc2n.umu.se/resources/software/configure-matlab-2018)


Chart flow for a more efficient Matlab code using existing tools (adapted from[^1])

![pctworkflow](images/pctworkflow.png)

<figcaption>Chart flow for a more efficient Matlab code using existing tools (adapted from [^1])</figcaption>
!!! Note "Exercise 1: Matlab serial job"

The folder SERIAL contains a function **funct.m** which performs a FFT on a matrix.
The execution time is obtained with tic/toc and written down in the output file called
**log.out**. Run the function **funct.m** by using the MATLAB GUI with the help
of the script **submit.m**.

As an alternative, you can submit the job via a batch script **job.sh**. Here,
you will need to fix the Project_ID with the one provided for the present course.


!!! Note "Exercise 2: Matlab parallel job"

* "PARFOR" contains an example of a parallelized loop with the "parfor" directive. A pause()
function is included in the loop to make it heavy. This function can be
submitted to the queue by running the script "submit.m" in the MATLAB GUI.
The number of workers can be set by replacing the string *FIXME* (in the "submit.m"
file) with the number you desire.

Try different values for the number of workers from 1 to 28 and take a note
of the simulation time output at the end of the simulation. Where does the
code achieve its peak performance?

* "SPMD" presents an example of a parallelized code using SPMD paradigm. You
can submit this job to the queue through the MATLAB GUI.

!!! Note "Exercise 2: Matlab GPU job"

"GPU" folder contains a test case that computes a Mandelbrot set both
on CPU **mandelcpu.m** and on GPU **mandelgpu.m**. You can submit the jobs through
the MATLAB GUI using the "submitX.m" files (X=cpu,gpu).

The final output if everything ran well are two .png figures
which display the timings for both architectures. Use the "eom" command on the
terminal to visualize the images (eom out-X.png)


This is a footnote[^2] with some text after.
!!! Keypoints "Keypoints"

[^2]: This is my footnote reference
- The software on Kebnekaise is mostly accessed through the module system.

## References

Expand Down

0 comments on commit 78c051c

Please sign in to comment.