I have used Cilk Plus to make my code computing parallel. But PC is installed Windows XP3, Intel Core i3, how many workers should I set to make the best performance for my code ?
Thanks of all,
You're probably best off letting the Cilk runtime determine how many cores there are on the machine. By default it will create a worker per core.
Assuming that you've exposed enough parallelism, the workstealing scheduler should distribute the workload to the cores efficiently. A rough estimate is that there should be approximately 10*C tasks, where "C" is the number of cores on your system. But don't spend too much time tuning that. You probably want to have some extra tasks, so if you move your workload into a system with more cores, there is enough parallelism to keep that system busy too.
If you use a cilk_for loop, it will automatically break your range into approximately 8*C tasks, assuming your range is large enough.
I control breaking my range by using #pragma grainsize = expression to set the grain size for one cilk_for loop, but compiler throws an error "It is a # pragma that can not be identified: warning # 161". How can I resolve it ?
Thanks and Best Regards,
The pragma is
#pragma cilk grainsize = expression