def run(self): generate_path = self.test_path + "/generate" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" self.log("Generating input file") status = self.run_util([ generate_path, "-s", str(self.seed), "-n", str(self.n), "-o", infile ]) if status != 0: raise Exception("generate failed with error " + str(status)) self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status=0, stderr="") self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") self.log("Checking output") (is_sorted, msg) = check_sorted(outfile, infile) if not is_sorted: raise Failure(msg) self.done()
def run(self): generate_path = self.test_path + "/generate" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" times = list() for seed in self.seeds: sorted_digest = None self.log("Generating input file") status = self.run_util([ generate_path, "-s", str(seed), "-n", str(self.n), "-o", infile ]) if status != 0: raise Exception("generate failed with error " + str(status)) for i in range(self.runs): sleep(0.5) self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status=0, stderr="") if status != 0: raise Failure("fastsort exited with status " + str(status)) self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") times.append(child.wallclock_time) self.log("Checking output") m = hashlib.md5() with open(outfile, "rb") as f: m.update(f.read()) if sorted_digest is None or m.digest() != sorted_digest: (is_sorted, msg) = check_sorted(outfile, infile) if not is_sorted: self.fail(msg) raise Failure(msg) sorted_digest = m.digest() os.remove(outfile) #self.run_util(["sync"]) with open("times.pickle", "wb") as f: pickle.dump(times, f) times = sorted(times) #print times print "best ", times[0] print "median", median(times) print "worst ", times[-1] self.done()
def run(self): generate_path = self.test_path + "/generate" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" times = list() for seed in self.seeds: sorted_digest = None self.log("Generating input file") status = self.run_util([generate_path, "-s", str(seed), "-n", str(self.n), "-o", infile]) if status != 0: raise Exception("generate failed with error " + str(status)) for i in range(self.runs): sleep(0.5) self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status = 0, stderr = "") if status != 0: raise Failure("fastsort exited with status " + str(status)) self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") times.append(child.wallclock_time); self.log("Checking output") m = hashlib.md5() with open(outfile, "rb") as f: m.update(f.read()) if sorted_digest is None or m.digest() != sorted_digest: (is_sorted, msg) = check_sorted(outfile, infile) if not is_sorted: self.fail(msg) raise Failure(msg) sorted_digest = m.digest() os.remove(outfile) #self.run_util(["sync"]) with open("times.pickle", "wb") as f: pickle.dump(times, f) times = sorted(times) #print times print "best ", times[0] print "median", median(times) print "worst ", times[-1] self.done()
def run(self): generate_path = self.test_path + "/gen" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" res = list() score = 0 for j in self.tests: times = list() for seed in self.seeds: sorted_digest = None self.log("Generating input file") status = self.run_util([generate_path + j, "-s", str(seed), "-n", str(self.n), "-o", infile]) if status != 0: raise Exception("generate failed with error " + str(status)) for i in range(self.runs): sleep(0.5) self.log("Running fastsort") child, outdata = self.runexe(["fastsort", "-" + str(self.key), infile], status = 0, stderr = "", output = False) # print type(outdata) if status != 0: raise Failure("fastsort exited with status " + str(status)) self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") times.append(child.wallclock_time); self.log("Checking output") (is_sorted, msg) = check_sorted(outdata, infile, self.key) if not is_sorted: self.fail(msg) raise Failure(msg) times = sorted(times) # print times print "best ", times[0] print "median", median(times) print "worst ", times[-1] print "\n\n" res.append(median(times)) self.done() print "\n\n\n" print "**********************************************************************" print "Evaluation Summary: " print "The performance on three ranges: " print res, "\n" print "Final result (average): " print sum(res) / len(res)
def run(self): infile = self.test_path + "/dupdata" outfile = self.project_path + "/outfile" self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status = 0, stderr = "") self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") self.log("Checking output") (is_sorted, msg) = check_sorted(outfile, infile) if not is_sorted: raise Failure(msg) self.done()
def run(self): infile = self.test_path + "/dupdata" outfile = self.project_path + "/outfile" self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status = 0, stderr = "") self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") self.log("Checking output") (is_sorted, msg) = check_sorted(outfile, infile) os.remove(outfile) if not is_sorted: raise Failure(msg) self.done()
def run(self): infile = self.test_path + "/dupdata" outfile = self.project_path + "/outfile" lowValue = 0 highValue = 0 self.log("Running rangesort") child = self.runexe(["rangesort", "-i", infile, "-o", outfile, "-l", str(lowValue), "-h", str(highValue)], status = 0, stderr = "") self.log("Rangesort completed in " + str(child.wallclock_time) + " seconds") self.log("Checking output") (is_sorted, msg) = check_sorted(outfile, infile, lowValue, highValue) os.remove(outfile) if not is_sorted: raise Failure(msg) self.done()
def run(self): generate_path = self.test_path + "/generate" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" self.log("Generating input file") status = self.run_util([generate_path, "-s", str(self.seed), "-n", str(self.n), "-o", infile]) if status != 0: raise Exception("generate failed with error " + str(status)) self.log("Running fastsort") child = self.runexe(["fastsort", "-i", infile, "-o", outfile], status=0, stderr="") self.log("Fastsort completed in " + str(child.wallclock_time) + " seconds") self.log("Checking output") (is_sorted, msg) = check_sorted(outfile, infile) if not is_sorted: raise Failure(msg) self.done()
def run(self): generate_path = self.test_path + "/generate" infile = self.project_path + "/infile" outfile = self.project_path + "/outfile" res = list() score = 0 for j in self.percents: times = list() for seed in self.seeds: sorted_digest = None self.log("Generating input file") status = self.run_util([generate_path, "-s", str(seed), "-n", str(self.n), "-o", infile]) if status != 0: raise Exception("generate failed with error " + str(status)) self.low, self.high = gen_range(infile, j); for i in range(self.runs): sleep(0.5) self.log("Running rangesort with range [" + str(self.low) + ", " + str(self.high) + "]") child = self.runexe(["rangesort", "-i", infile, "-o", outfile, "-l", str(self.low), "-h", str(self.high)], status = 0, stderr = "") if status != 0: raise Failure("rangesort exited with status " + str(status)) self.log("Rangesort completed in " + str(child.wallclock_time) + " seconds") times.append(child.wallclock_time); self.log("Checking output") m = hashlib.md5() with open(outfile, "rb") as f: m.update(f.read()) if sorted_digest is None or m.digest() != sorted_digest: (is_sorted, msg) = check_sorted(outfile, infile, self.low, self.high) if not is_sorted: self.fail(msg) raise Failure(msg) else: score += 2 sorted_digest = m.digest() os.remove(outfile) # self.run_util(["sync"]) with open("times.pickle", "wb") as f: pickle.dump(times, f) times = sorted(times) # print times print "best ", times[0] print "median", median(times) print "worst ", times[-1] res.append(median(times)) self.done() print "\n\n\n" print "**********************************************************************" print "Evaluation Summary: " print "The performance on three ranges: " print res, "\n" print "Final result (average): " print sum(res) / len(res), "\n" print "Score in the large input part is: " print score, "/ 18 \n"