Lecture 5 Flashcards
Trapezoidal rule?
Integration method used to approximate the definite integral of a function. Divides the area under the curve into trapezoids and calculates their areas to estimate the integral value.
- Partition the problem to smaller problems. Each process will be responsible for computing the integral over its assigned sub interval.
- The integral over which the integration is performed is divided into subintervals, and these subintervals are distributed among the processes.
- Each process calculates the integral over its assigned interval.
- Establish communication so the final result can be calculated by combining each partial sum.
- Use reduction to combine the partial sums and obtain the global sum.
Speedup and efficiency?
Number of cores = p
T_parallel = T_serial / p
Linear speedup.
S = T_serial/T_parallel
Efficiency = S/p
T_parallel = T_serial / p + T_overhead
What is Amdahl’s law?
Unless all of a serial program is parallelised, the possible speedup is going to be limited - regardless of the number of cores available.
Discuss scalability in terms of efficiency.
A problem is scalable if it can handle ever increasing problem sizes.
If we increase the number of processes/threads and keep the efficiency fixed without increasing problem size, the problem is strongly scalable.
If we keep efficiency fixed by increasing the problem size at the same rate as we increase the number of processes/threads, the problem is weakly scalable.
Dynamic vs static threads in shared memory?
Dynamic threads: Master thread waits for work, forks new threads, and when threads are done, they terminate. Efficient use of resources, but thread creation and termination is time consuming.
Static threads: Pool of threads created and are allocated work, but do not terminate until cleanup. Better performance, but potential waste of system resources.
How should input collection happen in an MPI program?
Only the master process should handle input collection and send that data to the other processes. This is necessary to receive inputs in the correct order.