【问题标题】:Including progress bar in R cluster在 R 集群中包含进度条
【发布时间】:2020-04-16 14:57:51
【问题描述】:

我正在使用 R raster 库中的 cluster 来加快在 sdm 模型上运行预测时的处理时间。但是,即使使用了所有可用的内核 (35),也需要很长时间。是否可以合并一个进度条以便我可以查看它的进度?当我在没有cluster的情况下使用predict时,可以显示进度;

pb <- predict(pred_nf, bc, ext=ext, progress='text')  

但是,当我将它包含在集群中时它不会出现

beginCluster()
pb <- clusterR(pred_nf, predict, args=list(bc, ext=ext, progress='text'))
endCluster()

有没有人可以解决这个问题?

【问题讨论】:

    标签: r r-raster


    【解决方案1】:

    我认为您需要将进度条码放在右括号之外。

    试试这个:

       # create a cluster and ID the # of cores to use
        beginCluster(3)
    
        #predict fxn using clusterR
        r.prob.Cluster<-clusterR(logo, predict, args=list(model.RF),
        progress='text', type='prob')
    
        endCluster() #delete the cluster
    

    【讨论】:

    • 谢谢。我能够使用以下更改执行代码。您的代码中 r.prob 的用途是什么? 'beginCluster()' 'pb
    • 很高兴它起作用了 - 请考虑接受我的回答(单击复选标记),以便其他人知道这是解决方案。 r.prob.Cluster 只是我的代码中输出栅格的名称。我正在运行测试,生成带有和不带有集群的输出(如果有兴趣,请参阅:timassal.com/?p=1920)。 type='prob' 是这样的,所以输出是在概率尺度上返回的。
    猜你喜欢
    • 1970-01-01
    • 2011-02-07
    • 2019-06-14
    • 2021-10-06
    • 2016-02-13
    • 2012-05-14
    • 2020-11-05
    • 2020-10-10
    • 2020-12-05
    相关资源
    最近更新 更多