Use this forum to discuss the book: Using OpenMP - Portable Shared Memory Parallel Programming, by Barbara Chapman, Gabriele Jost and Ruud van der Pas Read the viewtopic.php?f=8&t=465
for book info and to download the examples. Post your feedback about the book and examples to this forum
In my reading of Chapter 1 I have found several errors in the dot product programs. Below is a list of these errors.
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)’.
Hi Keld, I apologize for the long delay getting back to you.
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
Return to Using OpenMP - The Book and Examples
Who is online
Users browsing this forum: Google [Bot] and 1 guest