mirror of
https://github.com/amd/blis.git
synced 2026-05-11 09:39:59 +00:00
Updated matlab (now octave) plot code in test/3.
Details: - Renamed test/3/matlab to test/3/octave. - Within test/3, updated and tuned plot_l3_perf.m and plot_panel_4x5.m files for use with octave (which is free and doesn't crash on me mid-way through my use of subplot). - Updated runthese.m scratchpad for zen2 invocations. - Added Nikolay S.'s subplot_tight() function, along with its license.
This commit is contained in:
@@ -20,4 +20,3 @@ end
|
||||
|
||||
r_val = opnames;
|
||||
|
||||
end
|
||||
@@ -8,12 +8,18 @@ function r_val = plot_l3_perf( opname, ...
|
||||
with_eigen, ...
|
||||
cfreq, ...
|
||||
dfps, ...
|
||||
theid )
|
||||
theid, ...
|
||||
leg_pos_st, leg_pos_mt, ...
|
||||
sp_margins )
|
||||
|
||||
if 1
|
||||
ax1 = subplot( rows, cols, theid );
|
||||
hold( ax1, 'on' );
|
||||
end
|
||||
% Define the column in which the performance rates are found.
|
||||
flopscol = size( data_blis, 2 );
|
||||
|
||||
% Define which plot id will have the legend.
|
||||
% NOTE: We can draw the legend on any graph as long as it has already been
|
||||
% rendered. Since the coordinates are global, we can simply always wait until
|
||||
% the final graph to draw the legend.
|
||||
legend_plot_id = cols*rows;
|
||||
|
||||
% Set line properties.
|
||||
color_blis = 'k'; lines_blis = '-'; markr_blis = '';
|
||||
@@ -56,10 +62,6 @@ eige_legend = sprintf( 'Eigen' );
|
||||
%vend_legend = sprintf( 'ARMPL' );
|
||||
vend_legend = vend_str;
|
||||
|
||||
% Determine the final dimension.
|
||||
%n_points = size( data_blis, 1 );
|
||||
%x_end = data_blis( n_points, 1 );
|
||||
|
||||
% Set axes range values.
|
||||
y_scale = 1.00;
|
||||
x_begin = 0;
|
||||
@@ -68,25 +70,30 @@ y_begin = 0;
|
||||
y_end = max_perf_core * y_scale;
|
||||
|
||||
% Set axes names.
|
||||
xaxisname = ' m = n = k';
|
||||
if nth == 1
|
||||
yaxisname = 'GFLOPS';
|
||||
else
|
||||
yaxisname = 'GFLOPS/core';
|
||||
end
|
||||
|
||||
|
||||
%flopscol = 4;
|
||||
flopscol = size( data_blis, 2 );
|
||||
% Set the marker size, font size, and other items.
|
||||
msize = 5;
|
||||
if 1
|
||||
fontsize = 13;
|
||||
if 0
|
||||
xaxisname = ' m = n = k';
|
||||
fontsize = 12;
|
||||
else
|
||||
fontsize = 16;
|
||||
xaxisname = 'm = n = k';
|
||||
fontsize = 20;
|
||||
end
|
||||
linesize = 0.5;
|
||||
legend_loc = 'southeast';
|
||||
|
||||
%ax1 = subplot( rows, cols, theid );
|
||||
ax1 = subplot_tight( rows, cols, theid, sp_margins );
|
||||
|
||||
% Hold the axes.
|
||||
hold( ax1, 'on' );
|
||||
|
||||
% --------------------------------------------------------------------
|
||||
|
||||
x_axis( :, 1 ) = data_blis( :, 1 );
|
||||
@@ -133,7 +140,8 @@ end
|
||||
|
||||
if rows == 4 && cols == 5
|
||||
|
||||
if nth == 1 && theid == 3
|
||||
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, ...
|
||||
@@ -143,10 +151,12 @@ if rows == 4 && cols == 5
|
||||
blis_legend, open_legend, vend_legend, ...
|
||||
'Location', legend_loc );
|
||||
end
|
||||
set( leg,'Box','off','Color','none','Units','inches','FontSize',fontsize-3 );
|
||||
set( leg,'Position',[11.20 12.81 0.7 0.3 ] ); % (0,2br)
|
||||
%set( leg,'Position',[ 4.20 12.81 0.7 0.3 ] ); % (0,0br)
|
||||
elseif nth > 1 && theid == 4
|
||||
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, ...
|
||||
@@ -156,20 +166,13 @@ if rows == 4 && cols == 5
|
||||
blis_legend, open_legend, vend_legend, ...
|
||||
'Location', legend_loc );
|
||||
end
|
||||
set( leg,'Box','off','Color','none','Units','inches','FontSize',fontsize-3 );
|
||||
%set( leg,'Position',[7.70 12.81 0.7 0.3 ] ); % (0,1br)
|
||||
%set( leg,'Position',[11.20 12.81 0.7 0.3 ] ); % (0,2br)
|
||||
set( leg,'Position',[10.47 14.17 0.7 0.3 ] ); % (0,2tl)
|
||||
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
|
||||
%set( leg,'Position',[ 4.20 12.75 0.7 0.3 ] ); % (0,0br)
|
||||
%set( leg,'Position',[ 7.70 12.75 0.7 0.3 ] ); % (0,1br)
|
||||
%set( leg,'Position',[10.47 14.28 0.7 0.3 ] ); % (0,2tl)
|
||||
%set( leg,'Position',[11.20 12.75 0.7 0.3 ] ); % (0,2br)
|
||||
%set( leg,'Position',[13.95 14.28 0.7 0.3 ] ); % (0,3tl)
|
||||
%set( leg,'Position',[14.70 12.75 0.7 0.3 ] ); % (0,3br)
|
||||
%set( leg,'Position',[17.45 14.28 0.7 0.3 ] ); % (0,4tl)
|
||||
%set( leg,'Position',[18.22 12.75 0.7 0.3 ] ); % (0,4br)
|
||||
|
||||
set( ax1,'FontSize',fontsize );
|
||||
set( ax1,'TitleFontSizeMultiplier',1.0 ); % default is 1.1.
|
||||
@@ -182,6 +185,7 @@ tpos = get( titl, 'Position' ); % default is to align across whole figure, not b
|
||||
%tpos(1) = tpos(1) + 100;
|
||||
tpos(1) = tpos(1) + 40;
|
||||
set( titl, 'Position', tpos ); % here we nudge it back to centered with box.
|
||||
set( titl, 'FontSize', fontsize );
|
||||
|
||||
if theid > (rows-1)*cols
|
||||
xlab = xlabel( ax1,xaxisname );
|
||||
@@ -194,11 +198,5 @@ if mod(theid-1,cols) == 0
|
||||
ylab = ylabel( ax1,yaxisname );
|
||||
end
|
||||
|
||||
%export_fig( filename, colorflag, '-pdf', '-m2', '-painters', '-transparent' );
|
||||
%saveas( fig, filename_png );
|
||||
|
||||
%hold( ax1, 'off' );
|
||||
|
||||
r_val = 0;
|
||||
|
||||
end
|
||||
@@ -7,8 +7,41 @@ function r_val = plot_panel_4x5( cfreq, ...
|
||||
vend_str, ...
|
||||
with_eigen )
|
||||
|
||||
%cfreq = 1.8;
|
||||
%dflopspercycle = 32;
|
||||
impl = 'octave';
|
||||
%impl = 'matlab';
|
||||
|
||||
%sp = 'default';
|
||||
subp = 'tight';
|
||||
|
||||
if strcmp( subp, 'default' )
|
||||
position = [100 100 2000 1500];
|
||||
papersize = [14.2 19.0];
|
||||
leg_pos_st = [3.40 8.70 1.9 1.0 ]; % (0,2br)
|
||||
leg_pos_mt = [13.08 13.09 1.9 1.0 ]; % (0,3tr)
|
||||
sp_margins = [ 0.070 0.049 ];
|
||||
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)
|
||||
sp_margins = [ 0.068 0.051 ];
|
||||
end
|
||||
|
||||
%fig = figure('Position', [100, 100, 2000, 1500]);
|
||||
fig = figure('Position', position);
|
||||
orient( fig, 'portrait' );
|
||||
set(gcf,'PaperUnits', 'inches');
|
||||
if strcmp( impl, 'octave' )
|
||||
%set(gcf,'PaperSize', [14.2 19.0]);
|
||||
set(gcf,'PaperSize', papersize);
|
||||
%set(gcf,'PaperPositionMode','auto');
|
||||
set(gcf,'PaperPositionMode','auto');
|
||||
else % impl == 'matlab'
|
||||
set(gcf,'PaperSize', [13 20.0]);
|
||||
set(gcf,'PaperPosition', [0 0 13 20.0]);
|
||||
set(gcf,'PaperPositionMode','manual');
|
||||
end
|
||||
set(gcf,'PaperOrientation','landscape');
|
||||
|
||||
% Create filename "templates" for the files that contain the performance
|
||||
% results.
|
||||
@@ -34,20 +67,6 @@ ops( 5, : ) = 'trsm';
|
||||
opnames = gen_opnames( ops, dts );
|
||||
n_opnames = size( opnames, 1 );
|
||||
|
||||
fig = figure('Position', [100, 100, 2000, 1500]);
|
||||
orient( fig, 'portrait' );
|
||||
set(gcf,'PaperUnits', 'inches');
|
||||
if 1 == 1 % matlab
|
||||
set(gcf,'PaperSize', [11 15.0]);
|
||||
set(gcf,'PaperPosition', [0 0 11 15.0]);
|
||||
set(gcf,'PaperPositionMode','manual');
|
||||
else % octave 4.x
|
||||
set(gcf,'PaperSize', [15 19.0]);
|
||||
set(gcf,'PaperPositionMode','auto');
|
||||
end
|
||||
set(gcf,'PaperOrientation','landscape');
|
||||
|
||||
|
||||
% Iterate over the list of datatype-specific operation names.
|
||||
for opi = 1:n_opnames
|
||||
%for opi = 1:1
|
||||
@@ -108,7 +127,9 @@ for opi = 1:n_opnames
|
||||
with_eigen, ...
|
||||
cfreq, ...
|
||||
dflopspercycle, ...
|
||||
opi );
|
||||
opi, ...
|
||||
leg_pos_st, leg_pos_mt, ...
|
||||
sp_margins );
|
||||
|
||||
end
|
||||
|
||||
@@ -118,6 +139,9 @@ outfile = sprintf( 'l3_perf_%s_nt%d.pdf', arch_str, nth );
|
||||
|
||||
% Output the graph to pdf format.
|
||||
%print(gcf, 'gemm_md','-fillpage','-dpdf');
|
||||
print(gcf, outfile,'-bestfit','-dpdf');
|
||||
|
||||
if strcmp( impl, 'octave' )
|
||||
print( gcf, outfile );
|
||||
else
|
||||
print( gcf, outfile, '-bestfit', '-dpdf' );
|
||||
end
|
||||
|
||||
@@ -4,32 +4,21 @@ 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
|
||||
% pre-eigen:
|
||||
%plot_panel_4x5(2.00,32,1, 'st','../results/skx/20190306/st', 'skx', 'MKL'); close; clear all;
|
||||
%plot_panel_4x5(2.00,32,26,'1s','../results/skx/20190306/jc2ic13','skx_jc2ic13','MKL'); close; clear all;
|
||||
%plot_panel_4x5(2.00,32,52,'2s','../results/skx/20190306/jc4ic13','skx_jc4ic13','MKL'); close; clear all;
|
||||
% with eigen:
|
||||
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;
|
||||
|
||||
% has
|
||||
% pre-eigen:
|
||||
%plot_panel_4x5(3.25,16,1, 'st','../results/has/20190206/st', 'has', 'MKL',1); close; clear all;
|
||||
%plot_panel_4x5(3.00,16,12,'1s','../results/has/20190206/jc2ic3jr2','has_jc2ic3jr2','MKL',1); close; clear all;
|
||||
%plot_panel_4x5(3.00,16,24,'2s','../results/has/20190206/jc4ic3jr2','has_jc4ic3jr2','MKL',1); close; clear all;
|
||||
% with eigen:
|
||||
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;
|
||||
|
||||
% epyc
|
||||
% pre-eigen:
|
||||
%plot_panel_4x5(3.00,8,1, 'st','../results/epyc/merged201903_0619/st','epyc', 'MKL'); close; clear all;
|
||||
%plot_panel_4x5(2.55,8,32,'1s','../results/epyc/merged201903_0619/jc1ic8jr4','epyc_jc1ic8jr4','MKL'); close; clear all;
|
||||
%plot_panel_4x5(2.55,8,64,'2s','../results/epyc/merged201903_0619/jc2ic8jr4','epyc_jc2ic8jr4','MKL'); close; clear all;
|
||||
% with eigen:
|
||||
% 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;
|
||||
|
||||
% 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;
|
||||
126
test/3/octave/subplot_tight.m
Normal file
126
test/3/octave/subplot_tight.m
Normal file
@@ -0,0 +1,126 @@
|
||||
%
|
||||
% Copyright (c) 2016, Nikolay S.
|
||||
% All rights reserved.
|
||||
%
|
||||
% Redistribution and use in source and binary forms, with or without
|
||||
% modification, are permitted provided that the following conditions are
|
||||
% met:
|
||||
%
|
||||
% * Redistributions of source code must retain the above copyright
|
||||
% notice, this list of conditions and the following disclaimer.
|
||||
% * Redistributions in binary form must reproduce the above copyright
|
||||
% notice, this list of conditions and the following disclaimer in
|
||||
% the documentation and/or other materials provided with the distribution
|
||||
%
|
||||
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
% POSSIBILITY OF SUCH DAMAGE.
|
||||
%
|
||||
|
||||
function vargout=subplot_tight(m, n, p, margins, varargin)
|
||||
%% subplot_tight
|
||||
% A subplot function substitude with margins user tunabble parameter.
|
||||
%
|
||||
%% Syntax
|
||||
% h=subplot_tight(m, n, p);
|
||||
% h=subplot_tight(m, n, p, margins);
|
||||
% h=subplot_tight(m, n, p, margins, subplotArgs...);
|
||||
%
|
||||
%% Description
|
||||
% Our goal is to grant the user the ability to define the margins between neighbouring
|
||||
% subplots. Unfotrtunately Matlab subplot function lacks this functionality, and the
|
||||
% margins between subplots can reach 40% of figure area, which is pretty lavish. While at
|
||||
% the begining the function was implememnted as wrapper function for Matlab function
|
||||
% subplot, it was modified due to axes del;etion resulting from what Matlab subplot
|
||||
% detected as overlapping. Therefore, the current implmenetation makes no use of Matlab
|
||||
% subplot function, using axes instead. This can be problematic, as axis and subplot
|
||||
% parameters are quie different. Set isWrapper to "True" to return to wrapper mode, which
|
||||
% fully supports subplot format.
|
||||
%
|
||||
%% Input arguments (defaults exist):
|
||||
% margins- two elements vector [vertical,horizontal] defining the margins between
|
||||
% neighbouring axes. Default value is 0.04
|
||||
%
|
||||
%% Output arguments
|
||||
% same as subplot- none, or axes handle according to function call.
|
||||
%
|
||||
%% Issues & Comments
|
||||
% - Note that if additional elements are used in order to be passed to subplot, margins
|
||||
% parameter must be defined. For default margins value use empty element- [].
|
||||
% -
|
||||
%
|
||||
%% Example
|
||||
% close all;
|
||||
% img=imread('peppers.png');
|
||||
% figSubplotH=figure('Name', 'subplot');
|
||||
% figSubplotTightH=figure('Name', 'subplot_tight');
|
||||
% nElems=17;
|
||||
% subplotRows=ceil(sqrt(nElems)-1);
|
||||
% subplotRows=max(1, subplotRows);
|
||||
% subplotCols=ceil(nElems/subplotRows);
|
||||
% for iElem=1:nElems
|
||||
% figure(figSubplotH);
|
||||
% subplot(subplotRows, subplotCols, iElem);
|
||||
% imshow(img);
|
||||
% figure(figSubplotTightH);
|
||||
% subplot_tight(subplotRows, subplotCols, iElem, [0.0001]);
|
||||
% imshow(img);
|
||||
% end
|
||||
%
|
||||
%% See also
|
||||
% - subplot
|
||||
%
|
||||
%% Revision history
|
||||
% First version: Nikolay S. 2011-03-29.
|
||||
% Last update: Nikolay S. 2012-05-24.
|
||||
%
|
||||
% *List of Changes:*
|
||||
% 2012-05-24
|
||||
% Non wrapping mode (based on axes command) added, to deal with an issue of disappearing
|
||||
% subplots occuring with massive axes.
|
||||
|
||||
%% Default params
|
||||
isWrapper=false;
|
||||
if (nargin<4) || isempty(margins)
|
||||
margins=[0.04,0.04]; % default margins value- 4% of figure
|
||||
end
|
||||
if length(margins)==1
|
||||
margins(2)=margins;
|
||||
end
|
||||
|
||||
%note n and m are switched as Matlab indexing is column-wise, while subplot indexing is row-wise :(
|
||||
[subplot_col,subplot_row]=ind2sub([n,m],p);
|
||||
|
||||
|
||||
height=(1-(m+1)*margins(1))/m; % single subplot height
|
||||
width=(1-(n+1)*margins(2))/n; % single subplot width
|
||||
|
||||
% note subplot suppors vector p inputs- so a merged subplot of higher dimentions will be created
|
||||
subplot_cols=1+max(subplot_col)-min(subplot_col); % number of column elements in merged subplot
|
||||
subplot_rows=1+max(subplot_row)-min(subplot_row); % number of row elements in merged subplot
|
||||
|
||||
merged_height=subplot_rows*( height+margins(1) )- margins(1); % merged subplot height
|
||||
merged_width= subplot_cols*( width +margins(2) )- margins(2); % merged subplot width
|
||||
|
||||
merged_bottom=(m-max(subplot_row))*(height+margins(1)) +margins(1); % merged subplot bottom position
|
||||
merged_left=min(subplot_col)*(width+margins(2))-width; % merged subplot left position
|
||||
pos=[merged_left, merged_bottom, merged_width, merged_height];
|
||||
|
||||
|
||||
if isWrapper
|
||||
h=subplot(m, n, p, varargin{:}, 'Units', 'Normalized', 'Position', pos);
|
||||
else
|
||||
h=axes('Position', pos, varargin{:});
|
||||
end
|
||||
|
||||
if nargout==1
|
||||
vargout=h;
|
||||
end
|
||||
Reference in New Issue
Block a user