On Thursday, 24 June 2021 at 21:05:28 UTC, Bastiaan Veelo wrote:
On Thursday, 24 June 2021 at 20:41:40 UTC, seany wrote:
Is there any way to control the number of CPU cores used in
parallelization ?
E.g : take 3 cores for the first parallel foreach - and then
for the second one, take 3 cores each -> so 3 + 3 * 3 = 12
cores out of a 16 core system? Thank you.
There might be, by using various `TaskPool`s with a smaller
number of work threads:
https://dlang.org/phobos/std_parallelism.html#.TaskPool.this.2.
But I cannot see the benefit of doing this. It will just
distribute the same amount of work in a different way.
Actually, I think this would be suboptimal as well, as the three
outer threads seem to do no real work.
— Bastiaan.