







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Information on writing an openmp-based program to compute the dot product of two vectors with 1200 elements each on a 6-core smp system. It covers openmp directives and library functions, group communication operations, cost analysis, and examples of broadcast and reduction in matrix-vector multiplication. The document also discusses communication patterns in different topologies.
Typology: Slides
1 / 13
This page cannot be seen from the preview
Don't miss anything!








void omp_set_num_threads
(int num_threads); int omp_get_num_threads ();int omp_get_max_threads ();int omp_get_thread_num ();int omp_get_num_procs ();int omp_in_parallel();
#pragma omp sections
#pragma omp section
void omp_set_lock
*(omp_lock_t lock); void omp_unset_lock
*(omp_lock_t lock); int omp_test_lock
*(omp_lock_t lock);
Group communication operations are builtusing point-to-point messaging primitives.
-^
Communicating a message of size
m
over an
uncongested network takes time (
w
Where necessary, we take congestion intoaccount explicitly by scaling the
t
w^
term.
We assume that the network is bidirectionaland that communication is single-ported.
Cost Analysis: one-to-all broadcast
& reduction
-^
w
-^
Broadcast and Reduction: Matrix-Vector Multiplication One-to-all broadcast and all-to-one reduction in the multiplication of a
4 x 4
matrix with a
4 x 1
vector.
Simplest approach: perform
p
one-to-all broadcasts
This is not the most efficient way, though.
-^
Each node first sends to one of its neighbors thedata it needs to broadcast.
-^
In subsequent steps, it forwards the data receivedfrom one of its neighbors to its other neighbor.
-^
The algorithm terminates in
p-
steps.
-^
On a ring, the time is given by:
s^
w
All-to-all broadcast on a
3 x 3
mesh. The groups of nodes communicating with each other in each phase
are enclosed by dotted boundaries. By the end of the second phase, all nodes get (0,1,2,3,4,5,6,7)
-^
On a mesh, the time is given by: