Sequential Dot-Product (p. 17)
(1) Missing declaration of i.
(2) The loop control for (i = 1; i <= n; i++) should be for (i = 0; i < n; i++).
Dot-Product in MPI (p.17-18)
(3) Missing declaration of i.
(4) iam should be myid.
(5) The implementation is a bit strange since all processes initialize arrays a and b.
Dot-Product in Pthreads (p. 18-20)
(6) Missing declaration of i in the main function.
(7) thd[NUMTHRDS] (p. 18) should be thds[NUMTHRDS].
(8) thread_mutex_init (p. 19) should be pthread_mutex_init.
(9) mutex_sum (p. 20) should be ‘mutexsum’. (2 occurences)
(10) The loop control for (i = my_first; i <= my_last; i++) should be for (i = my_first; i < my_last; i++).
Dot-Product in OpenMP (p. 20)
(11) pragma omp for reduction(+:sum) should be ‘pragma omp parallel for reduction(+:sum)’.
Thank you very much for catching these glitches. You're absolutely correct and I'm sorry these
errors sneaked in.
We'll correct them when we have the opportunity to revise the text.
Kind regards, Ruud