Commit 6a55343b authored by Martin Khannouz's avatar Martin Khannouz Committed by Berenger Bramas

Fix R script

parent 68125d47
get_data_subset <- function(f, n, h, p)
get_data_subset <- function(f, n, h, p, b)
{
d <- read.csv(file=f,comment.char = "#", sep=",", quote = "\"", head=TRUE,
dec=".", colClasses=
......@@ -27,18 +27,20 @@ get_data_subset <- function(f, n, h, p)
d <- subset(d, npart == n)
if (h)
d <- subset(d, height == h)
if (b)
d <- subset(d, bsize == b | algo == "simple-mpi")
return (d)
}
get_breaks_runtime <- function()
{
return (c('implicit', 'explicit', 'implicit limited', 'simple-mpi'))
return (c('implicit', 'explicit', 'implicit limited', 'simple-mpi', 'implicit-two-by'))
}
get_labels_runtime <- function()
{
return (c('Implicit', 'Explicit', 'Implicit Limited', 'Simple MPI'))
return (c('Implicit', 'Explicit', 'Implicit Limited', 'Simple MPI', 'Implicit two by'))
}
get_colors_runtime <- function()
......@@ -46,32 +48,14 @@ get_colors_runtime <- function()
return (c('implicit' = "#266d83",
'explicit' = "#e20025",
'implicit limited' = "#bd02b6",
'simple-mpi' = "#9aff4f"))
'simple-mpi' = "#9aff4f",
'implicit-two-by' = "#50de11"))
}
# Scheme breaks, colors ...
get_breaks_scheme <- function()
get_bsize_reference <- function()
{
return (c('tb-omp4#task#dep', 'tb-omp4#task#dep-P','tb-omp4#task#dep-C',
'tb-omp4#task#dep-CP'))
return (2000)
}
get_shapes_scheme <- function()
{
return(c('tb-omp4#task#dep' = 0,
'tb-omp4#task#dep-P' = 2,
'tb-omp4#task#dep-C' = 10,
'tb-omp4#task#dep-CP' = 8))
}
get_ltypes_scheme <- function()
{
return (c('tb-omp4#task#dep' = "solid",
'tb-omp4#task#dep-P' = "dotdash",
'tb-omp4#task#dep-C' = "solid",
'tb-omp4#task#dep-CP' = "dashed"))
}
get_one_node_reference_algorithm <- function()
{
return ("starpu")
......
......@@ -5,6 +5,7 @@ gen_comm_plot <- function(db, d_breaks, model_wanted)
{
db <- subset(db, model == model_wanted)
db <- db[db$communication_vol > 0,]
g <- ggplot(data=db,aes_string(x="nnode", y="communication_vol", color="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ bsize, scales="free",
......@@ -33,8 +34,8 @@ gen_comm_plot <- function(db, d_breaks, model_wanted)
gen_comm <- function(dbfile)
{
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- subset(data, algo != get_one_node_reference_algorithm())
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
data <- subset(data, algo != get_one_node_reference_algorithm() & algo != "simple-mpi")
all_model <- unique(data$model)
for (i in 1:length(all_model))
{
......
......@@ -24,8 +24,6 @@ gen_efficiencies_plot <- function(output, data)
g <- g + xlab("Number of node")
g <- g + ylab("Efficiency")
#g <- g + scale_x_continuous(breaks=c(1, 2, 3, 4, 6, 9, 12, 16, 20, 24))
# Set y-axis range
g <- g + ylim(c(0.0, 1.10))
......@@ -106,7 +104,7 @@ gen_efficiency <- function(data_init, algo_wanted, model_wanted)
gen_efficiencies <- function(dbfile)
{
data_init <- get_data_subset(dbfile, 0L, 0L, "False")
data_init <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
data_init <- subset(data_init, algo != get_one_node_reference_algorithm())
data <- melt(data_init, id=c("model", "algo", "nnode", "nthreads", "npart","height","bsize"))
......
......@@ -6,7 +6,7 @@ gen_group_size_plot <- function(d, model_wanted)
{
d <- subset(d, model == model_wanted)
d$global_time <- d$global_time/1000
g <- ggplot(data=d,aes_string(x="bsize", y="global_time", color="algo"))
g <- ggplot(data=d,aes_string(x="bsize", y="global_time", color="algo", group="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ nnode, scales="free",
labeller = labeller(npart = as_labeller(npart_labeller),
......@@ -32,8 +32,11 @@ gen_group_size_plot <- function(d, model_wanted)
gen_group_size <- function(dbfile)
{
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- subset(data, algo != get_one_node_reference_algorithm())
data <- get_data_subset(dbfile, 0L, 0L, "False", 0L)
data <- subset(data, algo != get_one_node_reference_algorithm() & algo != "simple-mpi")
all_nnode <- unique(subset(data, bsize != get_bsize_reference())$nnode)
data <- subset(data, nnode %in% all_nnode)
all_model <- unique(data$model)
for (i in 1:length(all_model))
......
......@@ -15,7 +15,18 @@ calc_normalized_time <- function(data, ref_name)
seq_time <- subset(tmp_ref, nnode == 1)
tid = as.integer(as.vector(data$nnode[j]))
data$efficiency[j] <- seq_time$global_time / (data$global_time[j] * tid)
if(nrow(tmp_ref) == 0)
{
data$efficiency[j] <- NA
}
else if(data$global_time[j] == 0)
{
data$efficiency[j] <- 0
}
else
{
data$efficiency[j] <- seq_time$global_time / (data$global_time[j] * tid)
}
}
}
}
......@@ -29,13 +40,13 @@ gen_normalized_time_plot <- function(db, d_breaks, model_wanted)
db <- calc_normalized_time(db, d_breaks)
#Then remove one node reference because it's only available on one node
db <- subset(db, algo != get_one_node_reference_algorithm())
db <- db[!(is.na(db$efficiency)),]
g <- ggplot(data=db,aes_string(x="nnode", y="efficiency", color="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ bsize, scales="free",
g <- g + facet_wrap(npart ~ height, scales="free",
labeller = labeller(npart = as_labeller(npart_labeller),
height = as_labeller(height_labeller),
bsize = as_labeller(group_size_labeller),
.default=label_both,
.multi_line=FALSE))
......@@ -49,7 +60,7 @@ gen_normalized_time_plot <- function(db, d_breaks, model_wanted)
g <- g + xlab("Number of nodes")
g <- g + ylab("Normalized time")
g <- g + scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 9, 12, 16, 20, 24))
#g <- g + scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 9, 12, 16, 20, 24))
# Save generated plot.
output <- paste(get_output_directory(), "/", model_wanted, "-normalized-time.pdf", sep="")
......@@ -58,7 +69,7 @@ gen_normalized_time_plot <- function(db, d_breaks, model_wanted)
gen_normalized_time <- function(dbfile)
{
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
all_model <- unique(data$model)
#Get all algorithm without the reference algorithm
all_algo <- unique(subset(data, algo != get_one_node_reference_algorithm())$algo)
......
......@@ -13,11 +13,20 @@ calc_parallel_efficiency <- function(data, ref_name)
tmp_ref <- subset(data_ref, npart == data$npart[j])
tmp_ref <- subset(tmp_ref, height == data$height[j])
#seq_time <- subset(tmp_ref, nthreads == 1)
seq_time <- subset(tmp_ref, nnode == 1)
#tid = as.integer(as.vector(data$nthreads[j]))
tid = as.integer(as.vector(data$nnode[j]))
data$efficiency[j] <- seq_time$global_time / (data$global_time[j] * tid)
if(nrow(subset(tmp_ref, nnode == 1)) == 0)
{
data$efficiency[j] <- NA
}
else if(data$global_time[j] == 0)
{
data$efficiency[j] <- NA
}
else
{
data$efficiency[j] <- seq_time$global_time / (data$global_time[j] * tid)
}
}
}
}
......@@ -29,12 +38,12 @@ gen_pareff_plot <- function(db, d_breaks, model_wanted)
db <- subset(db, model == model_wanted)
db <- calc_parallel_efficiency(db, d_breaks)
db <- db[!(is.na(db$efficiency)),]
g <- ggplot(data=db,aes_string(x="nnode", y="efficiency", color="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ bsize, scales="free",
g <- g + facet_wrap(npart ~ height, scales="free",
labeller = labeller(npart = as_labeller(npart_labeller),
height = as_labeller(height_labeller),
bsize = as_labeller(group_size_labeller),
.default=label_both,
.multi_line=FALSE))
......@@ -48,8 +57,6 @@ gen_pareff_plot <- function(db, d_breaks, model_wanted)
g <- g + xlab("Number of nodes")
g <- g + ylab("Parallel efficiency")
g <- g + scale_x_continuous(breaks=c(1, 2, 3, 4, 5, 6, 9, 12, 16, 20, 24))
# Save generated plot.
output <- paste(get_output_directory(), "/", model_wanted, "-parallel-efficiency.pdf", sep="")
ggsave(output, g, width=29.7, height=21, units=c("cm"), device=cairo_pdf)
......@@ -58,7 +65,7 @@ gen_pareff_plot <- function(db, d_breaks, model_wanted)
gen_pareff <- function(dbfile)
{
file <- paste(dbfile, sep="")
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
data <- subset(data, algo != get_one_node_reference_algorithm())
all_model <- unique(data$model)
for (i in 1:length(all_model))
......
......@@ -8,10 +8,9 @@ gen_speed_plot <- function(d, model_wanted)
d$global_time <- d$global_time/1000
g <- ggplot(data=d,aes_string(x="nnode", y="global_time", color="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ bsize, scales="free",
g <- g + facet_wrap(npart ~ height, scales="free",
labeller = labeller(npart = as_labeller(npart_labeller),
height = as_labeller(height_labeller),
bsize = as_labeller(group_size_labeller),
.default=label_both,
.multi_line=FALSE))
......@@ -32,7 +31,7 @@ gen_speed_plot <- function(d, model_wanted)
gen_speed <- function(dbfile)
{
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
data <- subset(data, algo != get_one_node_reference_algorithm())
all_model <- unique(data$model)
......
......@@ -8,7 +8,16 @@ calc_speedup <- function(data, ref_algo)
data_ref <- subset(data, algo == ref_algo)
for (i in 1:nrow(data)) {
tmp_ref <- subset(data_ref, npart == data$npart[i] & height == data$height[i] & nnode == data$nnode[i])
data$speedup[i] <- tmp_ref$global_time / data$global_time[i]
if(nrow(tmp_ref) == 0)
{
print(paste("No time for ", ref_algo, " (", data$algo[i], ") ", data$nnode[i], "N ", data$npart[i], "part ", data$height[i], "h", sep=""))
data$speedup[i] <- NA
}
else
{
data$speedup[i] <- tmp_ref$global_time / data$global_time[i]
}
}
return (data)
}
......@@ -17,12 +26,12 @@ gen_speedup_taskdep_plot <- function(d, model_wanted)
{
d <- subset(d, model == model_wanted)
d <- calc_speedup(d, "simple-mpi")
d <- d[!(is.na(d$speedup)),]
g <- ggplot(data=d,aes_string(x="nnode", y="speedup", color="algo"))
g <- g + geom_line()
g <- g + facet_wrap(npart ~ height ~ bsize, scales="free",
g <- g + facet_wrap(npart ~ height, scales="free",
labeller = labeller(npart = as_labeller(npart_labeller),
height = as_labeller(height_labeller),
bsize = as_labeller(group_size_labeller),
.default=label_both,
.multi_line=FALSE))
......@@ -43,7 +52,7 @@ gen_speedup_taskdep_plot <- function(d, model_wanted)
gen_speedup <- function(dbfile)
{
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
data <- subset(data, algo != get_one_node_reference_algorithm())
all_model <- unique(data$model)
......
......@@ -41,6 +41,7 @@ gen_times_taskdep_plot <- function(data, algo_wanted, model_wanted)
g <- g + ylab("% of time")
output <- paste(get_output_directory(), "/", model_wanted, "-", algo_wanted, "-times.pdf", sep="")
# Save generated plot.
ggsave(output, g, width=29.7, height=21, units=c("cm"), device=cairo_pdf)
}
......@@ -83,15 +84,18 @@ compute_timings <- function(data, n, h, m)
gen_times_taskdep <- function(dbfile)
{
# Cube (volume)
data <- get_data_subset(dbfile, 0L, 0L, "False")
data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
all_algorithm <- unique(data$algo)
all_model <- unique(data$model)
for (i in 1:length(all_algorithm))
{
for (j in 1:length(all_model))
if(all_algorithm[i] != "simple-mpi")
{
gen_times_taskdep_plot(data, all_algorithm[i], all_model[j])
for (j in 1:length(all_model))
{
gen_times_taskdep_plot(data, all_algorithm[i], all_model[j])
}
}
}
}
......@@ -18,17 +18,15 @@ print("Generate Group size plot")
gen_group_size("loutre.db")
print("Generate Speed plot")
gen_speed("loutre.db")
print("Generate times task plot")
gen_times_taskdep("loutre.db")
print("Generate Gantt")
gen_gantt("canard.db")
#print("Generate times task plot")
#gen_times_taskdep("loutre.db")
print("Generate Normalized time plot")
gen_normalized_time("loutre.db")
print("Generate Gantt")
gen_gantt("canard.db")
print("Generate Efficiency plot")
gen_efficiencies("loutre.db")
#print("Generate Efficiency plot")
#gen_efficiencies("loutre.db")
print("Generate Parrallel efficiency plot")
gen_pareff("loutre.db")
print("Generate Speedup plot")
gen_speedup("loutre.db")
#print("Generate Gantt")
#gen_gantt("canard.db")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment