|
[Sponsors] |
September 5, 2011, 18:54 |
|
#41 | ||
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
Quote:
We found that Fortran is indeed more optimized in that discipline, i.e. faster. I'm no expert on this, but one who is told me that comes from the way Fortran arranges matrices in memory (array style), while C does it in a single 1D vector. Quote:
|
|||
September 5, 2011, 21:57 |
|
#42 |
Senior Member
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19 |
I think optimization should be defined.
Personally, my bottleneck is not CPU, but the memory bus. Whether it is C, C++, or FORTRAN is mostly unimportant (assuming the programmer is creating somewhat efficient code) for parallel operation. What is important is developing an algorithm which feeds the CPU as fast as possible. What this means is that the programmer must minimize the k loops (i being the fastest loop) Of course, one can slow down C++ by excessive calls to the virtual table, but I assume that is being kept at the top level and inline functions are used where appropriate, etc. |
|
September 5, 2011, 22:00 |
|
#43 |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,290
Rep Power: 34 |
This is how I think on fortran vs C++.
If you do exact same thing from both languages then Fortran indeed be little bit or significantly faster than C++. Run simple tests like Matrix vector multiplications etc and you will notice that Fortran is faster than C++. Most of the tests just do this and thus fortran seems to language of choice. But this is not so simple. Tests are good and have their place but in real life you will NOT be running these tests to get your results. For example take CFD, a navier stokes solver is much more than just a matrix vector multiplier. It is a complicated algorithm when implemented. Now the efficiency of simulation all depends on how this algorithm is implemented. If I can implement it using c or c++ such that it is faster than Fortran than it does not matter whether in tests fortran was faster. This is not going to help if all you are going to do is write poorer algorithm compared to what a guy with C++ wrote. You might save say 5 to 10% of time with faster language but if slower language allowed you better algorithm you might be faster by many times. So chose the algorithm and then chose language that suits it. |
|
September 5, 2011, 22:01 |
|
#44 |
Senior Member
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19 |
BTW, sometimes an algorithm is faster if a value (for example speed of sound) is repeatedly calculated when required, rather than saved in memory and then retrieved when needed.
|
|
September 5, 2011, 23:41 |
|
#45 |
Senior Member
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21 |
Well this is the MAIN Forum!
Okay, you guys are not just staying on the OF forums. I wonder how many hours you are walking around on the cfdonline everyday.
__________________
~ Daniel WEI ------------- Boeing Research & Technology - China Beijing, China |
|
September 6, 2011, 01:52 |
|
#46 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,290
Rep Power: 34 |
Quote:
4 years ago i used on on cfd-online almost all the time. Now a days sometimes i do not visit for days. I spend most of my time on photography forums. It is lot of fun trying to pick faults with cameras that we will never buy. They are more active and lot of arguing going on. CFD-online is no where near to them on fun factor. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fortran Compiler-CFX12.1 | Araz | CFX | 13 | March 27, 2017 06:37 |
Array Comparison in Fortran 90/95 | M Malik | Main CFD Forum | 4 | September 11, 2008 15:14 |
visual fortran | Monica | Main CFD Forum | 1 | August 28, 2004 21:45 |
Fortran77 or Fortran 90 | Swapnil | CFX | 2 | November 26, 2002 16:16 |
Why Favoring Fortran over C/C++? | Zi-Wei Chiou | Main CFD Forum | 35 | September 26, 2001 10:34 |