Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. import subprocess
  2. import matplotlib.pyplot as plt
  3.  
  4.  
  5. s = ["gradlew", "run", "runShadow", "--args=--problem projection --plot"]
  6.  
  7. fignum = 1
  8. size = [12, 24, 48, 96, 192, 384]
  9. threads =  [i for i in range(1, 17)]
  10. print(threads)
  11. for problem in ['projection', 'heat']:
  12.     for max_threads in threads:
  13.         print(problem)
  14.         total_time = []
  15.         creation_time = []
  16.         initialization_time = []
  17.         solution_time = []
  18.         for problem_size in size:    
  19.             for stepss in [2]:
  20.                 print('a')
  21.                 # print("problem_size: ", problem_size)
  22.                 p = "--problem"
  23.                 s = "--problem-size"
  24.                 m = "--max-threads"
  25.                 steps =  "--steps"
  26.                 l = ["java", "-jar", "-Xmx6G", "./dist/iga-adi-sm.jar", p, str(problem), s, str(problem_size),  m, str(max_threads), steps, str(stepss), "--store-file", "false"]
  27.            
  28.                 proc = subprocess.Popen(l, shell=True, stdout=subprocess.PIPE)
  29.                 output = proc.stdout.read()
  30.                 o = output.decode("utf-8")
  31.                 creation_t, initialization_t, solution_t, total_t = o.split(',')
  32.                 total_time.append(total_t)
  33.                 creation_time.append(creation_t)
  34.                 initialization_time.append(initialization_t)
  35.                 solution_time.append(solution_t)
  36.  
  37.         plt.plot(size, total_time, 'ro')
  38.         plt.title(problem + ' ' + "total_time")
  39.         plt.savefig('./' + str(problem)  + ' total_time, thread = '+ str(max_threads) + '.png')
  40.         plt.clf()
  41.  
  42.         plt.plot(size, creation_time, 'ro')
  43.         plt.title(problem + ' ' + "creation_time")
  44.         plt.savefig('./' + str(problem) + ' creation_time, thread = '+ str(max_threads)  + '.png')
  45.         plt.clf()
  46.        
  47.         plt.plot(size, initialization_time, 'ro')
  48.         plt.title(problem + ' ' + "initialization_time")
  49.         plt.savefig('./' + str(problem) + ' initialization_time, thread = '+ str(max_threads)  + '.png')
  50.         plt.clf()
  51.        
  52.         plt.plot(size, solution_time, 'ro')
  53.         plt.title(problem + ' ' + "solution_time")
  54.         plt.savefig('./' + str(problem) + ' solution_time, thread = '+ str(max_threads)  + '.png')
  55.         plt.clf()
  56.    
  57.  
  58.  
  59. print("DONE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement