1function buildLayers(self)
3self.ensemble = cell(lqn.ntasks,1);
5self.servt_classes_updmap = cell(lqn.nhosts+lqn.ntasks,1);
6self.call_classes_updmap = cell(lqn.nhosts+lqn.ntasks,1);
7self.arvproc_classes_updmap = cell(lqn.nhosts+lqn.ntasks,1);
8self.thinkt_classes_updmap = cell(lqn.nhosts+lqn.ntasks,1);
9self.actthinkt_classes_updmap = cell(lqn.nhosts+lqn.ntasks,1);
10self.route_prob_updmap = cell(lqn.nhosts+lqn.ntasks,1);
12%% build one subnetwork
for every processor
13for hidx = 1:lqn.nhosts
15 callers = lqn.tasksof{hidx};
16 self.buildLayersRecursive(hidx, callers,
true);
18 self.ensemble{hidx} = [];
22%% build one subnetwork
for every task
24 tidx = lqn.tshift + t;
25 if ~self.ignore(tidx) & ~lqn.isref(tidx) & ~(isempty(find(self.lqn.iscaller(tidx,:), 1)) & isempty(find(self.lqn.iscaller(:,tidx), 1))) %#ok<OR2,AND2> % ignore isolated tasks and ref tasks
26 % obtain the activity graph of each task that calls some entry in t
27 [calling_idx, called_entries] = find(lqn.iscaller(:, lqn.entriesof{tidx})); %#ok<ASGLU>
28 callers = intersect(lqn.tshift+(1:lqn.ntasks), unique(calling_idx)
');
29 if ~isempty(callers) % true if the server is a software task
30 self.buildLayersRecursive(tidx, callers, false);
32 self.ensemble{tidx} = [];
35 self.ensemble{tidx} = [];
39self.thinkt_classes_updmap = cell2mat(self.thinkt_classes_updmap);
40self.actthinkt_classes_updmap = cell2mat(self.actthinkt_classes_updmap);
41self.call_classes_updmap = cell2mat(self.call_classes_updmap);
42self.servt_classes_updmap = cell2mat(self.servt_classes_updmap);
43self.arvproc_classes_updmap = cell2mat(self.arvproc_classes_updmap);
44self.route_prob_updmap = cell2mat(self.route_prob_updmap);
46% we now calculate the new index of the models after removing the empty
47% models associated to 'ref
' tasks
48emptymodels = cellfun(@isempty,self.ensemble);
49self.ensemble(emptymodels) = [];
50self.idxhash = [1:length(emptymodels)]' - cumsum(emptymodels);
51self.idxhash(emptymodels) = NaN;
53%% Classify layers as host (processor) or task
for MOL iteration
54self.hostLayerIndices = [];
55self.taskLayerIndices = [];
57% Host layers: indices 1:nhosts (before idxhash remapping)
58for hidx = 1:lqn.nhosts
59 if ~isnan(self.idxhash(hidx))
60 self.hostLayerIndices(end+1) = self.idxhash(hidx);
64% Task layers: indices tshift+1:tshift+ntasks
66 tidx = lqn.tshift + t;
67 if ~isnan(self.idxhash(tidx))
68 self.taskLayerIndices(end+1) = self.idxhash(tidx);
72self.model.ensemble = self.ensemble;