Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!cs.utexas.edu!uunet!comp.vuw.ac.nz!cc-server4.massey.ac.nz!S.J.Lovatt From: S.J.Lovatt@massey.ac.nz (S.J. Lovatt) Newsgroups: comp.lang.fortran Subject: Re: Array dilemma. Keywords: Fortran, Arrays on PC Message-ID: <1991Jan23.235509.11205@massey.ac.nz> Date: 23 Jan 91 23:55:09 GMT References: Organization: Massey University, Palmerston North, New Zealand Lines: 77 X-Reader: NETNEWS/PC Version 2.2 quan@sol.surv.utas.oz (Stephen Quan) writes: > I am currently on a project for surveyors and recently attempted to port > the code from our Sun workstation to a PC. Unfortunately, the original > code needed double precision arrays of the order of 50000 elements or > higher. > > We believe that the current version of Microsoft Fortran falls down > because it could not handle such code so I pushed the department to go > for the Lahey Fortran F77L compiler. However, I now believe that the > F77L compiler will not solve this problem either. > > Cause of problem DOUBLE PRECISION BIG(3,50000) > > Question 1 Will F77L handle this problem? No - sorry. F77L/EM might, but your problem is more basic than just the compiler. > Question 2 Does F77L allocated space for arrays in the EXE? > - Will I get a larger EXE file? (somewhat 600K?). Yes, F77L allocates space for arrays in the EXE, but that is not your difficulty. Your problem is that the 64kB segment size limitation on an 8088 processor (as found in a PC) restricts the size of just about any static data structure in just about any PC programming language to 64kB or less. > Question 3 Is there a compiler that would solve this problem? > > There is little chance that I can push the department to get an F77L/EM, > but I would be interested if that or any other compiler would solve my > problem. If all fails, I probably replaced the array with random > accessing a large file instead. > -- > Stephen Quan, > University of Tasmania. All the F77 compilers that I've seen advertised which handle this problem are at least as costly as F77L/EM and all require a DOS Extender, and special linker (eg those produced by Phar Lap and others) which are an additional cost. All require at least an AT-compatible and extra memory, as you can get around the segment size limit on a '286 or '386 by running in 'protected mode'. Thus, solving your problem will probably cost you either: (a) lots of money or: (b) lots of time I have found this sort of problem to be a major difficulty porting big Fortran programs to a PC. It is possible, of course, that the program uses only a fraction of the 3*50000 elements. If you can trim the space required down a bit, then you could split the array into three and then the biggest you could have would be about (DOUBLE being 8 bytes): DOUBLE PRECISION BIG1(8000),BIG2(8000),BIG3(8000) Alternatively, given that calculations within the math coprocessor are always done with 10 byte REALs, if you do not actually need to store results as DOUBLE PRECISION, but only calculate at high precision, then you could have arrays such as: REAL BIG1(16000),BIG2(16000),BIG3(16000) ... since REALs are 4 bytes, and rely upon the compiler to (hopefully) do calculations on the 'x87 stack and not use intermediate variables. I wish you the best of luck. - Simon -- Simon Lovatt | S.J.Lovatt@massey.ac.nz | Dept of Biotechnology | | Massey University, N.Z. | |