-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
155 lines (126 loc) · 3.81 KB
/
README.Rmd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# benchtorch
<!-- badges: start -->
<!-- badges: end -->
This repository contains code that is used to benchmark torch.
A job runs daily and saves the results in the `results` directory.
Benchmarks are run in a docker container in system equipped with:
- Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
- NVIDIA Corporation GP102 [GeForce GTX 1080 Ti]
## Installation
You can reproduce the benchmark by running:
```sh
./tools/setup.sh
```
Then in a R window run:
```
benchmark::run_benchmarks()
```
## Analysing
Results are published to the `results` directory and can be parsed with
basic tidyverse commands, for example:
<details>
```{r, eval = FALSE}
library(tidymodels)
library(jsonlite)
prepare_line <- function(x) {
x %>%
modify_at("config", list) %>%
as_tibble()
}
results <- read_json("results/2022-10-21/5a19157-results.json") %>%
map_dfr(prepare_line) %>%
unnest_wider(config, transform = as.character) %>%
mutate(
name = as.character(name),
version = as.character(version),
BATCH_SIZE = as.numeric(BATCH_SIZE),
ITER = as.numeric(ITER),
time = readr::parse_number(as.character(time)),
platform = as.character(platform)
) %>%
mutate(time = time/ITER)
py_reference <- results %>%
filter(LANGUAGE == "py") %>%
group_by(name, BATCH_SIZE, DEVICE) %>%
summarise(
time_py = mean(time, trim = 0.2, na.rm = TRUE),
.groups = "drop"
)
r_results <- results %>%
filter(LANGUAGE == "r") %>%
group_by(VERSION, name, BATCH_SIZE, DEVICE, VECTORIZED_DS) %>%
summarise(
time_r = mean(time, trim = 0.2, na.rm = TRUE),
.groups = "drop"
) %>%
left_join(py_reference, by = c("name", "BATCH_SIZE", "DEVICE")) %>%
mutate(time_rel = time_r/time_py)
r_results %>%
filter(DEVICE == "cuda") %>%
replace_na(list(VECTORIZED_DS = "")) %>%
ggplot(aes(x = BATCH_SIZE, y = time_rel, color = VERSION)) +
geom_point(aes(shape = VECTORIZED_DS)) +
geom_line(aes(linetype = VECTORIZED_DS)) +
facet_wrap(~name, ncol = 3, scales = "free") +
geom_hline(yintercept = 1, aes(color = "python"), linetype = "dashed") +
scale_shape(guide = "none")
```
</details>
```{r python, echo=FALSE, message=FALSE, warning=FALSE}
library(tidymodels)
library(jsonlite)
prepare_line <- function(x) {
x %>%
modify_at("config", list) %>%
as_tibble()
}
results <- read_json("results/2022-10-21/5a19157-results.json") %>%
map_dfr(prepare_line) %>%
unnest_wider(config, transform = as.character) %>%
mutate(
name = as.character(name),
version = as.character(version),
BATCH_SIZE = as.numeric(BATCH_SIZE),
ITER = as.numeric(ITER),
time = readr::parse_number(as.character(time)),
platform = as.character(platform)
) %>%
mutate(time = time/ITER)
py_reference <- results %>%
filter(LANGUAGE == "py") %>%
group_by(name, BATCH_SIZE, DEVICE) %>%
summarise(
time_py = mean(time, trim = 0.2, na.rm = TRUE),
.groups = "drop"
)
r_results <- results %>%
filter(LANGUAGE == "r") %>%
group_by(VERSION, name, BATCH_SIZE, DEVICE, VECTORIZED_DS) %>%
summarise(
time_r = mean(time, trim = 0.2, na.rm = TRUE),
.groups = "drop"
) %>%
left_join(py_reference, by = c("name", "BATCH_SIZE", "DEVICE")) %>%
mutate(time_rel = time_r/time_py)
r_results %>%
filter(DEVICE == "cuda") %>%
replace_na(list(VECTORIZED_DS = "")) %>%
ggplot(aes(x = BATCH_SIZE, y = time_rel, color = VERSION)) +
geom_point(aes(shape = VECTORIZED_DS)) +
geom_line(aes(linetype = VECTORIZED_DS)) +
facet_wrap(~name, ncol = 3, scales = "free") +
geom_hline(yintercept = 1, aes(color = "python"), linetype = "dashed") +
scale_shape(guide = "none")
```