Amit commited on
Commit
13b6ccd
·
1 Parent(s): 294e2a9

Display files updated.

Browse files
Files changed (1) hide show
  1. plot_scripts/plot_display_com_prec.py +12 -12
plot_scripts/plot_display_com_prec.py CHANGED
@@ -37,22 +37,22 @@ def abs_time_pack(task, package, cc, N_end):
37
  elif task == 'rqc':
38
  N_arr = np.arange(12, N_end, 2)
39
 
40
- dat_sp = dir + '/data/{}/{}_{}_sp.h5'.format(task, package, cc)
41
- dat_dp = dir + '/data/{}/{}_{}_dp.h5'.format(task, package, cc)
42
 
43
- if not os.path.isfile(dat_sp) and not os.path.isfile(dat_dp):
44
  return mr.Md(f"Compute capability {cc} possibly not supported")
45
 
46
  mr.Md(f"TtS performance of simulation packages with different precision")
47
 
48
- if os.path.isfile(dat_sp):
49
- h5f_sp = h5py.File(dat_sp, 'r')
50
  dat_sp = h5f_sp[storage_dict[package]][:]
51
  h5f_sp.close()
52
  plot_abs_data_n_arr(N_arr, dat_sp, package+'_'+task+'_{}_'.format(cc)+'sp')
53
 
54
- if os.path.isfile(dat_dp):
55
- h5f_dp = h5py.File(dat_dp, 'r')
56
  dat_dp = h5f_dp[storage_dict[package]][:]
57
  h5f_dp.close()
58
  plot_abs_data_n_arr(N_arr, dat_dp, package+'_'+task+'_{}_'.format(cc)+'dp')
@@ -60,13 +60,13 @@ def abs_time_pack(task, package, cc, N_end):
60
  gen_settings(fig, ax, r"N (system size)", r"Time ($t_{package}$)", False, True, True, N_arr[0]-2, N_arr[-1], True, 10**-1, 10**5, "out", None)
61
 
62
  mr.Md("___")
63
- mr.Md(f"Relative performance to double precision")
64
 
65
  fig, ax = plt.subplots()
66
 
67
- if os.path.isfile(dat_dp) and os.path.isfile(dat_sp):
68
- plot_comp_data_n_arr(N_arr, dat_dp, dat_dp, package+'_'+task+'_{}_'.format(cc)+'dp')
69
- plot_comp_data_n_arr(N_arr, dat_dp, dat_sp, package+'_'+task+'_{}_'.format(cc)+'sp')
70
 
71
  gen_settings(fig, ax, r"N (system size)", r"Relative to double precision", False, True, True, N_arr[0]-2, N_arr[-1], True, 10**-1, 10**3, "out", None)
72
 
@@ -79,5 +79,5 @@ def abs_time_pack(task, package, cc, N_end):
79
 
80
  # abs_time(pkg_str, task_1, p_com_cap, p_prec)
81
  # abs_time("Heisenberg dynamics", "Singlethread", "Single", 'qsimcirq')
82
- # abs_time_pack("Heisenberg dynamics", "Random Quantum Circuit", "Singlethread", "Single", 34)
83
  # abs_time_pack("Heisenberg dynamics", "Quantum Fourier Transform", "GPU", "Single", 38)
 
37
  elif task == 'rqc':
38
  N_arr = np.arange(12, N_end, 2)
39
 
40
+ dat_fsp = dir + '/data/{}/{}_{}_sp.h5'.format(task, package, cc)
41
+ dat_fdp = dir + '/data/{}/{}_{}_dp.h5'.format(task, package, cc)
42
 
43
+ if not os.path.isfile(dat_fsp) and not os.path.isfile(dat_fdp):
44
  return mr.Md(f"Compute capability {cc} possibly not supported")
45
 
46
  mr.Md(f"TtS performance of simulation packages with different precision")
47
 
48
+ if os.path.isfile(dat_fsp):
49
+ h5f_sp = h5py.File(dat_fsp, 'r')
50
  dat_sp = h5f_sp[storage_dict[package]][:]
51
  h5f_sp.close()
52
  plot_abs_data_n_arr(N_arr, dat_sp, package+'_'+task+'_{}_'.format(cc)+'sp')
53
 
54
+ if os.path.isfile(dat_fdp):
55
+ h5f_dp = h5py.File(dat_fdp, 'r')
56
  dat_dp = h5f_dp[storage_dict[package]][:]
57
  h5f_dp.close()
58
  plot_abs_data_n_arr(N_arr, dat_dp, package+'_'+task+'_{}_'.format(cc)+'dp')
 
60
  gen_settings(fig, ax, r"N (system size)", r"Time ($t_{package}$)", False, True, True, N_arr[0]-2, N_arr[-1], True, 10**-1, 10**5, "out", None)
61
 
62
  mr.Md("___")
63
+ mr.Md(f"Relative performance to single precision")
64
 
65
  fig, ax = plt.subplots()
66
 
67
+ if os.path.isfile(dat_fdp) and os.path.isfile(dat_fsp):
68
+ plot_comp_data_n_arr(N_arr, dat_dp, dat_sp, package+'_'+task+'_{}_'.format(cc)+'dp')
69
+ plot_comp_data_n_arr(N_arr, dat_sp, dat_sp, package+'_'+task+'_{}_'.format(cc)+'sp')
70
 
71
  gen_settings(fig, ax, r"N (system size)", r"Relative to double precision", False, True, True, N_arr[0]-2, N_arr[-1], True, 10**-1, 10**3, "out", None)
72
 
 
79
 
80
  # abs_time(pkg_str, task_1, p_com_cap, p_prec)
81
  # abs_time("Heisenberg dynamics", "Singlethread", "Single", 'qsimcirq')
82
+ # abs_time_pack("Heisenberg dynamics", "qiskit", "Singlethread", 34)
83
  # abs_time_pack("Heisenberg dynamics", "Quantum Fourier Transform", "GPU", "Single", 38)