File: plot_basic_benchmarks.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (200 lines) | stat: -rw-r--r-- 6,052 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
;+
; Under GNU GPL V3+
; Alain C., August 2018
;
; Nota Bene : we don't check all the XDR provided come from the
; same machine ...
;
; Tip : special is a keyword which can be used to intercompare GDL
; versions in case of regression (need tuning; to be clarify)
;
; ---------------------------------
;
; TYPE : INTEGER (int, long, ulong, ...), FLOAT, DOUBLE, COMPLEX, DCOMPLEX
; To Do : management of TYPE is far from perfect 
;
; ---------------------------------
; 
; Modifications history :
;
; - 2018-10-15 : AC. 
;   * adding on the plot more informations on the machine used
;   * better display of Float & Double
;   * filtering on used type (eg Float, Double or Long ...)
;
; ---------------------------------
;-
;
pro FAMILY_TYPE, used_type, family_type, psymb, my_line, test=test
;
case used_type of
   'FLOAT' : begin
      family_type='FLOAT'
      psymb=4
      my_line=0
   end
   'DOUBLE' : begin
      family_type='DOUBLE'
      psymb=6
      my_line=2
   end
   'INT' : begin
      family_type='INTEGER'
      psymb=2
      my_line=1
   end
   'BYTE' : begin
      family_type='INTEGER'
      psymb=2
      my_line=1
   end
   'LONG' : begin
      family_type='INTEGER'
      psymb=2
      my_line=1
   end
   'ULONG' : begin
      family_type='INTEGER'
      psymb=2
      my_line=1
   end
   ELSE: begin
      print,  used_type
      print, 'not ready !!'
      end
ENDCASE
;
if KEYWORD_SET(test) then STOP
;
end
;
pro PLOT_BASIC_BENCHMARKS, path=path, filter=filter, type=type, $
                           select=select, title=title, $
                           xrange=xrange, yrange=yrange, $
                           xlog=xlog, ylog=ylog, $
                           svg=svg, special=special, $
                           help=help, test=test, debug=debug, verbose=verbose
;
if KEYWORD_SET(help) then begin
    print, 'pro PLOT_BASIC_BENCHMARKS, path=path, filter=filter, $'
    print, '                           xrange=xrange, yrange=yrange, $'
    print, '                           xlog=xlog, ylog=ylog, $'
    print, '                           svg=svg, $'
    print, '                           help=help, test=test'
    return
endif
;
if ~KEYWORD_SET(test) then ON_ERROR, 2
;
CHECK_SAVE_RESTORE
;
if ~KEYWORD_SET(filter) then filter='bench_basic_*.xdr'
;
liste=BENCHMARK_FILE_SEARCH(filter, 'BASIC_BENCHMARKS', path=path)
if N_ELEMENTS(liste) EQ 0 then begin
   print, 'Used filter : ', filter
   MESSAGE, 'No file found !'
endif
;
; selection on type
;
if KEYWORD_SET(type) then keep_type=type else keep_type=''
if ISA(keep_type,/string) then begin
   keep_type=STRUPCASE(keep_type)
endif else begin
   keep_type=TYPENAME(FIX(1, type=keep_type))
endelse
if KEYWORD_SET(debug) then print, 'Type : ',  keep_type
;
; name for the output, if needed (+ type name if selected)
;
RESTORE, liste[0]
fig_name='bench_basic_'
if STRLEN(keep_type) GT 0 then fig_name=fig_name+keep_type+'_'
fig_name=fig_name+info_os.generic_osname+'_'+info_os.hostname+'.svg'
BENCHMARK_SVG, svg=svg, /on, filename=fig_name, infosvg=infosvg 
;
; not useful now, maybe later ...
if KEYWORD_SET(xrange) then MESSAGE,/info, "keyword Xrange not effective !"
if KEYWORD_SET(xlog) then MESSAGE,/info, "keyword Xrange not effective !"
;
;; Which ranges ? fake Xrange (we don't care)
BENCHMARK_COMPUTE_RANGE, liste, xrange, yrange_new, 'op_val', 'op_val', $
                         xelems=xelems, yelems=yelems
if ~KEYWORD_SET(yrange) then yrange=yrange_new
;
; in fact, we overwrite xrange ...
xval=INDGEN(xelems)+1
xrange=[0, xelems+1]
;
DEVICE, decompose=1
;
; reading a first time all the XDR in liste to get infos
BENCHMARK_GRAPHIC_STYLE, liste, colors, mypsym, myline, flags, $
                         languages, select=select
;
bb_title='Basic Benchmark'
if KEYWORD_SET(title) then bb_title=bb_title+' : '+title
;
PLOT, FINDGEN(xelems), /nodata, xstyle=5, /ystyle, ylog=ylog, $
      xrange=xrange, yrange=yrange, $
      xtitle='Operations', ytitle='time [s]', $
      title=bb_title, pos=[0.05,0.05, 0.75, 0.9]
;
XYOUTS, 0.78, 0.95, SYSTIME(), /normal
XYOUTS, 0.78, 0.90, info_os.hostname, /normal
XYOUTS, 0.78, 0.85, info_os.generic_osname,/normal
XYOUTS, 0.78, 0.80, info_os.family_osname+' '+info_os.accurate_osname,/normal
XYOUTS, 0.78, 0.75, info_cpu.model,/normal
XYOUTS, 0.78, 0.70, 'nb cores : '+STRING(info_cpu.nb_cores), /normal
;
for ii=0, N_ELEMENTS(liste)-1 do begin
   if KEYWORD_SET(verbose) then print, 'Restoring '+liste[ii]
   RESTORE, liste[ii]
   ;;
   ;; at the end, plotting missing Xaxis !
   if ii EQ 0 then $
      AXIS, xtickname=['',op_name,''], xticks=N_ELEMENTS(op_name)+1
   ;;
   ;; type ?
   ;;
   FAMILY_TYPE, used_type, family_type, psymb, my_line, test=test
   ;;
   ;; skipped unwanted inputs if Type= provided
   if KEYWORD_SET(type) then if (keep_type NE family_type) then continue
   ;;
   jj=flags[ii]
   if jj GE 0 then begin
      OPLOT, xval, op_val, line=my_line, col=colors[jj], thick=2
      OPLOT, xval, op_val, psym=psymb, col=colors[jj], thick=2
   endif
   ;;   print, ii, jj, mypsym[jj], myline, colors[jj]
endfor
;
; adding vertical lines separating the 4 cases
;
BENCHMARK_PLOT_CARTOUCHE, pos=[0.75,0.05,0.98,0.4], languages, /box, $
                          colors=colors, lines=lines, /all, /absolute, $
                          thick=2, title='Languages'
;
BENCHMARK_PLOT_CARTOUCHE, pos=[0.75,0.4,0.98,0.7], $
                          ['Int/Long ...','Float','Double'], /box, $
;                          colors=color2color(!color.white), $
                          linestyle=[1,0,2], psym=[-2,-4,-6], /all, /absolute, $
                          thick=2, title='Types'
;
if KEYWORD_SET(special) then begin
   colors=[colors[0],colors[0]]
   info=['git_11','git_19']
   lines=[2,0]
   BENCHMARK_PLOT_CARTOUCHE, pos=[0.75,0.55,0.98,0.95], info, /box, $
                             colors=colors, lines=lines, /all, /absolute, $
                             thick=1.5, title='Git version'
endif
;
BENCHMARK_SVG, svg=svg, /off, infosvg=infosvg
;
if KEYWORD_SET(test) then STOP
;
end
;