The first two assignments are peer assessed. They are an opportunity to learn about basics from and with each other. The later assignments are assessed based on runtime performance and require good command of the basic skills you practices in the first half of the course.

Please observe that it can be difficult to reach the required performance on a highly saturated training system, as it sometimes happens to be during the computer lab sessions.

Basic C Programming and Optimization

This is subject to peer assessment. It is allowed and suggested to complete each task, and then consult with your peer assessment group for feedback before starting the next task.

OpenMP

Example Program

You can find an example program at

/home/hpc2023/cell_distances/cell_distances -t10

A reference implementation in Julia is available at

/home/hpc2023/cell_distances/cell_distances.jl

You can find test data in the folder

/home/hpc2023/cell_distances/test_data

Further test data can be created by the script

/home/hpc2023/cell_distances/create_cell_file.py

Test script

You can check your submission with the script

/home/hpc2023/cell_distances/check_submission.jl PATH_TO_SUMISSION.tar.gz

For instance, if you have provided your submission in the file /home/hpcuser223/cell_distances.tar.gz, then you run

/home/hpc2023/cell_distances/check_submission.jl /home/hpcuser223/cell_distances.tar.gz

Recall that your submission has to pass this script for you to pass this assignment. So test before submitting.

Notice that the test script

  1. checks your output for correctness,

  2. redirects stdout to a file, so that additional runtime costs for writing to disc can apply.

Performance goals

For each column in the next table, there is a file describing an initial configuration available in

/home/hpc2023/cell_distances/test_data
Number of points1e41e51e51e5
Number of threads151020
Maximal runtime in seconds0.316.863.652.02

Threads

Example Program

You can find an example program at

/home/hpc2023/newton_iteration/newton -t2 -l1000 5

A reference implementation in Julia is available at

/home/hpc2023/newton_iteration/newton.jl

You can find more images created with this program in the folder

/home/hpc2023/newton_iteration/

Test script

You can check your submission with the script

/home/hpc2023/newton_iteration/check_submission.jl PATH_TO_SUMISSION.tar.gz

Recall that your submission has to pass this script for you to pass this assignment. So test before submitting.

The script also generates two PNG-pictures in the folder pictures, which gives an indication of whether you program yields correct output.

Performance goals

The program will be tested with the following arguments. It must be at least as fast as given in the corresponding tables.

Note that it is best to check the png-files generated by the test script for correctness and not the ppm-files. You can also use the convert command to produce png-files from your ppm-files. There are numerous incorrect implementations of the ppm-format around. Most notably, on Mac some non-conformant ppm-files are displayed as if correct.

Single threaded, 1000 lines, varying polynomial x^d - 1

Degree of polynomial1257
Maximal runtime in seconds0.150.180.420.69

Multithreaded, 1000 lines, x^5 - 1

Number of threads1234
Maximal runtime in seconds0.420.270.200.18

Ten threads, varying number of lines, x^7 - 1

Number of lines100020003000
Maximal runtime in seconds0.170.390.78

OpenCL (optional)

Example Program

You find an example program at

/home/hpc2023/diffusion_opencl/diffusion -n20 -d0.02

A reference implementation in Julia is available at

/home/hpc2023/diffusion_opencl/diffusion.jl

You can find further test data in the folder

/home/hpc2023/diffusion_opencl/test_data

Further test data can be created by the script

/home/hpc2023/diffusion_opencl/create_init_file.py

Test script

You can check your submission with the script

/home/hpc2023/diffusion_opencl/check_submission.jl PATH_TO_SUMISSION.tar.gz

Performance goals

For each column in the next table, there is a file describing an initial configuration available in

/home/hpc2023/diffusion_opencl/test_data
Width * Height100 * 10010000 * 10000100000 * 100
Diffusion constant0.010.020.6
Number of iterations1000001000200
Time in seconds0.9615.60.74

MPI (optional)

Example Program

MPI on gantenbein is organized as a module. Before using it run

module load mpi

You find an example program at

mpirun -n 1 /home/hpc2023/diffusion_mpi/diffusion -n20 -d0.02

Test script

You can check your submission with the script

/home/hpc2023/diffusion_mpi/check_submission.jl PATH_TO_SUMISSION.tar.gz

Performance goals

For each column in the next table, there is a file describing an initial configuration available in

/home/hpc2023/diffusion_opencl/test_data
Width * Height100 * 100100 * 10010000 * 1000010000 * 1000010000 * 10000100000 * 100100000 * 100
Diffusion constant0.010.010.020.020.020.60.6
Number of iterations100000100000100010001000200200
Number of MPI processes110251015
Time in seconds4.615.3493.043.025.87.604.87

Observe that the second case allows for a slower runtime with more CPU compared to the first one, checking the parallelization overhead in case of small arrays.