helen:ms02GINPPI hqin$ cat example.R
#20150914 testing parallel jobs on greenfield
# R CMD BATCH ./example.R --args 2 35 red
rm(list=ls())
source("lifespan.r")
source("network.r")
#R -f file --args start end
options(echo=TRUE) # if you want see commands in output file
args <- commandArgs(trailingOnly = TRUE)
print(args)
# trailingOnly=TRUE means that only your arguments are returned, check:
# print(commandsArgs(trailingOnly=FALSE))
start = as.integer(args[1]); start;
end = as.integer(args[2]); end;
tag = args[3]
myhost = 'greenfield' # 'byte' 'blacklight' 'mactower'
myhost = 'byte' # 'byte' 'blacklight' 'mactower'
myhost = 'helen' # 'byte' 'blacklight' 'helen'
mydir = "/crucible/mc48o9p/hqin2/mactower-network-failure-simulation-master/ms02GINPPI"
if (myhost == 'byte') { mydir = "/Users/hqin/github/mactower-network-failure-simulation/ms02GINPPI"
} else if (myhost == 'helen') { mydir = "/Users/hqin/github/mactower-network-failure-simulation/ms02GINPPI";
}
print(paste("current dir is:", mydir))
list.files()
getwd()
print(paste("Now setwd"))
setwd(mydir)
list.files()
debug = 0;
x = start:end
outfile = paste( tag, start, end, "tab", sep='.')
write.csv( x, outfile, row.names=F)
[hqin2@greenfield ms02GINPPI]$ cat example.pbs
#!/bin/bash
# Request 15 cores
#PBS -l nodes=1:ppn=15
# Request 1hr of cpu time
#PBS -l walltime=0:00:01:00
module load R/3.2.1-mkl
echo hostname
pwd
cd /crucible/mc48o9p/hqin2/mactower-network-failure-simulation-master/ms02GINPPI
pwd
numactl -C +0 R --vanilla --slave -f ./example.R --args 1 199999 '_zero' &
numactl -C +1 R --vanilla --slave -f ./example.R --args 2 299999 '_one' &
numactl -C +2 R --vanilla --slave -f ./example.R --args 3 399999 '_two' &
numactl -C +3 R --vanilla --slave -f ./example.R --args 4 499999 '_three' &
numactl -C +4 R --vanilla --slave -f ./example.R --args 4 499999 '_four' &
numactl -C +5 R --vanilla --slave -f ./example.R --args 4 499999 '_five' &
numactl -C +6 R --vanilla --slave -f ./example.R --args 4 499999 '_six' &
numactl -C +7 R --vanilla --slave -f ./example.R --args 4 499999 '_seven' &
numactl -C +8 R --vanilla --slave -f ./example.R --args 4 499999 '_eight' &
numactl -C +9 R --vanilla --slave -f ./example.R --args 4 499999 '_nine' &
wait
No comments:
Post a Comment