Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

how to adjust future.global.maxSize in R?

Can anyone help me figure out how to change the max size of global objects passed to an item in the future package?

Here's a useless example that shows my point

library(future)
a = 1:200000000
object.size(a)
test %<-% head(a)

I get the following error:

Error in getGlobalsAndPackages(expr, envir = envir, persistent = persistent, : The total size of all global objects that need to be exported for the future expression (‘head(a)’) is 762.95 MiB. This exceeds the maximum allowed size of 500.00 MiB (option 'future.global.maxSize'). There are two globals: ‘a’ (762.94 MiB of class ‘numeric’) and ‘head’ (10.05 KiB of class ‘function’).

Can anyone help me understand how to adjust that future.global.maxSize option? I tried options(future.global.maxSize = 1500000) but that didn't work.

question from:https://stackoverflow.com/questions/40536067/how-to-adjust-future-global-maxsize-in-r

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Got it figured out and learned how you can edit options for any package.

This is the line that I used (edit: the change was from 'global' to 'globals':

options(future.globals.maxSize= 891289600)

If you want to customize your limit, I saw in the package source that the limit was calculated and this is how you would calculate the size for an 850mb limit:

850*1024^2 = 891289600

Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...