Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

matlab VS. fortran, matlab win?

alsoran
Beginner
1,212 Views
I dont believe that :
fortran codes costs 1.5s
[fortran]use rand_int
real(8):: aa(573,573),bb(573,568),cc(573,568)
aa=rand(aa)
bb=rand(bb)
cc=matmul(aa,bb)[/fortran]
matlab codes costs 0.05s
[bash]aa=rand(573,573);
bb=rand(573,568);
cc=aa*bb;[/bash]
0 Kudos
5 Replies
Nikolay_I_Intel1
Employee
1,212 Views
Do matlab really computes product of two matrices before accessing its values?
0 Kudos
alsoran
Beginner
1,212 Views
I dont understand, all the codes is here, there is no additional codes, and the'rand' function get matrixs differently every time, so i think it did compute product.....
0 Kudos
Nikolay_I_Intel1
Employee
1,212 Views
Try to sum all elements in resulting matrix and measure time again.
0 Kudos
alsoran
Beginner
1,212 Views
i tried sum them, fortran codes costs "0.00000000 sec"
matlab costs "0.0005 sec"
0 Kudos
alsoran
Beginner
1,212 Views
and if i switch the opimization to "/O3" , fortran codes preformed better than before,but also slower than Matlab if multiply in 100 loops
0 Kudos
Reply