Skip to content
Prev 343381 / 398506 Next

bam (mgcv) not using the specified number of cores

Hi Andrew,

In some of the shots you sent then top was reporting several cores 
working. I think the problem here may be to do with the way bam is 
parallelized - at present only part of the computation is in parallel - 
the model matrix QR decomposition part. The smoothing parameter 
selection is still single cored (although we are working on that), so if 
you watch top, you'll usually see multi-core and single core phases 
alternating with each other. The strategy works best in n>>p situations 
with few smoothing parameters.

For the case where you used 31 cores, there was a bug in earlier mgcv 
versions in which it was assumed that when the model matrix is split 
into chunks for processing, each chunk would have more rows than 
columns. If you upgrade to the current mgcv version then this is fixed. 
However using 31 cores is liable to actually be less efficient than 
using fewer cores with the n to p (number of data to number of 
coefficients) ratio that you seem to have. This is because the work 
being done by each core is rather little, so that the overhead of 
stitching the cores' work back together becomes too high. Using 
'use.chol=TRUE' would reduce the overheads here (although it uses a 
slightly less stable algorithm than the default).

best,
Simon
On 22/08/14 06:13, Andrew Crane-Droesch wrote: