![]() ![]() And if the tasks and number of iterations vary in size, then it’s really hard to know which loop to parallelize.īut in our Monte Carlo example, all of the tasks are completely independent of each other, and so they can all be executed in parallel. You could parallelize an inner loop instead, but that could be inefficient because you’re repeatedly waiting for all the results to be returned every time through the outer loop. However, if the outer loop doesn’t have many iterations and the tasks are already large, parallelizing the outer loop results in a small number of huge tasks, which may not allow you to use all of your processors, and can also result in load balancing problems. This results in larger individual tasks, and larger tasks can often be performed more efficiently than smaller tasks. The standard advice is to parallelize the outer loop. When parallelizing nested for loops, there is always a question of which loop to parallelize. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |