Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29279 Discussions

Linux and Windows version of Fortran compiler 9 gives different results

alexismor
Beginner
1,294 Views
Hi everybody,

I'm experiencing some very weird stuff... I have this code that, when compiled using the windows version of the compiler gives different results that when I compile using the linux version. The linux version gives incorrect results!

I would post my code here, but it's a little complicated...

Maybe I made a mistake in installing the linux trial version? Do you have to uninstall version 8.1 before you install 9.0?
0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,294 Views
No, you don't have to uninstall 8.1 first. 8.1 and 9.0 can coexist on a system. Are you sure you're using the same compiler version on each system?

If you need further help, please submit the test program and a description of the problem to Intel Premier Support.
0 Kudos
alexismor
Beginner
1,294 Views
I'm pretty sure that I'm using the same compiler version for both. Is there an option to ask the compiler to identify itself? For example, ifort -version ? thanks
0 Kudos
Intel_C_Intel
Employee
1,294 Views
ifort -logo
ifort -V
ifort -v
ifort --version
all give different flavors of version information
0 Kudos
Lorri_M_Intel
Employee
1,294 Views
Beyond what Aart gave you, there's an internal edit number in the Fortran compiler.
To get this, use
ifort -what filename.f
You do need to put some filename there, or it simply won't work. You'll see output something like;
Intel Visual Fortran 9.0-5386
Now you can compare the edit number to be sure you're using exactly the same frontend.
The logo information, received either by default on Windows, or with -V on Linux, will include install-package information. You can compare those things too.
0 Kudos
alexismor
Beginner
1,294 Views
Thanks for the replies. I checked the compiler versions and they are indeed the same. I also tried using the 8.1 compiler on Linux and I still get the erronous result that I don't with the windows compiler (except with the linux 8.1 compiler, the program gets stuck in some sort of infinite loop at one point). After some investigation, it looks like the linux version wasn't initializing variables in the same way as the windows one. For example, I have a derived type called particles:

type particles
integer :: m,n
end type particles
type(particles), allocatable, dimension(:) :: b
allocate(b(4)) ! An array of particles
print*,b

In the windows version, when I print the particle array, I just get ***'s (so nothing's been initialized yet). In the Linux version, I get all 0's. I then tried using the -nozero flag on the compiler, but I can't get it to work! In the compiler help, it says that the syntax is: -[no-]zero. I've tried the following:

ifort -no-zero test.f90
ifort -nozero test.f90
ifort -no -zero test.f90
ifort test.f90 -no-zero
ifort test.f90 -nozero
ifort test.f90 -no zero

and a few others, but the option doesn't seem to work (as is the compiler doesn't understand my command). In anycase, after some deeper digging, I suspect that my code may have been a little buggy, but for some reason it didn't bother the windows compiler. Maybe it had to do with the different variable initialization with both compilers?

Anyway, I've reworked the code a little and everything works perfectly now. Still, I can't really explain what was wrong before...

Message Edited by alexismor on 07-13-2005 08:36 AM

0 Kudos
Steven_L_Intel1
Employee
1,294 Views
If your code does not initialize the variables, then you get unpredictable results. The compiler does not initialize them for you, except if you say -zero and then it's only some variables and you should not rely on this.

Make sure your code properly initializes all variables before use and then try again.
0 Kudos
Reply