[R] random number generator in batch jobs
Jiqiu.Cheng at biw.kuleuven.be
Mon Jul 30 11:42:44 CEST 2007
I want to submit R batch jobs (e.g. 5) under the linux cluster by
the script file "do_mul".
The script file "do_mul"
for var in $(seq 1 5)
qsub -v var do_test
Through "do_mul", 5 "do_test" script files are submitted to the cluster.
The script file "do_test":
#PBS -l ncpus=1
#PBS -l walltime=0:05:00
module load R/2.5.0
R --vanilla< test
The content in R file "test" is :
I expect to have different samples each time. However, for these 5
replications, the first 3 jobs giving me the same samples and the last
2 are the same. I'm confused because I already used "R --vanilla" to
avoid loading same workspace each time and "rm(list=ls(all=TRUE))" to
remove the same random seed each time. Why do same samples still
happen among 5 replications? Does anybody have some ideas to solve
this problem? Looking forward to your reply, thanks.
More information about the R-help