Unable to use RAM memory in quantreg

不羁的心 提交于 2019-12-11 18:39:59

问题


I'm trying to run quantreg with 2 independent variables over the 12 555 029 cases. I have 16GB RAM on computer, 64Bit OS. Command memory.limit() returned 16 264. Command sessionInfo() returned:

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2   

During the execution of quantreg only up to 4GB is used. I saw this in task manager. It is not finished for more than one hour and I stopped it.

Why quantreg is not using other RAM available? How I can increase using of RAM memory?


回答1:


R cannot use the all RAM available on your system. There are some tricks to overcome limited RAM issue in R. R stores all data on the RAM so this is why the size of the data can be analyzed is limited to the amount of the RAM. What we should do is to reduce the size of the data and choose more efficient data types and some tricks to overcome this problem.

1 - Depends on the type of your data, you may change it's type. For instance, numeric values take more memory than integers.

2 - Use factors instead of characters where it is possible. Factors are more efficient because they store the levels instead of the whole vector.

3 - Use bit vectors if you have any logical variable without NA value. They take up only 1 bit while logical variables take 4 to 32 bits.

4 - Reuse your objects instead of creating new ones where it is possible and make sure that you call gc() when you delete some objects.

5 - You can save your big sized data, delete it and reload it when it is necessary.

6 - Have a look at bigmemory and ff packages.

7 - Close all other processes on your system because they are taking some amount of your RAM.

And you can have a look at the book titled 'R High Performance Programming' by Lim and Tjhi.

Hope it helps.



来源:https://stackoverflow.com/questions/54289404/unable-to-use-ram-memory-in-quantreg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!