-
Notifications
You must be signed in to change notification settings - Fork 3
/
reportMCMCtocs.m
65 lines (53 loc) · 1.95 KB
/
reportMCMCtocs.m
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
%% collect matfiles and report MCMCtoc times
clear
clc
close all
matdir = 'matfilesJEDCR1';
datalabel = 'INFTRMSRV';
Nmcmc = 1e4;
initwrap
%% collect matfiles
mates = dir(fullfile(matdir, sprintf('slim-commontrendinflation-%s-Ndraws%s-*multithreaded.mat', datalabel, erase(sprintf('%1.0e', Nmcmc), '+'))));
% mates = dir(fullfile(matdir, 'commontrendinflationRbar-*.mat'));
matefiles = cell(length(mates), 1);
for m = 1 : length(mates)
matefiles{m} = matfile(fullfile(mates(m).folder, mates(m).name));
end
datalabels = cellfun(@(c) c.datalabel, matefiles, 'UniformOutput',false);
execLabels = cellfun(@(c) c.execLabel, matefiles, 'UniformOutput',false);
MCMCseconds = cellfun(@(c) c.MCMCtime, matefiles, 'UniformOutput',true);
MCMCminutes = MCMCseconds / 60;
MCMChours = MCMCminutes / 60;
MCMCrem = mod(MCMCminutes, 60);
%% construct pretty label
prettyLabels = cell(size(execLabels));
for nn = 1 : length(execLabels)
if contains(execLabels(nn), 'DK')
prettyLabels{nn} = 'DK';
else
prettyLabels{nn} = 'PS';
end
% if contains(execLabels(nn), 'multi')
% prettyLabels{nn} = strcat(prettyLabels{nn}, ' (multi-threaded)');
% else
% prettyLabels{nn} = strcat(prettyLabels{nn}, ' (single thread)');
% end
end
%% tabulate
timetable = table(datalabels, execLabels, prettyLabels, MCMCseconds, MCMCminutes, MCMChours, MCMCrem);
timetable = sortrows(timetable, [1 4], 'descend');
display(timetable)
%% barplot
fontsize = 14;
thisfig = figure;
bar(1:length(mates), timetable.MCMChours)
ax = gca;
set(ax, 'fontsize', fontsize)
xticklabels(timetable.prettyLabels)
ylim([0 15])
valLabels = arrayfun(@(h,m) sprintf('%3.0fh %dmin', h, m), floor(timetable.MCMChours), round(timetable.MCMCrem), 'uniformoutput', false);
text(1:length(mates),timetable.MCMChours, valLabels,'vert','bottom','horiz','center', 'Fontsize', fontsize);
box off
wrapthisfigure(thisfig, 'commontrendMCMCtimesMultithreaded', wrap)
%% finish
finishwrap