Previous | Next --- Slide 19 of 59
Back to Lecture Thumbnails
yey1

Suppose we need to the square root of each element in a array. If we have N elements, should we always launch N tasks? Since ISPC will do load balancing for me.

Iamme

If you look at the ISPC User's Guide (https://ispc.github.io/ispc.html#task-parallelism-launch-and-sync-statements), it says: "In general, one should launch many more tasks than there are processors in the system to ensure good load-balancing, but not so many that the overhead of scheduling and running tasks dominates the computation."

Based on that, I would guess it depends on how large N is. If N is too large, it seems it could actually slow down the computation to launch N tasks because scheduling becomes overly complicated.

BBB

I don't think scheduling will get any more complicated with more tasks with ISPC's pool-based assignment policy. Each assignment should be O(1) I think the slowdown is because worker threads have to go lookup many more tasks. So while getting the next task is just as fast, each thread has to make that lookup more often, which means more total time is spent on overhead.

caiqifang

How do I find out that how many worker threads are created by ISPC on my machine?