Rastislav Krivoš-Belluš
PDS1 - Paralelné a distribuované systémy
1. exercise
2. exercise
- Bounded Semaphore, Multiple consumers and producers
- code (html)
3. exercise
- Multiprocessing, SharedMemory
- code (html)
- HW: Create program computing nansum with SharedMemory and without. Compare running time. (BONUS: memory)
4. exercise
- Fibonacci numbers, Primes with Cython
- Mandelbrot with Numba
Tasks
- complex numbers in Python
- complex numbers in Cython
- complex numbers with JIT in Numba
- complex numbers no sqrt, JIT in Numba
- real numbers, noq sqrt, JIT in Numba
- guvectorize complex64+complex128
- cuda@numba (CUDA-capable grafic card, Colab, or on server .56 from cuda tasks), try different dimensions blockdim/griddim
- code (html)
7. exercise
- Tasks
- Compute the sum of array - several solutions and find biggest speed-up.
from random import randrange
arr = [randrange(10, 1000) for _ in range(100_000_000)]
- Compute the sum of two arrays (e.g. [1, 2] + [3,4] = [4, 6]) - several solutions and find biggest speed-up.
- Compute the multiplication of two matices - several solutions and find biggest speed-up.
- code (html)
10. exercise MPI
- MPI tutorial
- TASKS (run on the server pds_run taskX.py >taskX.out):
- task1.py: Every process generates two numbers, reduce minimums to the rank 1.
- task2.py: Every process generates one number, compute the MPI_Scan and explain expected results in source file.
- task3.py: Every process generates one number, compute the MAXLOC to all processes.
- code (html), codes (server)
11. exercise MPI
- Other materials: MPI course material, Parallel Programming in MPI and OpenMP
- generating in Python
- HW: Implement solution of 0-1 Knapsack problem
- Master generates prefixes and distribute them to workers. Worker calculates all solutions for given prefix. At the end worker sends his best solution. Master prints the maximum value.
- Show also the solution (which items you choose), not only the maximum value - you can use MAXLOC with INT2 or communicate with all workers.
- Run on server pds_run hwMPI2.py >hwMPI2.out.
- code (html)
© 2025 Rastislav Krivoš-Belluš