Turing:   Size of different Fortran base types

The variables declared by using the default types INTEGER, REAL, or COMPLEX, are reserved in memory based on the words of 4 bytes.  The optional parameter KIND=n, indicated after the type, allows us to influence the size in the most explicit and dependable way.

In addition, there are compilation options which allow overall modification of variable length:

  • -qintsize=2/4/8: Sets the reservation in memory on words of 2/4/8 bytes (4 by default) for the integer and logical values declared with the INTEGER or LOGICAL types (without specifying the parameter KIND=n)
  • -qrealsize=8: Sets the default size in bytes of REAL, DOUBLE PRECISION, COMPLEX and DOUBLE COMPLEX values (declared without specifying the parameter KIND=n)
  • -qautodbl=dbl4/dbl8/dbl/… These can also be used to promote REALS more selectively.

Example :

$ mpixlf90_r -qintsize=8 prog.f90 (promotion of integers on 8 bytes, by default).
$ mpixlf90_r -qautodbl=dbl4 prog.f90 (promotion of REALS on 8 bytes and COMPLEX on the 4 byte size).