Difference between revisions of "CSC352 Homework 5 Solution 2013"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- <onlysmith> The solution this week is provided by Gavi, with an application that generates a very good graph. More on the graph in class. =Script= <source lang="...")
 
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
----
 
----
 
<onlysmith>
 
<onlysmith>
The solution this week is provided by Gavi, with an application that generates a very good graph.  More on the graph in class.
+
The solution this week is provided by Gavi, with an application that generates a very good graph.  More on the graph in class.  I am also sharing Emily's scripts for running the experiments and generating the graph.
 
+
<br />
 
=Script=
 
=Script=
 +
<br />
 
<source lang="bash">
 
<source lang="bash">
 
#!/bin/bash                                                                                                       
 
#!/bin/bash                                                                                                       
Line 20: Line 21:
 
     done
 
     done
  
</source>
+
</source><br />
 
=Source=
 
=Source=
 +
<br />
 
<source lang="C">
 
<source lang="C">
  
Line 411: Line 413:
  
 
</source>
 
</source>
 +
<br />
 +
=Graph=
 +
<br />
 +
<center>[[Image:CSC352hw5graphGavi.png|700px]]</center>
 +
<br />
 +
=More Scripts=
 +
<br />
 +
===Script to run the experiment===
 +
<br />
 +
<source lang="bash">
 +
#!/bin/bash
 +
#
 +
# Emily Flynn
 +
# CSC 352
 +
# 11/14/2013
 +
#
 +
# Gets timing data for hadoop (I only did one run on aws to save time).
 +
 +
 +
N=$1
 +
header="M run1 run2 run3"
 +
echo $header > timing${N}.txt
 +
 +
for m in "10" "50" "100" "250" "500" "1000" "2500" "5000"
 +
do 
 +
    &>out time mpirun -np 8 ./hw5 ${N} ${m} > /dev/null
 +
    result1=$(head -1 out | awk '{print $1;}') #grabs only the user time                                                                                 
 +
    &>out time mpirun -np 8 ./hw5 ${N} ${m} > /dev/null
 +
    result2=$(head -1 out | awk '{print $1;}')
 +
    &>out time mpirun -np 8 ./hw5 ${N} ${m} > /dev/null
 +
    result3=$(head -1 out | awk '{print $1;}')
 +
   
 +
    # write it out to a file                                                                                                                             
 +
    printf "%s\t%s\t%s\t%s\n" "$m" "$result1" "$result2" "$result3" >> timing${N}.txt
 +
 +
done
 +
 +
rm out
 +
 +
exit 0
 +
 +
</source>
 +
 +
 +
<br />
 +
===Script to generate a Graph in R===
 +
<br />
 +
<source lang="rsplus">
 +
# plotHw5TimingData.R
 +
# Emily Flynn
 +
# CSC 352
 +
# 11/14/2013
 +
#
 +
# Plots the timing data from hadoop0, aws timing with N=5000.
 +
 +
# helpful package
 +
require(mosaic)
 +
hadoop0 <- read.table("timing5000.txt", header=TRUE)
 +
aws <- read.table("timing_aws5000.txt", header=TRUE)
 +
 +
# process timing data to remove "user" and convert data to numeric
 +
removeUser<- function(x){
 +
  return(as.numeric(gsub("user", "", x)))
 +
}
 +
hadoop0 <- data.frame(apply(hadoop0, c(1,2), removeUser))
 +
aws <-data.frame(apply(aws, c(1,2), removeUser))
 +
colnames(aws) <- c("M", "time") # aws only contains one run, not complete
 +
aws$system <- "aws"
 +
 +
hadoop0$avg <- rowMeans(hadoop0[,2:4]) # hadoop contains multiple runs
 +
 +
hadoop0_short <- data.frame(hadoop0$M, hadoop0$avg)
 +
colnames(hadoop0_short) <- c("M", "time")
 +
hadoop0_short$system <- "hadoop"
 +
 +
result <- rbind(aws, hadoop0_short)
 +
my.col=c("blue","magenta")
 +
 +
plotPoints(time ~ M, groups=system, data=result, ylab="time (s)", xlab="M - number per packet",
 +
          main="Hadoop0 vs. AWS times for varying packet size, \nN=5000",
 +
          key = list(space = "right", adj = 1,
 +
                      text = list(c("aws", "hadoop0")),
 +
                      points = list(pch = 21, col=my.col))
  
=Graph=
 
  
<center>[[Image:CSC352hw5graphGavi.png|700px]]</center>
+
)
  
 +
</source>
 
</onlysmith>
 
</onlysmith>
  

Latest revision as of 12:35, 26 November 2013

--D. Thiebaut (talk) 09:45, 26 November 2013 (EST)



This section is only visible to computers located at Smith College