Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让R脚本在mosix集群上并行运行?_R_Mosix - Fatal编程技术网

如何让R脚本在mosix集群上并行运行?

如何让R脚本在mosix集群上并行运行?,r,mosix,R,Mosix,我试图重新创建的示例在的第3部分中给出,它在集群管理的多个实例上执行简单的计算。主要计算发生在脚本“sim.R”中: 这让我想到程序从未运行或进入集群队列。我还使用“top”命令检查了系统进程,没有发现任何问题。在记录中,我已经成功地在MoS6集群上运行简单的C++程序。 我是否错过了让该程序运行的关键细节?如果将rbatch.local.run()移动到循环之外会发生什么?@MrFlick我得到了相同的输出,尽管它以:rbatch.local.run()rbatch.local.run()结尾

我试图重新创建的示例在的第3部分中给出,它在集群管理的多个实例上执行简单的计算。主要计算发生在脚本“sim.R”中:

这让我想到程序从未运行或进入集群队列。我还使用“top”命令检查了系统进程,没有发现任何问题。在记录中,我已经成功地在MoS6集群上运行简单的C++程序。
我是否错过了让该程序运行的关键细节?

如果将
rbatch.local.run()
移动到循环之外会发生什么?@MrFlick我得到了相同的输出,尽管它以:rbatch.local.run()rbatch.local.run()结尾:没有批处理任何命令。空>
# sim.R
# If the "batch" package has not been installed, run the line below:
# install.packages("batch", repos = "http://cran.cnr.Berkeley.edu")
seed <- 1000
n <- 50
nsim <- 10000
mu <- c(0, 0.5)
sd <- c(1, 1)
library("batch")

parseCommandArgs()
set.seed(seed)
pvalue <- rep(0,nsim)

for(i in 1:nsim) {
        X <- rnorm(n = n, mean = mu[1], sd = sd[1])
        Y <- rnorm(n = n, mean = mu[2], sd = sd[2])
        pvalue[i] <- t.test(X, Y)$p.value
}
power <- mean(pvalue <= 0.05)

out <- data.frame(seed = seed, nsim = nsim, n = n,
        mu = paste(mu, collapse = ","),
        sd = paste(sd, collapse = ","), power = power)
outfilename <- paste("res", seed, ".csv", sep = "")
print(out)
write.csv(out, outfilename, row.names = FALSE)
library("batch")
seed <- 1000
for(i in 1:10) {
        seed <- rbatch("sim.R", seed = seed, n = 25, mu = c(0, i / 10))
        rbatch.local.run() # My understanding from the linked paper is that this line will do nothing if the script is run on a mosix cluster and not locally.
}
R --vanilla --args RBATCH mosix < param-sim.R
$ R --vanilla --args RBATCH mosix < param-sim.R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library("batch")
> seed <- 1000
> for(i in 1:10) {
+   seed <- rbatch("sim.R", seed = seed, n = 25, mu = c(0, i / 10))
+   rbatch.local.run()
+ }
nohup mosrun -e -b -q R --vanilla --args  seed 1000 n 25 mu "c(0,0.1)" < sim.R > sim.Rout1000 & 
rbatch.local.run: no commands have been batched.
nohup: redirecting stderr to stdout
nohup mosrun -e -b -q R --vanilla --args  seed 1001 n 25 mu "c(0,0.2)" < sim.R > sim.Rout1001 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1002 n 25 mu "c(0,0.3)" < sim.R > sim.Rout1002 & 
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1003 n 25 mu "c(0,0.4)" < sim.R > sim.Rout1003 & nohup: 
redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1004 n 25 mu "c(0,0.5)" < sim.R > sim.Rout1004 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1005 n 25 mu "c(0,0.6)" < sim.R > sim.Rout1005 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1006 n 25 mu "c(0,0.7)" < sim.R > sim.Rout1006 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1007 n 25 mu "c(0,0.8)" < sim.R > sim.Rout1007 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1008 n 25 mu "c(0,0.9)" < sim.R > sim.Rout1008 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
nohup mosrun -e -b -q R --vanilla --args  seed 1009 n 25 mu "c(0,1)" < sim.R > sim.Rout1009 & 
nohup: redirecting stderr to stdout
rbatch.local.run: no commands have been batched.
> 
nohup: redirecting stderr to stdout
mosrun - MOSIX Version 4.3.4
Usage: mosrun [location-options] [program-options] {program} [args]...
       mosrun -S{maxjobs} [location-options] [program-options]
                                                {commands-file}[,{failed-file}]
       mosrun -R{filename} [-O{fd=filename}][,{fd2=fn2}]... [location-options]

       mosrun -I{filename}

  Location options - Node specification:
        -b                      try to start on 'best' available node
        -r{hostname}            start on given host
        -{a.b.c.d}              start on the node of given IP address
        -{n}                    start on given logical node number
        -h                      start on home node
  Other location options:
        -F                      do not fail if requested node is not available
        -L                      lock, disallow automatic migration
        -l                      unlock, allowing automatic migration
        -g                      disallow automatic freezing
        -G                      allow automatic freezing
        -m{mb}                  try to run only on nodes with >= mb free memory
        -A {minutes}            auto checkpoint interval in minutes (0-10000000)
        -N {max}                max. # of checkpoints before cycle (0-10000000)
  Program options:
        -e                      unsupported system calls produce -1/errno=ENOSYS
        -w                      as -e, but print warnings for unsupported calls
        -u                      unsupported system calls kill mosrun (default)
        -d {0-10000}            specify decay rate per second in parts of 10000
        -c                      consider program as a pure CPU job (ignore I/O)
        -n                      reverse '-c', so to include I/O considerations
        -C{filename}            test given checkpoint file
        -X{/directory}          declare private directory
        -z                      program arguments start at argument #0 (not #1)