the time of running program increased by increasing the number of threads

the time of running program increased by increasing the number of threads

Hi,By increasing the number of threads, the time of running the program increasedhow can i solve this problem ???thanks,

4 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Without source, or some clue what you're doing, we can only guess.

Possiibilities include

  • False Sharing - Here's an article on Avoiding and Identifying Fals Sharing Among Threads.
  • Using cilk_spawn in a loop - If you use a for loop and spawn tasks in it instead of using a cilk_for, you force the runtime to steal all of the remaining work. This imposes alot of overhead.
  • Using very small tasks - cilk_spawn is cheap, but it's not free. And it prevents some types of optimizations. If you're breaking your application into very small tasks, then you're spending alot of time on overhead. The poster child for this problem is the classic Fibinocci number calculation.
    1. But again, these are only guesses. Always remember the first law of improving performance; if you attempt to guess where you need to optimize, you'llalmost always be incorrect. You'll need to use some sort of profiling tool to figure out where you're spending your time.

      - Barry

    Hi ,the overhead timemay beis thanks to the context switching between threads ?if this is the problem how can i solve it ?thanks,

    Have you run Cilkview? It's output may help. Provide clues. There's information in the cilktools.html file (in the doc directory) in the section "What the Profile Numbers Mean" which help you interpret the output.

    - Barry

    Connectez-vous pour laisser un commentaire.