gen_comm.R 1.46 KB
Newer Older
1 2 3 4 5 6 7
library(plyr)
library(ggplot2)

gen_comm_plot <- function(db, d_breaks, model_wanted)
{
	db <- subset(db, model == model_wanted)

Martin Khannouz's avatar
Martin Khannouz committed
8
	db <- db[db$communication_vol > 0,]
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
	if (nrow(db) > 0)
	{
		g <- ggplot(data=db,aes_string(x="nnode", y="communication_vol", color="algo", group="algo"))
		g <- g + geom_line()
		g <- g + facet_wrap(npart ~ height ~ bsize, 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))

		# Set our own colors, linetypes and point shapes.
		g <- g + scale_color_manual(name="Algorithm",
									breaks=get_breaks_runtime(),
									labels=get_labels_runtime(),
									values=get_colors_runtime())

		# Set X/Y labels.
		g <- g + xlab("Number of nodes")
		g <- g + ylab("Volume of Communication (MB)")
Martin Khannouz's avatar
Martin Khannouz committed
29
		g <- g + get_theme()
30 31 32 33 34

		# Save generated plot.
		output <- paste(get_output_directory(), "/", model_wanted, "-comm.pdf", sep="")
		ggsave(output, g, width=29.7, height=21, units=c("cm"), device=cairo_pdf)
	}
35 36 37 38
}

gen_comm <- function(dbfile)
{
Martin Khannouz's avatar
Martin Khannouz committed
39
    data <- get_data_subset(dbfile, 0L, 0L, "False", get_bsize_reference())
40
	data <- subset(data, algo != get_one_node_reference_algorithm() & algo != "simple-mpi" & bsize == get_bsize_reference())
41 42 43 44 45 46 47
	all_model <- unique(data$model)
	for (i in 1:length(all_model))
	{
		gen_comm_plot(data, unique(data$algo), all_model[i])
	}
}