Why is Fortran running much slower on Linux?

In summary, the conversation discusses the performance differences between running a Fortran95 program on a Windows laptop and a RedHat computer. The MHz figure of a cpu is not a reliable indicator of speed, as it depends on the number of cores and the efficiency of the compiler. The i7 processor at 2GHz is expected to have a higher performance than the P4 at 2.8GHz, and different compilers can also affect the speed of the program.
  • #1
Rotarman
3
0
I have a Fortran95 program that I run on my Windows laptop (i7 2.0Ghz); its in serial, so its running on one thread, which seems consistent with task manager results (12.5% processor usage), so I figure it should be using ~1 ghz. I am compiling using the standard one that came with my F95 download and it takes about 22 minutes. Now I'm trying to run it on a RedHat computer; I just use the terminal to compile it (>gfortran FileName) then run it in the terminal and it takes more than 50 minutes. I poked around and found out its 2.8 Ghz pentium 4 in there. The system monitor says 100% usage for one core (which I assume is the hyperthreading), so by my rudimentary math that's 1.4ghz for the program. I understand this is a gross simplification, but I just don't understand how there can be 100-150% discrepancy. Linux and programming newb btw, so feel free to suggest some obvious thing I'm missing.
 
Technology news on Phys.org
  • #2
There's lot of variables there, different computers and different compilers, but your results seem to be fairly close to what I'd expect.

The MHz figure of a cpu is no longer a very good indicator of its speed in terms of instructions per second. The data here (see link) suggests a quad core i7 at 2GHz would be about 60,000 MIPS and the P4 at 2.8GHz about 8,000 MIPS. Even if using only one of the four cores the i7 would have about double the MIPS.

The actual number of MIPs that a cpu can achieve depends upon the exact mix of instructions, and different compilers have different capability to optimize the exact mix (and ordering) of instructions for best result on a particular target processor. So you could potentially get an even larger speed difference, depending on the code.

http://en.wikipedia.org/wiki/Instructions_per_second
 
Last edited:

FAQ: Why is Fortran running much slower on Linux?

Why is Fortran running slower on Linux compared to other operating systems?

There could be several reasons for this. One possibility is that the Fortran code was not optimized for the Linux platform. Another factor could be the compiler being used, as some compilers may perform better on certain operating systems. Additionally, differences in the hardware and system configurations may also affect the performance of Fortran on Linux.

Is there a specific version of Linux that is better for running Fortran?

No, there is no specific version of Linux that is known to have better performance for Fortran. However, some Linux distributions may have optimized versions of compilers and libraries for scientific computing, which could potentially improve the performance of Fortran programs.

Can I improve the performance of Fortran on Linux?

Yes, there are several steps you can take to improve the performance of Fortran on Linux. These include optimizing your code for the Linux platform, using a high-performance compiler, and ensuring that your system has adequate resources such as memory and processing power.

Are there any known compatibility issues between Fortran and Linux?

Fortran is a widely used programming language and is compatible with most operating systems, including Linux. However, certain features of Fortran may not be supported by all compilers or may require specific libraries to be installed on Linux systems.

Are there any alternatives to Fortran for scientific computing on Linux?

Yes, there are several alternatives to Fortran for scientific computing on Linux, such as C++, Python, and Julia. These languages have their own advantages and may perform better in certain applications. It is recommended to research and compare different languages to determine which would be the best fit for your specific needs.

Similar threads

Replies
1
Views
4K
Replies
8
Views
5K
Replies
4
Views
4K
Replies
1
Views
3K
Replies
2
Views
2K
Replies
4
Views
4K
Back
Top