   1 :program matrix;
                                           0 :PROGRAM 30609 30658 17 310
   2 :const	maximum = 100;
   3 :type	vector = array [0..maximum] of integer;
   4 :	matrix = array [0..maximum] of vector;
   5 :
   6 :var	n, n1: shared integer;
   7 :	a, b, c: shared matrix;
   8 :	timer, t: integer;
   9 :	timer1, t1: integer;
  10 :
  11 :procedure readMatrix;
                                           5 :PROCEDURE 2 10 0 5
  12 :var row, j : integer;
  13 :begin
  14 :
  15 :  write('n = (max = ',maximum,') : '); readln(n);
                                          10 :CONSTANT 540876910
                                          12 :CONSTANT 2019650856
                                          14 :CONSTANT 2015378720
                                          16 :WRITESTR 3 11
                                          19 :CONSTANT 100
                                          21 :WRITEINT
                                          22 :CONSTANT 540680233
                                          24 :WRITESTR 1 4
                                          27 :GLOBALVAR 3
                                          29 :READINT
  16 :  writeln(n);
                                          30 :GLOBALVALUE 3
                                          32 :WRITEINT
                                          33 :CONSTANT 2573
                                          35 :WRITESTR 1 2
  17 :  n1 := n-1;
                                          38 :GLOBALVAR 4
                                          40 :GLOBALVALUE 3
                                          42 :CONSTANT 1
                                          44 :SUBTRACT
                                          45 :SIMPLEASSIGN
  18 :  for  0 to n1 do 
                                          46 :CONSTANT 0
                                          48 :GLOBALVALUE 4
  19 :    begin
                                          50 :INITFOR 34
  20 :    row := counter;
                                          52 :LOCALVAR 3
                                          54 :PUSHCOUNTER
                                          55 :PRIVATESIMPLEASSIGN
  21 :    for 0 to n1 do
                                          56 :CONSTANT 0
                                          58 :GLOBALVALUE 4
  22 :        read(a[row][counter]);
                                          60 :INITNESTEDFOR 21
                                          62 :GLOBALVAR 5
                                          64 :LOCALVALUE 3
                                          66 :INDEX 0 100 101 22
                                          71 :PUSHCOUNTER
                                          72 :INDEX 0 100 1 22
                                          77 :READINT
                                          78 :NESTEDLOOP -16 1
  23 :    end;
                                          81 :LOOP -29 1
  24 :
  25 :  writeln;
                                          84 :CONSTANT 4852237
                                          86 :WRITESTR 1 2
  26 :
  27 :  for  0 to n1 do 
                                          89 :CONSTANT 0
                                          91 :GLOBALVALUE 4
  28 :    begin
                                          93 :INITFOR 34
  29 :    row := counter;
                                          95 :LOCALVAR 3
                                          97 :PUSHCOUNTER
                                          98 :PRIVATESIMPLEASSIGN
  30 :    for 0 to n1 do
                                          99 :CONSTANT 0
                                         101 :GLOBALVALUE 4
  31 :        read(b[row][counter]);
                                         103 :INITNESTEDFOR 21
                                         105 :GLOBALVAR 10206
                                         107 :LOCALVALUE 3
                                         109 :INDEX 0 100 101 31
                                         114 :PUSHCOUNTER
                                         115 :INDEX 0 100 1 31
                                         120 :READINT
                                         121 :NESTEDLOOP -16 1
  32 :    end
  33 :end;
                                         124 :LOOP -29 1
                                         127 :ENDPROC 0
  34 :
  35 :procedure writeMatrix;
                                         129 :PROCEDURE 2 6 0 5
  36 :var row, j: integer;
  37 :begin
  38 :  for 0 to n1 do
                                         134 :CONSTANT 0
                                         136 :GLOBALVALUE 4
  39 :  	begin
                                         138 :INITFOR 60
  40 :	row := counter;
                                         140 :LOCALVAR 3
                                         142 :PUSHCOUNTER
                                         143 :PRIVATESIMPLEASSIGN
  41 :        for 0 to n1 do
                                         144 :CONSTANT 0
                                         146 :GLOBALVALUE 4
  42 :      	  writeln('c [',row,',', counter,'] = ', c[row][counter]);
                                         148 :INITNESTEDFOR 47
                                         150 :CONSTANT 5972067
                                         152 :WRITESTR 1 3
                                         155 :LOCALVALUE 3
                                         157 :WRITEINT
                                         158 :CONSTANT 44
                                         160 :WRITESTR 1 1
                                         163 :PUSHCOUNTER
                                         164 :WRITEINT
                                         165 :CONSTANT 540876893
                                         167 :WRITESTR 1 4
                                         170 :GLOBALVAR 20407
                                         172 :LOCALVALUE 3
                                         174 :INDEX 0 100 101 42
                                         179 :PUSHCOUNTER
                                         180 :INDEX 0 100 1 42
                                         185 :SIMPLEVALUE
                                         186 :WRITEINT
                                         187 :CONSTANT 2573
                                         189 :WRITESTR 1 2
                                         192 :NESTEDLOOP -42 1
  43 :	end;
                                         195 :LOOP -55 1
  44 :end;
                                         198 :ENDPROC 0
  45 :
  46 :
  47 :procedure prod;
                                         200 :PROCEDURE 0 2 0 5
  48 :begin
  49 :  relax parallel 0..n1 do
                                         205 :RELAX
                                         206 :CONSTANT 0
                                         208 :GLOBALVALUE 4
                                         210 :PATTERN 97 1
  50 :    var row: shared integer;
  51 :    begin
                                         213 :NEWBLOCK 1
  52 :       row := name;
                                         215 :LOCALVAR 3
                                         217 :PUSHNAME 52
                                         219 :SIMPLEASSIGN
  53 :      parallel 0..n1 do
                                         220 :CONSTANT 0
                                         222 :GLOBALVALUETWO 4
                                         224 :NESTEDPATTERN 81 1
  54 :        var sum : integer;
  55 :        begin
                                         227 :NEWBLOCK 1
  56 :          sum := 0;
                                         229 :LOCALVAR 3
                                         231 :CONSTANT 0
                                         233 :PRIVATESIMPLEASSIGN
  57 :	  for 0 to n1 do
                                         234 :PUSHPATTERN
                                         235 :CONSTANT 0
                                         237 :GLOBALVALUETHREE 4
  58 :              sum := sum + a[row][counter]*b[counter][name];
                                         239 :INITFOR 44
                                         241 :LOCALVAR 3
                                         243 :LOCALVALUE 3
                                         245 :GLOBALVARTHREE 5
                                         247 :GLOBALVALUE 3
                                         249 :INDEX 0 100 101 58
                                         254 :PUSHCOUNTER
                                         255 :INDEX 0 100 1 58
                                         260 :SIMPLEVALUE
                                         261 :GLOBALVARTHREE 10206
                                         263 :PUSHCOUNTER
                                         264 :INDEX 0 100 101 58
                                         269 :PUSHNAME 58
                                         271 :INDEX 0 100 1 58
                                         276 :SIMPLEVALUE
                                         277 :MULTIPLY
                                         278 :ADD
                                         279 :PRIVATESIMPLEASSIGN
                                         280 :LOOP -39 1
                                         283 :POPPATTERN
  59 :          c[row][name] := sum;
                                         284 :GLOBALVARTHREE 20407
                                         286 :GLOBALVALUE 3
                                         288 :INDEX 0 100 101 59
                                         293 :PUSHNAME 59
                                         295 :INDEX 0 100 1 59
                                         300 :LOCALVALUE 3
                                         302 :SIMPLEASSIGN
  60 :        end;
                                         303 :ENDBLOCK
                                         304 :ENDNESTEDPATTERN
  61 :    end;
                                         305 :ENDBLOCK
                                         306 :ENDPATTERN
                                         307 :ENDRELAX
  62 :end;
                                         308 :ENDPROC 0
  63 :
  64 :begin
  65 :  settime(t1);
                                         310 :LOCALVAR 30611
                                         312 :PRIVATESETTIME
  66 :  readMatrix;
                                         313 :LOCALCALL -308
  67 :  gettime(timer1, t1);
                                         315 :LOCALVAR 30610
                                         317 :LOCALVALUE 30611
                                         319 :PRIVATEGETTIME
  68 :  writeln('Ticks de lectura: ------------> ', timer1);
                                         320 :CONSTANT 1801677140
                                         322 :CONSTANT 1701060723
                                         324 :CONSTANT 1667591200
                                         326 :CONSTANT 1634891124
                                         328 :CONSTANT 757932090
                                         330 :CONSTANT 757935405
                                         332 :CONSTANT 757935405
                                         334 :CONSTANT 540945709
                                         336 :WRITESTR 8 32
                                         339 :LOCALVALUE 30610
                                         341 :WRITEINT
                                         342 :CONSTANT 2573
                                         344 :WRITESTR 1 2
  69 :
  70 :
  71 :  writeln;
                                         347 :CONSTANT 2573
                                         349 :WRITESTR 1 2
  72 :  writeln('Calculando...');
                                         352 :CONSTANT 1668047171
                                         354 :CONSTANT 1851878517
                                         356 :CONSTANT 774795108
                                         358 :CONSTANT 774795054
                                         360 :WRITESTR 4 13
                                         363 :CONSTANT 2573
                                         365 :WRITESTR 1 2
  73 :
  74 :  settime(t);
                                         368 :LOCALVAR 30609
                                         370 :PRIVATESETTIME
  75 :  prod;
                                         371 :LOCALCALL -171
  76 :  gettime(timer, t);
                                         373 :LOCALVAR 30608
                                         375 :LOCALVALUE 30609
                                         377 :PRIVATEGETTIME
  77 :
  78 :  writeln;
                                         378 :CONSTANT 2573
                                         380 :WRITESTR 1 2
  79 :  writeln('Fin del C lculo.');
                                         383 :CONSTANT 544106822
                                         385 :CONSTANT 543974756
                                         387 :CONSTANT 1668063299
                                         389 :CONSTANT 779054197
                                         391 :WRITESTR 4 16
                                         394 :CONSTANT 2573
                                         396 :WRITESTR 1 2
  80 :  writeMatrix;
                                         399 :LOCALCALL -270
  81 :  writeln('Ticks: ------------> ', timer);
                                         401 :CONSTANT 1801677140
                                         403 :CONSTANT 757086835
                                         405 :CONSTANT 757935405
                                         407 :CONSTANT 757935405
                                         409 :CONSTANT 1043148077
                                         411 :CONSTANT 1043148064
                                         413 :WRITESTR 6 21
                                         416 :LOCALVALUE 30608
                                         418 :WRITEINT
                                         419 :CONSTANT 2573
                                         421 :WRITESTR 1 2
  82 :  writeln('Segundos: ---------> ', timer div 15625);
                                         424 :CONSTANT 1969710419
                                         426 :CONSTANT 1936680046
                                         428 :CONSTANT 757932090
                                         430 :CONSTANT 757935405
                                         432 :CONSTANT 1043148077
                                         434 :CONSTANT 1043148064
                                         436 :WRITESTR 6 21
                                         439 :LOCALVALUE 30608
                                         441 :CONSTANT 15625
                                         443 :DIVIDE
                                         444 :WRITEINT
                                         445 :CONSTANT 2573
                                         447 :WRITESTR 1 2
  83 :end.
  84 :
                                         450 :ENDPROG
