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);
11self.singleReplicaTasks = [];
13%% build one subnetwork
for every processor
14for hidx = 1:lqn.nhosts
16 callers = lqn.tasksof{hidx};
17 self.buildLayersRecursive(hidx, callers,
true);
19 self.ensemble{hidx} = [];
23%% build one subnetwork
for every task
25 tidx = lqn.tshift + t;
26 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
27 % obtain the activity graph of each task that calls some entry in t
28 [calling_idx, called_entries] = find(lqn.iscaller(:, lqn.entriesof{tidx})); %#ok<ASGLU>
29 callers = intersect(lqn.tshift+(1:lqn.ntasks), unique(calling_idx)
');
30 if ~isempty(callers) % true if the server is a software task
31 self.buildLayersRecursive(tidx, callers, false);
33 self.ensemble{tidx} = [];
36 self.ensemble{tidx} = [];
40self.thinkt_classes_updmap = cell2mat(self.thinkt_classes_updmap);
41self.actthinkt_classes_updmap = cell2mat(self.actthinkt_classes_updmap);
42self.call_classes_updmap = cell2mat(self.call_classes_updmap);
43self.servt_classes_updmap = cell2mat(self.servt_classes_updmap);
44self.arvproc_classes_updmap = cell2mat(self.arvproc_classes_updmap);
45self.route_prob_updmap = cell2mat(self.route_prob_updmap);
47% we now calculate the new index of the models after removing the empty
48% models associated to 'ref
' tasks
49emptymodels = cellfun(@isempty,self.ensemble);
50self.ensemble(emptymodels) = [];
51self.idxhash = [1:length(emptymodels)]' - cumsum(emptymodels);
52self.idxhash(emptymodels) = NaN;
54%% Classify layers as host (processor) or task
for MOL iteration
55self.hostLayerIndices = [];
56self.taskLayerIndices = [];
58% Host layers: indices 1:nhosts (before idxhash remapping)
59for hidx = 1:lqn.nhosts
60 if ~isnan(self.idxhash(hidx))
61 self.hostLayerIndices(end+1) = self.idxhash(hidx);
65% Task layers: indices tshift+1:tshift+ntasks
67 tidx = lqn.tshift + t;
68 if ~isnan(self.idxhash(tidx))
69 self.taskLayerIndices(end+1) = self.idxhash(tidx);
73self.model.ensemble = self.ensemble;