Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29306 Discussions

compiling code for 64-bit: random # generater (rand) real*4 or real*8

Dan_Fishman
Beginner
625 Views

I am trying to run a program on Windows XP x64. The code already runs on ia32 (on a PC) and ia64 (on a SGI Altix Linux machine).

I am using Intel VF 11.1.060 64 bit compiler with the same compile options as I have used for the ia32 compilation.

The program compilies but doesn't run properly.

One issue I noticed is that the random # generator "rand()" only works if I define it as a single precision variable. (It ran okay when I defined it real*8 for the ia32 compiler).

Does anyone know the reason for this?

Are there specific compilation options that should be set to help the code adjust to the 64-bit compilation?

0 Kudos
1 Reply
TimP
Honored Contributor III
625 Views
You should have
USE ifport
to maintain correct interface for ifport subroutines (which aren't standard Fortran).
Fortran standard intrinsic random_number should adjust automatically to your declared data type.
Only if you use a function in 32-bit compilation with /arch:IA32 (x87 code) can you gloss over the difference between single and double precision function return values.
0 Kudos
Reply