RStan可以在超级计算机上运行吗? [英] Will RStan run on a supercomputer?

查看:168
本文介绍了RStan可以在超级计算机上运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Stan是 Gelman等人提出的一种新的贝叶斯分析软件.

我猜想RStan是从R内部调用Stan的一种方式.

Stan/RStan能否在具有Linux操作系统的超级计算机上运行,​​如果可以,它是否可以利用超级计算机的多处理器优势?有人告诉我WinBUGS不能在Linux机器上运行和/或不能利用超级计算机的多处理器.

我正在寻找一种加快贝叶斯分析的方法-从几周到几天/几小时.

解决方案

Stan和rstan应该在支持依赖项的Linux,Mac或Windows上运行.我们尚未在BSD或Oracle上进行测试,但是我们希望它们可以与g ++或clang编译器(尽管不是Oracle编译器)一起使用.

在Stan或rstan中没有明确的并行代码,但是也没有任何代码可以阻止二进制文件同时由多个进程执行.例如,如果您在bash shell中从命令行使用Stan,则可以执行类似

的操作

./my_model --data=my_data.dump --seed=12345 --chain_id=1 --samples=samples_1.csv &
./my_model --data=my_data.dump --seed=12345 --chain_id=2 --samples=samples_2.csv &

,依您的喜好,选择尽可能多的连锁店.并行执行时,使用相同的种子但使用不同的chain_id非常重要.

如果使用的是rstan软件包,则可以使用R和您的操作系统支持的任何并行引擎来调用主stan()函数.同样,最好传递相同的种子和不同的chain_id.从rstan v1.0.3(尚未发布)开始,有一个名为sflist2stanfit()的函数,该函数获取可能并行生成的stanfit对象的列表,并将它们组合为单个stanfit对象以进行分析.

有关更多信息,有一个专门用于并行执行的线程

https://groups.google.com/d/topic/stan-users/3goteHAsJGs/讨论

Stan is a new Bayesian analysis software by Gelman et al.

RStan is, I am guessing, a way to call Stan from within R.

Will Stan / RStan run on a supercomputer with a Linux operating system, and if so can it take advantage of the super-computer's multi-processors? I have been told that WinBUGS will not run on a Linux machine and/or cannot take advantage of a supercomputer's multi-processors.

I am looking for a way to speed up Bayesian analyses - from weeks to days / hours.

解决方案

Stan and rstan should run on Linux, Mac, or Windows that supports the dependencies. We have not tested on BSD or Oracle, but we expect them to work with either the g++ or clang compilers (although not the Oracle compilers).

There is no explicitly parallel code in Stan or rstan but neither is there any code that prevents the binary from being executed by several processes simultaneously. For example, if you use Stan from the command line in a bash shell, you could do something like

./my_model --data=my_data.dump --seed=12345 --chain_id=1 --samples=samples_1.csv &
./my_model --data=my_data.dump --seed=12345 --chain_id=2 --samples=samples_2.csv &

and so forth for as many chains as you like. It is important to use the same seed but different chain_id when executing in parallel.

If you are using the rstan package, you can call the main stan() function using any of the parallel engines supported by R and your operating system. Again, it is best to pass the same seed and different chain_id. As of rstan v1.0.3 (not released yet), there is a function called sflist2stanfit() that takes a list of stanfit objects that may have been generated in parallel and combines them into a single stanfit object for analysis.

For more information, there is a thread devoted to parallel execution at

https://groups.google.com/d/topic/stan-users/3goteHAsJGs/discussion

这篇关于RStan可以在超级计算机上运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆