Pregunta

Well, I've been asking myself this question for quite a long time by now.

I started using the GNU Fortran compiler (gfortran) and I was quite happy. But then I started hearing that the Intel Fortran compiler (ifort) was better because it was optimized for Intel processors (and therefore optimized for most computers today as a consequence that Intel has the greater share of the market). After that I started using ifort, but the truth is that I'm not completely happy with it because it does not detect some errors that gfortran does (i.e. Question: "Reference passing is changing the values of a matrix").

It is also true that there are other Fortran compilers but, actually, I never use other than gfortran and ifort.

So I would like to ask you: What are the advantages and disadvantages of each one? Which is the best one, if optimization is not important?

¿Fue útil?

Solución

In my opinion, it is best to stick to the Standard you're comfortable with, and write code that is conforming to this Standard. Then, the choice of compilers is dictated by the support for said Standard.

Here is an extensive list of the compiler support for the 2003 and 2008 Standards.

I myself used g95 a lot because I liked the debug messages. Nowadays, I commonly use Fortran 2008 features, and use gfortran (because it's open source), and ifort (because it's free for non-commercial use). g95's support for Fortran 2003 and 2008 is quite limited.

I usually compile code with both compilers and all warnings turned on, and quite often I'm surprised what errors are missed by one of the compilers. In terms of performance of the compiled code, I never noticed a difference (excluding bundled math libraries).

Most commercially available compilers have non-standard extensions, like OpenACC (e.g. Cray, PGI) or special features (e.g. PGI CUDA Fortran) and bundled libraries (e.g. Intel MKL). These might also influence your choice. For some hardware you might need / might profit from special compilers (like the Cray compiler).

EDIT: Here are some benchmark results for different compilers and machines.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top