Made test/3/octave scripts robust to missing data.

Details:
- Modified the octave scripts in test/3 so that the script does not
  choke when one or more of the expected OpenBLAS, Eigen, or vendor data
  files is missing. (The BLIS data set, however, must be complete.) When
  a file is missing, that data series is simply not included on that
  particular graph. Also factored out a lot of the redundant logic from
  plot_panel_4x5.m into a separate function in read_data.m.
This commit is contained in:
Field G. Van Zee
2021-03-24 15:57:32 -05:00
parent 545e6c2f6d
commit 159ca6f01a
4 changed files with 128 additions and 100 deletions

View File

@@ -5,7 +5,6 @@ function r_val = plot_l3_perf( opname, ...
data_vend, vend_str, ...
nth, ...
rows, cols, ...
with_eigen, ...
cfreq, ...
dfps, ...
theid, ...
@@ -56,7 +55,8 @@ titlename = sprintf( titlename, title_opname );
% Set the legend strings.
blis_legend = sprintf( 'BLIS' );
open_legend = sprintf( 'OpenBLAS' );
%open_legend = sprintf( 'OpenBLAS' );
open_legend = sprintf( 'ARMPL' );
eige_legend = sprintf( 'Eigen' );
%vend_legend = sprintf( 'MKL' );
%vend_legend = sprintf( 'ARMPL' );
@@ -101,24 +101,43 @@ x_axis( :, 1 ) = data_blis( :, 1 );
data_peak( 1, 1:2 ) = [ 0 max_perf_core ];
data_peak( 2, 1:2 ) = [ x_end max_perf_core ];
% Plot the data series for BLIS, which is required.
blis_ln = line( x_axis( :, 1 ), data_blis( :, flopscol ) / nth, ...
'Color',color_blis, 'LineStyle',lines_blis, ...
'LineWidth',linesize );
open_ln = line( x_axis( :, 1 ), data_open( :, flopscol ) / nth, ...
'Color',color_open, 'LineStyle',lines_open, ...
'LineWidth',linesize );
if data_eige(1,1) ~= -1
eige_ln = line( x_axis( :, 1 ), data_eige( :, flopscol ) / nth, ...
'Color',color_eige, 'LineStyle',lines_eige, ...
'LineWidth',linesize );
'Color',color_blis, 'LineStyle',lines_blis, ...
'LineWidth',linesize );
% Plot the data series for OpenBLAS, if applicable.
if data_open(1,1) ~= -1
open_ln = line( x_axis( :, 1 ), data_open( :, flopscol ) / nth, ...
'Color',color_open, 'LineStyle',lines_open, ...
'LineWidth',linesize );
else
eige_ln = line( nan, nan, ...
'Color',color_eige, 'LineStyle',lines_eige, ...
'LineWidth',linesize );
open_ln = line( nan, nan, ...
'Color',color_open, 'LineStyle',lines_open, ...
'LineWidth',linesize );
end
% Plot the data series for a vendor library, if applicable.
if data_vend(1,1) ~= -1
vend_ln = line( x_axis( :, 1 ), data_vend( :, flopscol ) / nth, ...
'Color',color_vend, 'LineStyle',lines_vend, ...
'LineWidth',linesize );
else
vend_ln = line( nan, nan, ...
'Color',color_vend, 'LineStyle',lines_vend, ...
'LineWidth',linesize );
end
% Plot the data series for Eigen, if applicable.
if data_eige(1,1) ~= -1
eige_ln = line( x_axis( :, 1 ), data_eige( :, flopscol ) / nth, ...
'Color',color_eige, 'LineStyle',lines_eige, ...
'LineWidth',linesize );
else
eige_ln = line( nan, nan, ...
'Color',color_eige, 'LineStyle',lines_eige, ...
'LineWidth',linesize );
end
vend_ln = line( x_axis( :, 1 ), data_vend( :, flopscol ) / nth, ...
'Color',color_vend, 'LineStyle',lines_vend, ...
'LineWidth',linesize );
xlim( ax1, [x_begin x_end] );
@@ -142,34 +161,18 @@ if rows == 4 && cols == 5
if nth == 1 && theid == legend_plot_id
if with_eigen == 1
leg = legend( [ blis_ln open_ln eige_ln vend_ln ], ...
blis_legend, open_legend, eige_legend, vend_legend, ...
'Location', legend_loc );
else
leg = legend( [ blis_ln open_ln vend_ln ], ...
blis_legend, open_legend, vend_legend, ...
'Location', legend_loc );
end
leg = legend( [ blis_ln vend_ln open_ln eige_ln ], ...
blis_legend, vend_legend, open_legend, eige_legend, ...
'Location', legend_loc );
set( leg,'Box','off','Color','none','Units','inches','FontSize',fontsize );
%set( leg,'Position',[3.40 8.70 1.9 1.0 ] ); % (0,2br)
set( leg,'Position',leg_pos_st );
elseif nth > 1 && theid == legend_plot_id
if with_eigen == 1
leg = legend( [ blis_ln open_ln eige_ln vend_ln ], ...
blis_legend, open_legend, eige_legend, vend_legend, ...
'Location', legend_loc );
else
leg = legend( [ blis_ln open_ln vend_ln ], ...
blis_legend, open_legend, vend_legend, ...
'Location', legend_loc );
end
leg = legend( [ blis_ln vend_ln open_ln eige_ln ], ...
blis_legend, vend_legend, open_legend, eige_legend, ...
'Location', legend_loc );
set( leg,'Box','off','Color','none','Units','inches','FontSize',fontsize );
%set( leg,'Position',[16.51 9.70 1.9 1.0 ] ); % (1,4tr)
%set( leg,'Position',[13.08 9.70 1.9 1.0 ] ); % (1,3tr)
%set( leg,'Position',[13.08 13.09 1.9 1.0 ] ); % (0,3tr)
set( leg,'Position',leg_pos_mt );
end
end

View File

@@ -6,8 +6,7 @@ function r_val = plot_panel_4x5 ...
thr_str, ...
dirpath, ...
arch_str, ...
vend_str, ...
with_eigen ...
vend_str ...
)
impl = 'octave';
@@ -25,8 +24,12 @@ if strcmp( subp, 'default' )
else
position = [100 100 1864 1540];
papersize = [15.6 19.4];
leg_pos_st = [1.15 8.70 2.1 1.2 ]; % (dgemm)
leg_pos_mt = [12.20 13.60 2.1 1.2 ]; % (strmm)
%leg_pos_st = [1.15 8.70 2.1 1.2 ]; % (dgemm)
leg_pos_st = [1.60 8.80 2.1 1.2 ]; % (dgemm)
%leg_pos_mt = [12.20 13.60 2.1 1.2 ]; % (strmm)
%leg_pos_mt = [5.30 12.60 2.1 1.2 ]; % (ssymm)
%leg_pos_mt = [8.50 13.62 2.1 1.2 ]; % (ssyrk)
leg_pos_mt = [5.30 5.10 2.1 1.2 ]; % (chemm)
sp_margins = [ 0.068 0.051 ];
end
@@ -46,12 +49,21 @@ else % impl == 'matlab'
end
set(gcf,'PaperOrientation','landscape');
% Define the implementation strings. These appear in both the filenames of the
% files that contain the performance results as well as the variable names
% within those files.
blis_str = 'asm_blis';
open_str = 'openblas';
vend_str = 'vendor';
eige_str = 'eigen';
% Create filename "templates" for the files that contain the performance
% results.
filetemp_blis = '%s/output_%s_%s_asm_blis.m';
filetemp_open = '%s/output_%s_%s_openblas.m';
filetemp_eige = '%s/output_%s_%s_eigen.m';
filetemp_vend = '%s/output_%s_%s_vendor.m';
filetemp = '%s/output_%s_%s_%s.m'
filetemp_blis = sprintf( filetemp, '%s', '%s', '%s', blis_str );
filetemp_open = sprintf( filetemp, '%s', '%s', '%s', open_str );
filetemp_vend = sprintf( filetemp, '%s', '%s', '%s', vend_str );
filetemp_eige = sprintf( filetemp, '%s', '%s', '%s', eige_str );
% Create a variable name "template" for the variables contained in the
% files outlined above.
@@ -79,45 +91,11 @@ for opi = 1:n_opnames
str = sprintf( 'Plotting %d: %s', opi, opname ); disp(str);
% Construct filenames for the data files from templates.
file_blis = sprintf( filetemp_blis, dirpath, thr_str, opname );
file_open = sprintf( filetemp_open, dirpath, thr_str, opname );
file_vend = sprintf( filetemp_vend, dirpath, thr_str, opname );
% Load the data files.
%str = sprintf( ' Loading %s', file_blis ); disp(str);
run( file_blis )
%str = sprintf( ' Loading %s', file_open ); disp(str);
run( file_open )
%str = sprintf( ' Loading %s', file_vend ); disp(str);
run( file_vend )
% Construct variable names for the variables in the data files.
var_blis = sprintf( vartemp, thr_str, opname, 'asm_blis' );
var_open = sprintf( vartemp, thr_str, opname, 'openblas' );
var_vend = sprintf( vartemp, thr_str, opname, 'vendor' );
% Use eval() to instantiate the variable names constructed above,
% copying each to a simplified name.
data_blis = eval( var_blis ); % e.g. data_st_sgemm_asm_blis( :, : );
data_open = eval( var_open ); % e.g. data_st_sgemm_openblas( :, : );
data_vend = eval( var_vend ); % e.g. data_st_sgemm_vendor( :, : );
% Only read Eigen data in select cases.
if with_eigen == 1
opname_u = opname; opname_u(1) = '_';
if nth == 1 || strcmp( opname_u, '_gemm' )
file_eige = sprintf( filetemp_eige, dirpath, thr_str, opname );
run( file_eige )
var_eige = sprintf( vartemp, thr_str, opname, 'eigen' );
data_eige = eval( var_eige ); % e.g. data_st_sgemm_eigen( :, : );
else
data_eige(1,1) = -1;
end
else
data_eige(1,1) = -1;
end
data_blis = read_data( filetemp_blis, dirpath, vartemp, thr_str, opname, blis_str );
data_open = read_data( filetemp_open, dirpath, vartemp, thr_str, opname, open_str );
data_vend = read_data( filetemp_vend, dirpath, vartemp, thr_str, opname, vend_str );
data_eige = read_data( filetemp_eige, dirpath, vartemp, thr_str, opname, eige_str );
% Plot one result in an m x n grid of plots, via the subplot()
% function.
plot_l3_perf( opname, ...
@@ -127,7 +105,6 @@ for opi = 1:n_opnames
data_vend, vend_str, ...
nth, ...
4, 5, ...
with_eigen, ...
cfreq, ...
dflopspercycle, ...
opi, ...

44
test/3/octave/read_data.m Normal file
View File

@@ -0,0 +1,44 @@
function data = read_data ...
( ...
filetemp, ...
dirpath, ...
var_templ, ...
thr_str, ...
opname, ...
impl_str ...
)
% Construct the full filepath for the data file from the template.
filepath = sprintf( filetemp, dirpath, thr_str, opname );
% Attempt to open the file.
fid = fopen( filepath );
if fid == -1
% If the file was not opened successfully, it's probably because
% the file is missing altogether. In these sitautions, we set the
% first element of the data to -1, which will be a signal to the
% plotting function to omit this curve from the graph.
data(1,1) = -1;
else
% If the file was opened successfully, we assume that it either
% contains valid data, or it adheres to the "missing data" format
% whereby the (1,1) element contains -1. In either case, we can
% process it normally and we begin by closing the file since we
% don't need the file descriptor.
fclose( fid );
% Load the data file.
run( filepath )
% Construct variable names for the variables in the data file.
% Examples: data_st_dgemm_asm_blis
% data_1s_zherk_vendor
var_name = sprintf( var_templ, thr_str, opname, impl_str );
% Use eval() to instantiate the variable names constructed above,
% copying each to a simplified name.
data = eval( var_name );
end
% Return the 'data' variable.

View File

@@ -4,23 +4,27 @@ plot_panel_4x5(2.20,8,28,'1s','../results/tx2/20190205/jc4ic7','tx2_jc4ic7','ARM
plot_panel_4x5(2.20,8,56,'2s','../results/tx2/20190205/jc8ic7','tx2_jc8ic7','ARMPL'); close; clear all;
% skx
plot_panel_4x5(2.00,32,1, 'st','../results/skx/merged20190306_0328/st', 'skx', 'MKL',1); close; clear all;
plot_panel_4x5(2.00,32,26,'1s','../results/skx/merged20190306_0328/jc2ic13','skx_jc2ic13','MKL',1); close; clear all;
plot_panel_4x5(2.00,32,52,'2s','../results/skx/merged20190306_0328/jc4ic13','skx_jc4ic13','MKL',1); close; clear all;
plot_panel_4x5(2.00,32,1, 'st','../results/skx/merged20190306_0328/st', 'skx', 'MKL'); close; clear all;
plot_panel_4x5(2.00,32,26,'1s','../results/skx/merged20190306_0328/jc2ic13','skx_jc2ic13','MKL'); close; clear all;
plot_panel_4x5(2.00,32,52,'2s','../results/skx/merged20190306_0328/jc4ic13','skx_jc4ic13','MKL'); close; clear all;
% has
plot_panel_4x5(3.25,16,1, 'st','../results/has/merged20190206_0328/st', 'has', 'MKL',1); close; clear all;
plot_panel_4x5(3.00,16,12,'1s','../results/has/merged20190206_0328/jc2ic3jr2','has_jc2ic3jr2','MKL',1); close; clear all;
plot_panel_4x5(3.00,16,24,'2s','../results/has/merged20190206_0328/jc4ic3jr2','has_jc4ic3jr2','MKL',1); close; clear all;
plot_panel_4x5(3.25,16,1, 'st','../results/has/merged20190206_0328/st', 'has', 'MKL'); close; clear all;
plot_panel_4x5(3.00,16,12,'1s','../results/has/merged20190206_0328/jc2ic3jr2','has_jc2ic3jr2','MKL'); close; clear all;
plot_panel_4x5(3.00,16,24,'2s','../results/has/merged20190206_0328/jc4ic3jr2','has_jc4ic3jr2','MKL'); close; clear all;
% zen
plot_panel_4x5(3.00,8,1, 'st','../results/epyc/merged20190306_0319_0328/st', 'epyc', 'MKL',1); close; clear all;
plot_panel_4x5(2.55,8,32,'1s','../results/epyc/merged20190306_0319_0328/jc1ic8jr4','epyc_jc1ic8jr4','MKL',1); close; clear all;
plot_panel_4x5(2.55,8,64,'2s','../results/epyc/merged20190306_0319_0328/jc2ic8jr4','epyc_jc2ic8jr4','MKL',1); close; clear all;
plot_panel_4x5(3.00,8,1, 'st','../results/epyc/merged20190306_0319_0328/st', 'epyc', 'MKL'); close; clear all;
plot_panel_4x5(2.55,8,32,'1s','../results/epyc/merged20190306_0319_0328/jc1ic8jr4','epyc_jc1ic8jr4','MKL'); close; clear all;
plot_panel_4x5(2.55,8,64,'2s','../results/epyc/merged20190306_0319_0328/jc2ic8jr4','epyc_jc2ic8jr4','MKL'); close; clear all;
% zen2
plot_panel_4x5(3.40,16,1, 'st','../results/zen2/20200929/st', 'zen2','MKL',1); close all; clear all;
plot_panel_4x5(2.60,16,64, '1s','../results/zen2/20200929/jc4ic4jr4','zen2','MKL',1); close all; clear all;
plot_panel_4x5(2.60,16,128,'2s','../results/zen2/20200929/jc8ic4jr4','zen2','MKL',1); close all; clear all;
plot_panel_4x5(3.40,16,1, 'st','../results/zen2/20200929/st', 'zen2','MKL'); close all; clear all;
plot_panel_4x5(2.60,16,64, '1s','../results/zen2/20200929/jc4ic4jr4','zen2','MKL'); close all; clear all;
plot_panel_4x5(2.60,16,128,'2s','../results/zen2/20200929/jc8ic4jr4','zen2','MKL'); close all; clear all;
% a64fx
plot_panel_4x5(2.20,32,1, 'st','../results/a64fx/20210316/st', 'a64fx','Fujitsu SSL2'); close all; clear all;
plot_panel_4x5(2.20,32,12,'1s','../results/a64fx/20210316/jc1ic4jr3', 'a64fx','Fujitsu SSL2'); close all; clear all;
plot_panel_4x5(2.20,32,48,'2s','../results/a64fx/20210316/jc1ic4jr12','a64fx','Fujitsu SSL2'); close all; clear all;
plot_panel_4x5(3.40,16,1, 'st','../results/zen2/20200929/st', 'zen2','MKL',1); close all; clear all; plot_panel_4x5(2.60,16,64, '1s','../results/zen2/20200929/jc4ic4jr4','zen2','MKL',1); close all; clear all; plot_panel_4x5(2.60,16,128,'2s','../results/zen2/20200929/jc8ic4jr4','zen2','MKL',1); close all; clear all;