Clicky

Fortran Wiki
Object Oriented Programming and Performance

Historically Fortran has always been the language for high performance computing. Today, Fortran has evolved into modern language and many people claim that it can be used for general purpose programming. I do agree with this point, however, I believe Fortran should focus mainly the language for scientific computing. There are many reasons for this such as versatile array manipulation, internal compiler optimizations and ease of implementation for the scientific community.

To my surprise, nowadays many scientific computing projects are started to use C++ or even convert their old FORTRAN codes to C++ for the reason of bringing OOP to their software. Actually, I can’t think of any other reason. From my understanding, there are two problems with this trend: 1) the high maintenance requirements of a C++ project 2)performance decrease because of using some OOP styles.

For my application types and many other people, using Fortran is to gain a better performance along with easier implementation. Not that other programming languages cannot be as fast as fast Fortran, but it is the style of Fortran that encourages more efficient programs. Obviously, the modern Fortran has to clearly address these problems in order to guaranty the attraction of people to code in modern OO style. Nevertheless, so far I did not come to a project which fully utilizes the OO capabilities of F03 or any other study that addresses the performance penalties due to using these capabilities.

For example, once I was in a parallel programming workshop and I was told that using array of derived data types(and not a derived type of arrays) will significantly decrease the performance. Therefore, I’ll be really glad to hear comments and ideas of how compiler deals with a OO Fortran program, where the performance drops happen and so on.