HPCE / hpce-2017-cw5

1 stars 6 forks source link

Can something executed in parallel be slower than a sequential version (with a slight change in code logic)? #49

Closed Afraz496 closed 6 years ago

Afraz496 commented 6 years ago

Hi,

I have a more subjective question that came about during my work on one of the puzzles. Where I was able to make a problem execute in parallel instead of sequential without any 'known' overhead I take on after my conversion of the block of code. It takes around 3 minutes to do the exact same thing in parallel against a 1 minute execution time in the sequential version. I would love to be more specific about the problem but that would go against the requirements of this assignment. Again can something done in parallel which is pretty much what is done in the sequential version be slower?

Platform: Mac OS X (using the CPU right now)

other tidbits to the problem: user time is 1m38 seconds and real time is 24.083 seconds. (for the parallel version) with a 12 second real time and 10 second user time in the sequential version.

m8pple commented 6 years ago

Yes, it can definitely be slower. Some common causes are:

You should probably try playing with agglomeration/grain-size first, including making it so big that there is only one task and see if it is the same speed as sequential. Then using a sampling profiler like perf might lead you to a particularly contended or slow area of code (compared to the profile for the over-agglomerated version).