OpenMP and the OpenMP logo are registered trademarks of the OpenMP Architecture Review Board in the United States and other countries.Ive tried to run the code below but no speedup achieved and the program hangs for n 40; The Iwomp 2010 material ( slide 124 of OpenMP overview) states that theres a approximatively x2 speedup.Your code is technically correct, but to get good performance you need to use a cutoff value for n.
Openmp Program For Fibonacci Series Serial Version WithoutOnce the value of n gets below this threshold it is best to simply execute the serial version without tasking. I modified your code to implement this: Code: Select all if ( n 0 n 1 ) return(n). This is the result I get: Code: Select all cc -fast -xopenmp fib.c. Note that the cutoff value depends on what system and OpenMP run time system you use. I picked some values and found 20 to work well, but I dont exclude the optimal value on the configuration I used may be less. I also wanted to point out that I have a more recent version of the tutorial. Openmp Program For Fibonacci Series Download It FromYou can download it from the IWOMP 2011 web site:. ![]() I dont see this happening with our compilers and it is hard to diagnose without knowing more. A wild guess is that you may run into some call stack limitation, nesting calls too deeply. Im using Intel compiler C on Windows version 12.0 on a dual-core machine. First, when you run this example with (n40, cutoff20) the number of tasks created is not so high. If you restricted to so little tasks then it is really a problem. Second, you can run the example with (n20, cutoff0) and you create the same number of tasks but you will not get any speedup at all. Third, if you change the cutoff code as below you will not get the speedup you expected no matter what is value of n or the value of the cutoff: if ( n.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |