-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_vars.m
131 lines (110 loc) · 3.23 KB
/
setup_vars.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
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
function [] = setup_vars()
%SETUP_VARS If a function responsible for initialising the correct
% dataset and graph output paths based on OS type while printing
% our current execution configuration.
%
% Author: Andreas Grammenos (ag926@cl.cam.ac.uk)
%
% Last touched date: 30/12/2018
%
% License: GPLv3
%
% invoke the global variables
global graphPath
global pflag
global pdf_print
global fig_print
global datasetPath
global run_synthetic
global run_real
global run_speed_test
global run_moses_scaling
global use_fast_moses_only
global use_offline_svds
global use_blk_err
if ispc
fprintf("\n !! Detected Windows PC !!\n");
graphPath = ".\graphs\";
datasetPath = ".\datasets\";
else
fprintf("\n !! Detected Unix-like PC !!\n");
graphPath = './graphs/';
datasetPath = './datasets/';
end
%% Execution parameters
fprintf("\n !! Execution parameters\n");
if use_fast_moses_only == 1
fprintf("\n\t ** Fast MOSES only: ENABLED (GOOD!!)");
else
fprintf("\n\t ** Fast MOSES only: DISABLED (Happy waiting!!)");
end
if use_blk_err == 1
fprintf("\n\t ** Per block error calculation: ENABLED (VERY GOOD!!)");
else
fprintf("\n\t ** Per block error calculation: DISABLED (snif!)");
end
if use_offline_svds == 1
fprintf(['\n\t -- Full Offline SVDS: ENABLED (WHY?)\n\t ', ...
' Better go and take a nap, this is gonna take a while...']);
else
fprintf("\n\t ** Full Offline SVDS: DISABLED (VERY GOOD!!)");
end
if run_synthetic == 1
fprintf("\n\t ** Running synthetic dataset tests: ENABLED");
else
fprintf("\n\t ** Running synthetic dataset tests: DISABLED");
end
if run_real == 1
fprintf("\n\t ** Running real dataset tests: ENABLED");
else
fprintf("\n\t ** Running real dataset tests: DISABLED");
end
if run_speed_test == 1
fprintf("\n\t ** Running MOSES speed tests: ENABLED");
else
fprintf("\n\t ** Running MOSES speed tests: DISABLED");
end
if run_moses_scaling
fprintf("\n\t ** Running MOSES scaling tests: ENABLED");
else
fprintf("\n\t ** Running MOSES scaling tests: DISABLED");
end
% spacing
fprintf("\n\n");
%% Figure printing configuration
if pflag == 1
fprintf("\n !! Printing functionality is: ENABLED\n");
% if we do, make sure the directory is created please note that the name
% adheres to the ISO-8601 timestamp format
fp = strcat(graphPath, datestr(now, 'yyyymmddTHHMMSS'));
fprintf("\n\t** Trying to create save folder in: %s", fp);
[s, ~, ~] = mkdir(char(fp));
if s ~= 1
fprintf("\n\t!! Error, could not create the folder; disabling figure export\n");
pflag = 0;
else
fprintf("\n\t** Folder %s created successfully", fp);
% update the path with the specific runtime folder
if ispc
graphPath = strcat(fp, "\");
else
graphPath = strcat(fp, '/');
end
fprintf("\n\t** Target graph dir: %s", graphPath);
end
% check if we are printing a .pdf or .png
if pdf_print == 1
fprintf("\n\t** Printing output is set to: PDF");
else
fprintf("\n\t** Printing output is set to: PNG");
end
% check if we are printing .fig
if fig_print == 1
fprintf("\n\t** Printing to .fig format is: ENABLED\n");
else
fprintf("\n\t** Printing to .fig format is: DISABLED\n");
end
else
fprintf("\n !! Printing functionality is: DISABLED\n");
end
end