Print

Print


Digging a bit deeper into a the g95 source to see exactly what goes  
on in at least 1 compiler...

struct _bignum {
   int refs;

   struct bignum *next;
   int num_comps, max_comps;
   int sign, serial, typeless;

   int real_sign, real_exp;
   g95_ff *ff;
   comp *comps;
} _bignum;

typedef struct _bignum * bignum;

.
.
.

typedef struct g95_expr {
   expr_t type;
   int rank, serial;
   bignum *shape;

   <rest removed>

.
.
.

typedef struct {
   int rank;          /* A rank of zero means that a variable is a  
scalar */
   array_type type;

   struct g95_expr *lower[G95_MAX_DIMENSIONS], *upper 
[G95_MAX_DIMENSIONS];
} g95_array_spec;


Which seems to indicate to me that the maximum array size is  
2*maxint*ndims*(data type size) (backed up by looking at  
g95_array_spec_size in array.c) which would be 32GB for a 1D array of  
double precision numbers...  but then, I see


typedef struct g95_array_ref {
   ar_type type;
   int dimen;                  /* # of components in the reference */

   struct g95_expr *start[G95_MAX_DIMENSIONS], *end[G95_MAX_DIMENSIONS],
                   *stride[G95_MAX_DIMENSIONS];

   enum { DIMEN_ELEMENT=1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_UNKNOWN }
     dimen_type[G95_MAX_DIMENSIONS];
   g95_locus where[G95_MAX_DIMENSIONS];     /* All expressions can be  
NULL */

} g95_array_ref;

which (looking through array.c) seems to indicate that the maximum  
array specification you can reference is 2*max_int*(data type size)  
(32GB)...

Now, to test it on a few different compilers :)

Here is my simple code...

program test
   integer(8) :: i
   integer(4) :: j
   real(8), dimension(:), allocatable :: a

   i = huge(j)
   write(*,*) 'i= ', i
   allocate(a(i))
   write(*,*) 'size a= ', size(a)
   deallocate(a)

   i = huge(j)*2_8
   write(*,*) 'i= ', i
   allocate(a(i))
   write(*,*) 'size a= ', size(a)
   deallocate(a)

   i = huge(j)*8_8
   write(*,*) 'i= ', i
   allocate(a(i))
   write(*,*) 'size a= ', size(a)
   deallocate(a)
end program test


Now, intel on Itanium:

cognac:~/tmp > ifort ./test.f90
cognac:~/tmp > ./a.out
i=             2147483647
size a=   2147483647
i=             4294967294
size a=           -2
i=            17179869176
size a=           -8



g95-ia64-32-linux on Itanium:

cognac:~/tmp > g95 ./test.f90
cognac:~/tmp > ./a.out
i=  2147483647
size a=  2147483647
i=  4294967294
size a=  0
i=  17179869176
size a=  0



g95-ia64-64-linux on Itanium:

cognac:~/tmp > g95 ./test.f90
cognac:~/tmp > ./a.out
i=  2147483647
size a=  2147483647
i=  4294967294
size a=  4294967294
i=  17179869176
size a=  17179869176


So, mixed results :)  Surprisingly it looks like the intel compilers  
on Itanium have a 2gb limit? I wonder what Pathscale returns (nudge- 
nudge)?

All these runs were done on an SGI Altix 3700Bx2 with 320GB of memory.

Stu.


>
> I have no idea what Stuart was talking about. Unformatted disk files
> yes, but not in-memory objects...
>
> -- greg


--
Dr Stuart Midgley
[log in to unmask]