problem using dynamic allocation of arrays in commons 
Author Message
 problem using dynamic allocation of arrays in commons

I have an old fortran code with large numbers of common blocks. The problem I
have had is that since all of the memory is allocated statically, the Windows
NT limit of 256 meg of static memory is exceeded (maximum image size). This
has limited the size of case I am able to run using the code. To get around
this problem, I have changed some of the arrays contained in the common blocks
to be pointers and then allocated them using ALLOCATE. This compiles and runs
fine, BUT, I get slightly different results. The arrays begin to vary out at
the last digit of precision (single precision). These slight variations become
magnified over the course of execution and end up having a non-negligible
affect on the solution.

Does anyone know what could be causing this? Does the compiler handle
float-point rounding differently when using f90 features? Any other ideas?

thanks much in advance,
Dave Swensen



Sat, 06 Nov 1999 03:00:00 GMT  
 problem using dynamic allocation of arrays in commons

|>
|>I have an old fortran code with large numbers of common blocks. The problem I
|>have had is that since all of the memory is allocated statically, the Windows
|>NT limit of 256 meg of static memory is exceeded (maximum image size). This
|>has limited the size of case I am able to run using the code. To get around
|>this problem, I have changed some of the arrays contained in the common blocks
|>to be pointers and then allocated them using ALLOCATE. This compiles and runs
|>fine, BUT, I get slightly different results. The arrays begin to vary out at
|>the last digit of precision (single precision). These slight variations become
|>magnified over the course of execution and end up having a non-negligible
|>affect on the solution.
|>
|>Does anyone know what could be causing this? Does the compiler handle
|>float-point rounding differently when using f90 features? Any other ideas?

I suspect you have a hidden coding error in the program which is causing
uninitialized data to be used.  Do you properly initialize the array?
--


Fortran Development               http://www.digital.com/info/slionel.html
Digital Equipment Corporation    
110 Spit Brook Road, ZKO2-3/N30    
Nashua, NH 03062-2698             "Free advice is worth every cent"

For information on DIGITAL Fortran, see http://www.digital.com/fortran



Sun, 07 Nov 1999 03:00:00 GMT  
 problem using dynamic allocation of arrays in commons

Quote:

> I have an old fortran code with large numbers of common blocks. The problem I
> have had is that since all of the memory is allocated statically, the Windows
> NT limit of 256 meg of static memory is exceeded (maximum image size). This
> has limited the size of case I am able to run using the code. To get around
> this problem, I have changed some of the arrays contained in the common blocks
> to be pointers and then allocated them using ALLOCATE. This compiles and runs
> fine, BUT, I get slightly different results. The arrays begin to vary out at
> the last digit of precision (single precision). These slight variations become
> magnified over the course of execution and end up having a non-negligible
> affect on the solution.

> Does anyone know what could be causing this? Does the compiler handle
> float-point rounding differently when using f90 features? Any other ideas?

> thanks much in advance,
> Dave Swensen


Check that all of the commons are identical.  That means identical in
number and type of variable.  A common 'trick' used in ancient code, and
often in error, would have something like:

        SUBROUTINE SUB1
        COMMON /FINK/  X(1000,3),ITEM(3,1000),Z(100,30)
        .
        ..
        SUBROUTINE SUB2
        COMMON /FINK/ MESS(3000),STUFF(1000,6)

and so on.  i.e. a different layout of the storage between subroutines.
This was sometimes done for 'efficiency', and sometimes done in error.



Mon, 08 Nov 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Pseudo-dynamic memory allocation using pool arrays

2. allocatable array *not* equivalent to dynamic allocation?

3. Sun f77 dynamic memory allocation, malloc, automatic arrays

4. dynamic fortran arrays allocation

5. How to use dynamic allocation with arrays ?

6. Dynamic array allocation in Salford F77

7. Memory read problem when calling dynamic arrays in DLL built using VC++ (LabView 5)

8. Memory allocation (was: Re: Herman wants dynamic allocation)

9. Stack based allocation vs. Dynamic allocation

10. Changing static allocation to dynamic allocation.

11. Dynamic File allocation using putenv (In Mainframe)

12. Using dynamic memory allocation and Fortran 77

 

 
Powered by phpBB® Forum Software