Civil Engineering Association

Full Version: Speed Test "NET 3.5" vs "Intel Fortran"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Speed Test "NET 3.5" vs "Intel Fortran"

Here I want to show the speed of NET 3.5 vs Intel Fortran.
I was amazing when I saw that NET application runs to fast versus Intel Fortran application.
I was used XP SP3, Visual Studio 2008 with NET 3.5 and Intel Fortran 11.1.067.
In both programs the same mathematical procedure is implemented. Solving of equations by Gauss elimination process.

The results for solving 1000 equations are:
computer: CPU2.6GHz, RAM 1.7GB, XP Sp3
NET 3.5 = 4.7sec
Intel Fortran = 16.8sec
Lahey Fortran = 7.2sec


Winner is NET application.

Maybe I made some mistake in Intel Fortran Compiler. Maybe I didn't include any optimization.


[Image: Download.png]

Here are source codes and executable files.
Code:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************

The difference is shocking!
Using your EXEs:
Intel Fortran - 11.36 s
VB.NET35 - 4.75 s

This is on a Vista64 on Turion Ulta X2 - 2.2 GHz
NET3.5 is C/C++ based language which is more machine level language than Fortran. That is why it runs faster.

The NET application runs under framework. The application itself is not in machine code and is dependent on framework library.
Fortran application is pure machine code and is independent on any library. So according this machine codes should run faster.
It seams that Microsoft is doing something in order NET applications be faster.

Igor

well, also as everybody knows - "Intel sucks" ;)

Actually Igor, there can be a lot of optimization in any program. This can be done either by the author, or the compiler can do the work automatically. I assume that the M$ .NET $hit just has some array optimized libraries, which the compiler selects to be used in your case.

It is better to use some really real example, and then to compare and decide which one does it faster. Also I am suspicious about some file read/write optimizations that M$ is doing - so try to avoid reading/writing small files in the test.

Also very strange on my computer - the time of the VB.NET EXE is the same as yours, but the Intel Fortran's EXE - differs. Why my times are less on a 64 bit OS - are you using Pentium IV? (don't compare anything on this CPU - it is a real crap - upgrade to "Core" at least).

You can also check Portland's (PGI) Fortran - there should be some reason to sell and update so frequent their compiler.
Yes my first computer was Pentium IV

Now little bit about the calculation. Time is measured as time span between starting and ending the mathematical calculations. In this time is not included reading and writing the array data to files, only mathematical calculations are measured. In the program is implemented the complete Gauss Elimination procedure. I can say that this is real numerical application for solving the system of "n" equations. My intent was to compare the same mathematical calculations with different compilers. I didn't want to do any optimization. In my other post I am speaking about speed, where is used optimized numerical library "MKL". There the calculations are much faster when we are using MKL. But, in MKL are implemented other numerical methods and tricks for getting the faster solution.
Here is the link for comparing NET vs. MKL. Look at post #5
Code:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************

About the speed: I made other test on my notebook: CPU AMD Turion x2 1.9GHz with RAM 2GB on Win Xp sp3 and WIN7. The results for Both OS are same:
* VB NET 4.4sec
* Intel Fortran 10.2sec
* Lahey Fortran 10.3sec

What I can say VB NET 3.5 again 4.4sec and Fortran faster.
I do not know what is this???

Now I compiled VB code with VS2010 using Framework 4:
The speed for VB Net 4.0 is 11.2sec on my Notebook.

Here is VB NET 4.0 executable file.
Code:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


What else I can say. You can't trust to any compiler.

Regards,
Igor

I am also interested to see what is causing this assuming your source code uses the same algorithm in each case. I dont have any specific experience with fortran, however as I understand it the matrix manipulation and linear algebra libraries in MATLAB use the BLAS and LAPACK libraries which are compiled fortran77. As I understand it, FORTRAN is used for high performance computing due to its low overheads. I cant accept that VB is faster then fortran for this type of computing.

One thing I did notice for your .f90 file is that you are doing a lot of reading from file. I am not sure how you accomplished the same thing in VB, but I suspect that the difference in time might be somewhat related to this. If you are also reading a text file line by line in VB then the problem must be elsewhere.

elbarto

elbarto_87,

All your questions are answered in post #6.
- Matlab is using MKL Optimized Numerical Library - there are implemented state-of the art numerical procedures. They do not use gauss elimination as in my case (fastest in the world).
- Matlab is compiled by C-compiler in machine code.
- The time is measured only for mathematical calculation which is same for both programs
- readings are just to fill the matrices from binary file.
- I am using Basic language but compiler is NET Framework same as C# and Net Fortran.

At the end I agree with you that Fotran (FORmula TRANslator) is specially made for numerical calculation, in last years Microsoft NET managed to be fast as fortran and in some cases faster.

Also I couldn't believe until I made this test.

igor1234, are you sure MATLAB is compiled by a C compiler to machine code? I was under the impression it was compiled by java to byte code. I am a structural engineer with no formal education in programming so I make no claim to being correct.

There must be a reason for the results you are getting. If VB was really "better" then fortran in terms of execution speed then why on earth would anyone use fortran. They are certainly some interesting results you have got there. I will be keeping an eye on this thread to see what you find.

One more thing I am curious about is, have you bench marked the performance of open source compilers like gfortran against intel for example. I think that would be interesting to see how these free compilers perform.

Good work - I hope to learn some fortran one day when the opportunity comes up. Although based on your results maybe I should be trying to learn VB.NET :lol:

regards elbarto
elbarto_87,

First thing FORTRAN exist more then 30 years. During this period it was and steel is language No.1 for calculation. Many companies are having old codes that they want also need to use them those days and they don't have a time and money to translate them.
This is the main reason why fortran has many users. Also I have started programing on fortran and then Basic and c#. Also I am a Structural engineer and also I am programming in order to solve my calculations. So If you want to write your own mathematical model in ABAQUS, ANSYS, ... then you have to do it in fortran. In many Universities the research is based on developing the new models and they are programed (using fortran) and implemented into ABAQUS, ANSYS,....

Maybe in the feature we will have chance to open a new discussion how to program in ABAQUS and ANSYS.

Structural Programs are written by Civil Engineers!

This All what I will say.

Pages: 1 2