OpenMP Buggy Codes Lab

From Education

Jump to: navigation, search

Today we talked a lot about openMP, how it works, and how it doesn't work. If we learn a lot more by our mistakes than our successes, this evening lab is for you. The task at hand is to find the “bugs” in codes that are provided on LittleFe. These exercises are taken, with permission, from Blaise Barney, researcher and openMP expert at Lawrence Livermore National Laboratory.

This lab is moderate to difficult in the skill level requirements and requires a solid understanding of the C programming language. All of the buggy codes can be found in your account on LittleFe, under the directory OpenMP-BuggyCodes. Recall that LittleFe is at the IP address 10.194.18.146.

The first program, omp_bug1.c, won't even compile. The cause of the issue was discussed at some length today. Can you find the reason why?

The second program, omp_bug2.c, gives the wrong answer. One of the questions that came up today was about the default scope of variables not otherwise declared as shared or private. This example shows pretty definitively that variables are shared by default. Could that be the reason why this code gives the incorrect answer? Can you be "Bob the builder?" (i.e., "Can we fix it? Yes we can!" -- sorry, I have young kids and couldn't help it.)

The third program, omp_bug3.c, does an unapologetic SEGFAULT when run. There may be a way to fix this one if ulimit yourself to the task at hand.

Finally, the fourth program, omp_bug4.c, sums up this exercise, showing what openMP can do, and what it can't do when you lose sight of the scope and scale. (Refer to the omp_orphan.c code from earlier today – what's the difference here?)

Code

Personal tools
SC Education sites