Parallel Computing: Lecture 4: Parallel Software: Basics
Parallel Computing: Lecture 4: Parallel Software: Basics
0480-003
Parallel Computing
Nondeterminism
...
printf ( "Thread %d: my_val = %d\n" ,
my_rank , my_x ) ;
...
possibility 2
possibility 1
Thread 0: my_val = 7
Thread 1: my_val = 19
Thread 1: my_val = 19
Thread 0: my_val = 7
Dealing with Nondeterminism
• Race condition
• Critical section
• Mutually exclusive
• Mutual exclusion lock (mutex, semaphore, …)
Distributed
Memory
Shared
Memory
• Are tasks of comparable size? If not, you may face load balancing
issues later.
• Does the number of tasks scale with problem size? Ideally, an increase
in problem size should increase the number of tasks rather than the
size of individual tasks.