The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I am having a lot of trouble with this assignment. Help would be greatly appreciated
Assignment 3: pthreadsThe purpose of this assignment is for you to learn more about•loop schedulers•task schedulers•overhead associated with thread management and synchronizationAs usual all time measurements are to perform on the cluster.Link with the pthread library by passing-lpthread.Both schedulers have a first sequential part where you will build a simple application first; and a secondpart where you will build the scheduler and the parallel application.1Loop SchedulersLoop schedulers are used essentially whenever the code reads like your stereotypical for loop. In the previousassignment, transform would be a stereotypical for loop, but reduce could also be written this way. Here wewill look at a variation on the theme of reduction.1.1Numerical IntegrationNumerical integration is often used when one wants to computeRbaf(x)dxbut one does not know how to finda primitive off. You can use the definition of integration to obtain a simple approximation by computing∑n-1i=0f(a+ (i+.5)*b-an)b-an.nis often called the number of point in the approximation. (This is thenumerical integration using the rectangle rule. You can learn more athttps://en.wikipedia.org/wiki/Numerical_integration.)Note that you do not need to understand numerical integration.The problem is just to evaluate∑n-1i=0f(a+ (i+.5)*b-an)b-anfor particular a particular combination ofa,b,n, andf.Question:Implement a sequential code that compute a numerical integration of a functiondouble f(double)betweenargv[1]andargv[2]usingargv[3]points.Note that if you pickfto be a known function, you can easily check for correctness. (I suggest you pickf(x) = 1.) Also, writing the code so that the integration loop is with integers (over the number of points)will make your life easier in the next part.Question:Write the code so that you can use different functionsfthat have different operation intensitiesargv[4].(An easy way to do that, is to havefstart from a value of 1 and executeargv[4]loops of squaring withpowand square rooting withsqrt.)Question:Report the sequential time it takes on the cluster to integratefusing different number of points(from 101to 108by multiple of 10) and with different operation intensity (from 1 to 103).Make sure you keep this code around as it is your base for comparisons. Also note that a 108points withan operation intensity of 1,000 could take an hour to run.1