Repository navigation
Closed
Labels
Milestone
Description
While running grouping benchmark on 2e9 rows dataset (96GB csv) using recent stable data.table 1.13.2 I am getting following exception:
> system.time( DT[, sum(v1), keyby=id1] )
Error in gforce(thisEnv, jsub, o__, f__, len__, irows) :
Internal error: Failed to allocate counts or TMP when assigning g in gforce
Calls: system.time -> [ -> [.data.table -> gforce
Line 116 in 8480b6a
| if (!counts || !TMP ) error(_("Internal error: Failed to allocate counts or TMP when assigning g in gforce")); |
It is the same machine as the one used in 2014: 32 cores and 244GB memory.
I run data.table 1.9.2 as well to ensure that version which previously worked fine for this data size continue to work on a recent R version.
> system.time( DT[, sum(v1), keyby=id1] )
user system elapsed
58.113 17.098 75.219
> system.time( DT[, sum(v1), keyby=id1] )
user system elapsed
59.185 15.303 74.496
> system.time( DT[, sum(v1), keyby="id1,id2"] )
user system elapsed
180.160 19.953 200.137
> system.time( DT[, sum(v1), keyby="id1,id2"] )
user system elapsed
204.208 39.651 243.889
> system.time( DT[, list(sum(v1),mean(v3)), keyby=id3] )
user system elapsed
1037.451 51.269 1088.853
> system.time( DT[, list(sum(v1),mean(v3)), keyby=id3] )
user system elapsed
1023.068 29.556 1052.753
> system.time( DT[, lapply(.SD, mean), keyby=id4, .SDcols=7:9] )
user system elapsed
73.123 18.026 91.160
> system.time( DT[, lapply(.SD, mean), keyby=id4, .SDcols=7:9] )
user system elapsed
70.523 8.951 79.483
> system.time( DT[, lapply(.SD, sum), keyby=id6, .SDcols=7:9] )
user system elapsed
489.294 36.192 525.548
> system.time( DT[, lapply(.SD, sum), keyby=id6, .SDcols=7:9] )
user system elapsed
488.316 28.808 517.188
Timings are slower than they were in the past, but AFAIK this is what we observed in other issues: newer version of R was introducing an overhead that data.table was later addressing in newer versions. So if users upgrade R, then they should also upgrade data.table.
Activity
jangorecki commentedon Nov 22, 2020
I tweaked little bit the error message
and we now know that it is allocation of
TMPthat is failingdata.table/src/gsumm.c
Line 115 in 8480b6a
which in case of 2e9 rows is trying to allocate 1.6e+10 bytes which is around 15GB.
/usr/bin/time -vof R process shows it used 195GB peak memoryMachine (another one) is 64 cores and 256GB mem machine, looking at
free -hwe seebuff/cachetakes 45GB thus we have only 200GB "free" mem but according to https://www.linuxatemyram.com/ it is the "available" mem that we should care about, and that looks good.jangorecki commentedon Nov 25, 2020
I tried scaling up memory to 488GB machine
R 4.0.3, peak memory was again 195GB despite having much more available memory.
ColeMiller1 commentedon Dec 4, 2020
I thought #4295 had been closed. Does #4297 fix this?
jangorecki commentedon Dec 4, 2020
Thanks, yes it seems to be duplicate of #4818. Not closing yet to ensure that fix or the other issue will resolve this.
jangorecki commentedon Dec 10, 2020
I re-run latest master to ensure issue is fix. Below are the timings using default 50% cores and 100% as well. Comparing to data.table 1.9.2 (Feb 2014), running on R 4.0.3, timings are from 2 up to 10 times smaller in recent master.
Using 16 cores (50%)
Using 32 cores (100%)