-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmarks.R
52 lines (36 loc) · 1009 Bytes
/
benchmarks.R
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
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#SBATCH --job-name=epiworld-benchmark
#SBATCH --output=/uufs/chpc.utah.edu/common/home/vegayon-group1/george/epiworld-benchmark/benchmark.out
#SBATCH --account=vegayon-np
#SBATCH --partition=vegayon-np
library(slurmR)
library(data.table)
project_path <- "/uufs/chpc.utah.edu/common/home/vegayon-group1/george/epiworld-benchmark/"
bfiles <- list.files(pattern = "*.o$", full.names = FALSE)
nrep <- 1000
sizes <- c(1e4, 1e5, 1e6, 1e7)
res <- parallel::mclapply(
X = 1:nrep,
mc.cores = 40,
FUN = \(i) {
res <- NULL
for (s in sizes) {
# Measuring time in seconds
t0 <- proc.time()
system(sprintf("./%s %i %i", bfiles[1], 1, s))
t1 <- proc.time()
# Appending time
res <- rbind(
res,
data.table(
i = i,
size = s,
time = (t1 - t0)[3]
)
)
}
res
})
# compiling into single data.frame
res <-rbindlist(res)
fwrite(res, paste0(project_path, "benchmark.csv"))