Please take a quick look at the code above. Consider the following pseudo-code:įinalImage = RenderPixel (x ,y, &sceneData ) The important thing to note here is that the calculation for each pixel is completely separate from the calculation of any other pixel, therefore making this program highly suitable for OpenMP. The program goes on to the next pixel and repeats the process. Without going too much into the details of how ray tracing works, it simply goes through each pixel of the screen, and using lighting, texture, and geometry information, the color of that pixel is determined. For the sake of argument, suppose you’re writing a ray tracing program. This tutorial will be exploring just some of the ways in which you can use OpenMP to allow your loops in your program to run on multiple processors. OpenMP effectively exploits these common program characteristics, so it is extremely easy to allow an OpenMP program to use multiple processors simply by adding a few lines of compiler directives into your source code. Much of the time, different iterations of these loops have nothing to do with each other, therefore making these loops a prime target for parallelization. This is especially true for all programs which take a significant amount of time to execute. Virtually all useful programs have some sort of loop in the code, whether it is a for, do, or while loop.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |