From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103885,20ac8f08b884ba5,start X-Google-Attributes: gid103885,public X-Google-Thread: 1094ba,10f7c56bf397ed71 X-Google-Attributes: gid1094ba,public X-Google-Thread: 111c93,20ac8f08b884ba5,start X-Google-Attributes: gid111c93,public From: "G. Hugh SONG" Subject: Re: Forcing 32-bit integers and math Date: 1998/10/14 Message-ID: <701flh$njg$1@news.kjist.ac.kr>#1/1 X-Deja-AN: 400891214 Content-Transfer-Encoding: 7bit References: <6vt65k$5hp$1@walter-fddi.cray.com> Content-Type: text/plain; charset=us-ascii Organization: KJIST, KwangJu, KOREA Mime-Version: 1.0 Newsgroups: comp.lang.fortran,comp.graphics.visualization,comp.os.linux.alpha Jeff Drummond wrote: > In article , epowell@visi.com (Edward J. Powell) writes: > |> > |> Okay, I'm attempting to learn Fortran on a Cray (gloat gloat), and I've > |> run into a bit of a problem with what I'm working on. > |> > |> I need 32-bit integers. Cray really wants to do 64-bit stuff. > > Yes, we really do. You can get 32-bit integers on CRAY MPP (T3E) systems, > but not on the CRAY PVP (C90/T90) systems. > > |> I define variables as integer*4. This should make them 32-bit. > > No. We generally regard integer*n as a request rather than a commandment. > On CRAY PVP systems it may allow us to use a reduced precision model, but > the container size will still be 64-bits. > It seems that the exact same thing happens with Alpha/Linux g77 fortran. I was trying to enforce compatibility between Intel/Linux and Alpha/Linux g77. Here is what I did: I created a simple fortran program: program OUTtest implicit none integer UOUt, i, id(5) parameter(Uout = 11) integer*2 i2(5) integer*4 i4(5) real rd(5) real*8 r8(5) do i = 1, 5 i2(i) = i id(i) = i i4(i) = i r8(i) = i rd(i) =i end do open(Uout, file = 'i2.dt', form='unformatted') write(Uout) i2 close(Uout) open(Uout, file = 'i4.dt', form='unformatted') write(Uout) i4 close(Uout) open(Uout, file = 'id.dt', form='unformatted') write(Uout) id close(Uout) open(Uout, file = 'rd.dt', form='unformatted') write(Uout) rd close(Uout) open(Uout, file = 'r8.dt', form='unformatted') write(Uout) r8 close(Uout) stop end Then, I created two executables, test.ix for intel and test.ax for alpha. The file sizes of the output files after running test.ix are -rw------- 1 ghsong faculty 28 Oct 14 11:47 i4.dt -rw------- 1 ghsong faculty 28 Oct 14 11:47 id.dt -rw------- 1 ghsong faculty 48 Oct 14 11:47 r8.dt -rw------- 1 ghsong faculty 28 Oct 14 12:21 rd.dt -rw------- 1 ghsong faculty 18 Oct 14 11:47 i2.dt After running test.ax, they are -rw------- 1 ghsong faculty 36 Oct 14 11:35 i4.dt -rw------- 1 ghsong faculty 36 Oct 14 11:35 id.dt -rw------- 1 ghsong faculty 56 Oct 14 11:35 r8.dt -rw------- 1 ghsong faculty 36 Oct 14 12:18 rd.dt -rw------- 1 ghsong faculty 26 Oct 14 11:35 i2.dt This result implies that the two output "record" files are significantly different. Even if they both use IEEE-format, there is extra bits of information appended on the fortran output files must also be different. Reading the files from test.ax into IDL running on Intel/Linux fails with the message such as "Corrupted input data". It seems that the only solution to this incompatibility problem is to let C-code handle all the binary outputs or to use ascii outputs only, which is unacceptable with huge data files. Regards, > > Hope this helps, > > -Jeff jjd@cray.com -- G. Hugh Song PS: Please remove "Spamspoiler" when replying