nbody: fix indentation in baseline R script
This commit is contained in:
parent
133ef50bb4
commit
26ab2d9bbd
@ -12,7 +12,7 @@ if (length(args)>0) { input_file = args[1] }
|
|||||||
|
|
||||||
# Load the dataset in NDJSON format
|
# Load the dataset in NDJSON format
|
||||||
dataset = jsonlite::stream_in(file(input_file)) %>%
|
dataset = jsonlite::stream_in(file(input_file)) %>%
|
||||||
jsonlite::flatten()
|
jsonlite::flatten()
|
||||||
|
|
||||||
particles = unique(dataset$config.particles)
|
particles = unique(dataset$config.particles)
|
||||||
|
|
||||||
@ -25,12 +25,12 @@ df = select(dataset,
|
|||||||
config.particles,
|
config.particles,
|
||||||
config.gitBranch,
|
config.gitBranch,
|
||||||
time) %>%
|
time) %>%
|
||||||
rename(nblocks=config.nblocks,
|
rename(nblocks=config.nblocks,
|
||||||
nodes=config.nodes,
|
nodes=config.nodes,
|
||||||
blocksize=config.blocksize,
|
blocksize=config.blocksize,
|
||||||
particles=config.particles,
|
particles=config.particles,
|
||||||
gitBranch=config.gitBranch,
|
gitBranch=config.gitBranch,
|
||||||
cpusPerSocket=config.hw.cpusPerSocket)
|
cpusPerSocket=config.hw.cpusPerSocket)
|
||||||
|
|
||||||
df = df %>% mutate(blocksPerCpu = nblocks / cpusPerSocket)
|
df = df %>% mutate(blocksPerCpu = nblocks / cpusPerSocket)
|
||||||
df$nblocks = as.factor(df$nblocks)
|
df$nblocks = as.factor(df$nblocks)
|
||||||
@ -42,22 +42,23 @@ df$gitBranch = as.factor(df$gitBranch)
|
|||||||
|
|
||||||
# Normalize the time by the median
|
# Normalize the time by the median
|
||||||
D=group_by(df, nblocks, nodesFactor, gitBranch) %>%
|
D=group_by(df, nblocks, nodesFactor, gitBranch) %>%
|
||||||
mutate(tmedian = median(time)) %>%
|
mutate(tmedian = median(time)) %>%
|
||||||
mutate(tnorm = time / median(time) - 1) %>%
|
mutate(tn = tmedian * nodes) %>%
|
||||||
mutate(bad = max(ifelse(abs(tnorm) >= 0.01, 1, 0))) %>%
|
mutate(tnorm = time / median(time) - 1) %>%
|
||||||
|
mutate(bad = max(ifelse(abs(tnorm) >= 0.01, 1, 0))) %>%
|
||||||
ungroup() %>%
|
ungroup() %>%
|
||||||
group_by(nodesFactor, gitBranch) %>%
|
group_by(nodesFactor, gitBranch) %>%
|
||||||
mutate(tmedian_min = min(tmedian)) %>%
|
mutate(tmedian_min = min(tmedian)) %>%
|
||||||
ungroup() %>%
|
ungroup() %>%
|
||||||
group_by(gitBranch) %>%
|
group_by(gitBranch) %>%
|
||||||
mutate(tmin_max = max(tmedian_min)) %>%
|
mutate(tmin_max = max(tmedian_min)) %>%
|
||||||
mutate(tideal = tmin_max / nodes) %>%
|
mutate(tideal = tmin_max / nodes) %>%
|
||||||
ungroup()
|
ungroup()
|
||||||
|
|
||||||
D$bad = as.factor(D$bad)
|
D$bad = as.factor(D$bad)
|
||||||
|
|
||||||
#D$bad = as.factor(ifelse(abs(D$tnorm) >= 0.01, 2,
|
#D$bad = as.factor(ifelse(abs(D$tnorm) >= 0.01, 2,
|
||||||
# ifelse(abs(D$tnorm) >= 0.005, 1, 0)))
|
# ifelse(abs(D$tnorm) >= 0.005, 1, 0)))
|
||||||
|
|
||||||
bs_unique = unique(df$nblocks)
|
bs_unique = unique(df$nblocks)
|
||||||
nbs=length(bs_unique)
|
nbs=length(bs_unique)
|
||||||
@ -75,34 +76,34 @@ png("box.png", width=w*ppi, height=h*ppi, res=ppi)
|
|||||||
# Create the plot with the normalized time vs nblocks
|
# Create the plot with the normalized time vs nblocks
|
||||||
p = ggplot(data=D, aes(x=blocksPerCpuFactor, y=tnorm, color=bad)) +
|
p = ggplot(data=D, aes(x=blocksPerCpuFactor, y=tnorm, color=bad)) +
|
||||||
|
|
||||||
# Labels
|
# Labels
|
||||||
labs(x="Blocks/CPU", y="Normalized time",
|
labs(x="Blocks/CPU", y="Normalized time",
|
||||||
title=sprintf("Nbody normalized time. Particles=%d", particles),
|
title=sprintf("Nbody normalized time. Particles=%d", particles),
|
||||||
subtitle=input_file) +
|
subtitle=input_file) +
|
||||||
|
|
||||||
|
|
||||||
# Center the title
|
# Center the title
|
||||||
#theme(plot.title = element_text(hjust = 0.5)) +
|
#theme(plot.title = element_text(hjust = 0.5)) +
|
||||||
|
|
||||||
# Black and white mode (useful for printing)
|
# Black and white mode (useful for printing)
|
||||||
#theme_bw() +
|
#theme_bw() +
|
||||||
|
|
||||||
# Add the maximum allowed error lines
|
# Add the maximum allowed error lines
|
||||||
geom_hline(yintercept=c(-0.01, 0.01),
|
geom_hline(yintercept=c(-0.01, 0.01),
|
||||||
linetype="dashed", color="gray") +
|
linetype="dashed", color="gray") +
|
||||||
|
|
||||||
# Draw boxplots
|
# Draw boxplots
|
||||||
geom_boxplot(aes(fill=nodesFactor)) +
|
geom_boxplot(aes(fill=nodesFactor)) +
|
||||||
scale_color_manual(values=c("black", "brown")) +
|
scale_color_manual(values=c("black", "brown")) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
|
|
||||||
#scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) +
|
#scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) +
|
||||||
|
|
||||||
|
|
||||||
#theme(legend.position = "none")
|
#theme(legend.position = "none")
|
||||||
#theme(legend.position = c(0.85, 0.85))
|
#theme(legend.position = c(0.85, 0.85))
|
||||||
theme_bw()+
|
theme_bw()+
|
||||||
theme(plot.subtitle=element_text(size=8))
|
theme(plot.subtitle=element_text(size=8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,20 +115,20 @@ dev.off()
|
|||||||
|
|
||||||
p1 = ggplot(D, aes(x=blocksizeFactor, y=time)) +
|
p1 = ggplot(D, aes(x=blocksizeFactor, y=time)) +
|
||||||
|
|
||||||
labs(x="Blocksize", y="Time (s)",
|
labs(x="Blocksize", y="Time (s)",
|
||||||
title=sprintf("Nbody granularity. Particles=%d", particles),
|
title=sprintf("Nbody granularity. Particles=%d", particles),
|
||||||
subtitle=input_file) +
|
subtitle=input_file) +
|
||||||
theme_bw() +
|
theme_bw() +
|
||||||
theme(plot.subtitle=element_text(size=8)) +
|
theme(plot.subtitle=element_text(size=8)) +
|
||||||
#theme(legend.position = c(0.5, 0.8)) +
|
#theme(legend.position = c(0.5, 0.8)) +
|
||||||
|
|
||||||
geom_line(aes(y=tmedian,
|
geom_line(aes(y=tmedian,
|
||||||
group=interaction(gitBranch, nodesFactor),
|
group=interaction(gitBranch, nodesFactor),
|
||||||
color=nodesFactor)) +
|
color=nodesFactor)) +
|
||||||
geom_point(aes(color=nodesFactor), size=3, shape=21) +
|
geom_point(aes(color=nodesFactor), size=3, shape=21) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
scale_shape_manual(values=c(21, 22)) +
|
scale_shape_manual(values=c(21, 22)) +
|
||||||
scale_y_continuous(trans=log2_trans())
|
scale_y_continuous(trans=log2_trans())
|
||||||
|
|
||||||
png("time-blocksize.png", width=w*ppi, height=h*ppi, res=ppi)
|
png("time-blocksize.png", width=w*ppi, height=h*ppi, res=ppi)
|
||||||
print(p1)
|
print(p1)
|
||||||
@ -135,20 +136,20 @@ dev.off()
|
|||||||
|
|
||||||
p2 = ggplot(D, aes(x=blocksPerCpuFactor, y=time)) +
|
p2 = ggplot(D, aes(x=blocksPerCpuFactor, y=time)) +
|
||||||
|
|
||||||
labs(x="Blocks/CPU", y="Time (s)",
|
labs(x="Blocks/CPU", y="Time (s)",
|
||||||
title=sprintf("Nbody granularity. Particles=%d", particles),
|
title=sprintf("Nbody granularity. Particles=%d", particles),
|
||||||
subtitle=input_file) +
|
subtitle=input_file) +
|
||||||
theme_bw() +
|
theme_bw() +
|
||||||
theme(plot.subtitle=element_text(size=8)) +
|
theme(plot.subtitle=element_text(size=8)) +
|
||||||
|
|
||||||
geom_line(aes(y=tmedian,
|
geom_line(aes(y=tmedian,
|
||||||
group=interaction(gitBranch, nodesFactor),
|
group=interaction(gitBranch, nodesFactor),
|
||||||
color=nodesFactor)) +
|
color=nodesFactor)) +
|
||||||
geom_point(aes(color=nodesFactor), size=3, shape=21) +
|
geom_point(aes(color=nodesFactor), size=3, shape=21) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
|
|
||||||
scale_shape_manual(values=c(21, 22)) +
|
scale_shape_manual(values=c(21, 22)) +
|
||||||
scale_y_continuous(trans=log2_trans())
|
scale_y_continuous(trans=log2_trans())
|
||||||
|
|
||||||
png("time-blocks-per-cpu.png", width=w*ppi, height=h*ppi, res=ppi)
|
png("time-blocks-per-cpu.png", width=w*ppi, height=h*ppi, res=ppi)
|
||||||
print(p2)
|
print(p2)
|
||||||
@ -163,37 +164,37 @@ dev.off()
|
|||||||
|
|
||||||
png("exp-space.png", width=w*ppi, height=h*ppi, res=ppi)
|
png("exp-space.png", width=w*ppi, height=h*ppi, res=ppi)
|
||||||
p = ggplot(data=df, aes(x=nodesFactor, y=particlesFactor)) +
|
p = ggplot(data=df, aes(x=nodesFactor, y=particlesFactor)) +
|
||||||
labs(x="Nodes", y="Particles", title="Nbody: Experiment space") +
|
labs(x="Nodes", y="Particles", title="Nbody: Experiment space") +
|
||||||
geom_line(aes(group=particles)) +
|
geom_line(aes(group=particles)) +
|
||||||
geom_point(aes(color=nodesFactor), size=3) +
|
geom_point(aes(color=nodesFactor), size=3) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
theme_bw()
|
theme_bw()
|
||||||
print(p)
|
print(p)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
png("gra-space.png", width=w*ppi, height=h*ppi, res=ppi)
|
png("gra-space.png", width=w*ppi, height=h*ppi, res=ppi)
|
||||||
p = ggplot(data=D, aes(x=nodesFactor, y=blocksPerCpuFactor)) +
|
p = ggplot(data=D, aes(x=nodesFactor, y=blocksPerCpuFactor)) +
|
||||||
labs(x="Nodes", y="Blocks/CPU", title="Nbody: Granularity space") +
|
labs(x="Nodes", y="Blocks/CPU", title="Nbody: Granularity space") +
|
||||||
geom_line(aes(group=nodesFactor)) +
|
geom_line(aes(group=nodesFactor)) +
|
||||||
geom_point(aes(color=nodesFactor), size=3) +
|
geom_point(aes(color=nodesFactor), size=3) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
theme_bw()
|
theme_bw()
|
||||||
print(p)
|
print(p)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
png("performance.png", width=w*ppi, height=h*ppi, res=ppi)
|
png("performance.png", width=w*ppi, height=h*ppi, res=ppi)
|
||||||
p = ggplot(D, aes(x=nodesFactor)) +
|
p = ggplot(D, aes(x=nodesFactor)) +
|
||||||
labs(x="Nodes", y="Time (s)", title="Nbody strong scaling") +
|
labs(x="Nodes", y="Time (s)", title="Nbody strong scaling") +
|
||||||
theme_bw() +
|
theme_bw() +
|
||||||
geom_line(aes(y=tmedian,
|
geom_line(aes(y=tmedian,
|
||||||
linetype=blocksPerCpuFactor,
|
linetype=blocksPerCpuFactor,
|
||||||
group=interaction(gitBranch, blocksPerCpuFactor))) +
|
group=interaction(gitBranch, blocksPerCpuFactor))) +
|
||||||
geom_line(aes(y=tideal, group=gitBranch), color="red") +
|
geom_line(aes(y=tideal, group=gitBranch), color="red") +
|
||||||
geom_point(aes(y=tmedian, color=nodesFactor), size=3) +
|
geom_point(aes(y=tmedian, color=nodesFactor), size=3) +
|
||||||
facet_grid(gitBranch ~ .) +
|
facet_grid(gitBranch ~ .) +
|
||||||
scale_shape_manual(values=c(21, 22)) +
|
scale_shape_manual(values=c(21, 22)) +
|
||||||
scale_y_continuous(trans=log2_trans())
|
scale_y_continuous(trans=log2_trans())
|
||||||
print(p)
|
print(p)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
Loading…
Reference in New Issue
Block a user