Zhiguang Huo (Caleb)
Monday September 20, 2017
Some exercises:
cp saveCars.R /ufrc/phc6068/your directory
cat saveCars.sh
You can transfer files between your local computer and hiperGator
setwd("/ufrc/phc6068/share/zhuo/testR") ## change to your own directory!
mycars <- mtcars
write.csv(mycars,"mycars.csv")
#!/bin/sh
#SBATCH --job-name=serial_job_test # Job name
#SBATCH --account=phc6068 # your own sponser or account from this class
#SBATCH --qos=phc6068 # your own sponser or account from this class
#SBATCH --mail-type=ALL # Mail events
#SBATCH --mail-user=xx@xx.xx # Where to send mail
#SBATCH --ntasks=1 # Run on a single CPU
#SBATCH --mem=1gb # Memory limit
#SBATCH --time=00:05:00 # Time: hrs:min:sec
#SBATCH --output=serial_test_%j.out # Output and error log
pwd; hostname; date
module load R
echo "Running save cars script on a single CPU core"
R CMD BATCH saveCars.R
## R --no-save --quiet --slave < saveCars.R
date
cd /ufrc/phc6068/share/zhuo/testR
sbatch saveCars.sh ## submit job
srun --account=phc6068 --qos=phc6068 --ntasks=1 --mem=1gb --time=00:05:00 --pty bash -i ## open interactive R session
module load R ## load R
R
args = commandArgs(trailingOnly = TRUE) ## order aalpha, S, sigmaNoise, sigma_0
rowID <- args[1]
aarg <- as.numeric(rowID)
setwd("/ufrc/phc6068/share/zhuo/testR")
mycars <- mtcars[aarg,]
filename <- paste0("arg",aarg,".csv")
write.csv(mycars,filename)
#!/bin/sh
#SBATCH --job-name=serial_job_test # Job name
#SBATCH --account=phc6068 # your own sponser or account from this class
#SBATCH --qos=phc6068 # your own sponser or account from this class
#SBATCH --mail-type=ALL # Mail events
#SBATCH --mail-user=xx@xx.xx # Where to send mail
#SBATCH --ntasks=1 # Run on a single CPU
#SBATCH --mem=1gb # Memory limit
#SBATCH --time=00:05:00 # Time: hrs:min:sec
#SBATCH --output=serial_test_%j.out # Output and error log
pwd; hostname; date
module load R
echo "Running save cars script on a single CPU core"
R --no-save --quiet --slave --args 1 < saveCarsArgs.R
date
cd /ufrc/phc6068/share/zhuo/testR
sbatch saveCarsArgs.sh ## submit job
#!/bin/sh
#SBATCH --job-name=serial_job_test # Job name
#SBATCH --account=phc6068 # your own sponser or account from this class
#SBATCH --qos=phc6068 # your own sponser or account from this class
#SBATCH --mail-type=ALL # Mail events
#SBATCH --mail-user=xx@xx.xx # Where to send mail
#SBATCH --ntasks=1 # Run on a single CPU
#SBATCH --mem=1gb # Memory limit
#SBATCH --time=00:05:00 # Time: hrs:min:sec
#SBATCH --output=serial_test_%j.out # Output and error log
pwd; hostname; date
module load R
for i in {2..10}
do
echo "Running save cars" $i
R --no-save --quiet --slave --args $i < saveCarsArgs.R
done
date
cd /ufrc/phc6068/share/zhuo/testR
sbatch saveCarsLoops.sh ## submit a loop job