-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecuteExample.R
More file actions
36 lines (30 loc) · 899 Bytes
/
executeExample.R
File metadata and controls
36 lines (30 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# clear all
rm(list=ls(all=TRUE))
# load packages
library(BatchJobs)
# Source
source("calcCorrelationParallel.R")
# Settings
# number of columns per chunk
colsPerPart <- 400
# name for BatchJobs
regName <- "calcCorrelation"
# sample data
data <- matrix(rnorm(1e6), ncol=1000)
# delete old BatchJob
if (FALSE) {
unlink(paste0(regName, "-files"), recursive=TRUE)
}
# create BatchJobs registry
reg <- makeRegistry(regName)
# calculate correlation matrix
corMatrix <- calcCorrelationPar(reg, resources=list(walltime=1800, memory=1024)
, data
, colsPerPart
, corUse="pairwise.complete.obs"
, blnTestMode=FALSE
)
# if all jobs succeed, save correlation matrix
if (length(findErrors(reg)) == 0) {
save(corMatrix, file="corMatrix.RData")
}