type file; app (file _matrix, file _out, file _err) genmatrix (int _height, int _width){ matrixgen _height _width @_matrix stdout=@_out stderr=@_err; } app (file _matrixc , file _out, file _err) matmul (int _heighta, int _widtha, int _widthb, file _matrixa, file _matrixb){ mulmat _heighta _widtha _widthb @_matrixa @_matrixb @_matrixc stdout=@_out stderr=@_err; } int HA=2544; int WA=3300; # generates 8M matrix int WB=3300; int mul=HA * WB; float coeffa=0.5; float coeffb=0.8; file mA_file[]; file mB_file[]; file mC_file[]; file genout1[]; file genout2[]; file generr1[]; file generr2[]; file mulout[]; file mulerr[]; foreach i in [0:19]{ # 1. create two random matrices (mA_file[i], genout1[i], generr1[i])=genmatrix(HA, WA); (mB_file[i], genout2[i], generr2[i])=genmatrix(WA, WB); # 2. multiply the matrix: mC = mA * mB (mC_file[i], mulout[i], mulerr[i]) = matmul (HA, WA, WB, mA_file[i], mB_file[i]); }