[petsc-users] long int

Jed Brown jed at 59A2.org
Sun Jun 12 13:45:14 CDT 2011


On Sun, Jun 12, 2011 at 20:38, Matthew Knepley <knepley at gmail.com> wrote:

> The words here are too imprecise:
>
>   short int: A 2 byte integer
>   long  int: A 4 byte integer
>

No, "long int" must be at least 4 bytes, but it may be larger. "long int" is
8 bytes on 64-bit Linux and OS X. It is 4 bytes on LLP64 such as 64-bit
Windows.


>   int:          An integer which can be short or long, depending on the
> compiler, but most often long int today
>

Int must be at least 2 bytes. In practice, it is either 4 or 8 bytes. Int
cannot be larger than long. It is 4 bytes on the most commonly used
platforms.


>   long long int: An 8 byte integer
>

This is a minimum, but I don't know any architectures that make it larger.


>
> The --with-64-bit-indices flag gives long long ints. If you have > 2B
> unknowns, use this, otherwise don't. Yes, it slows things down.
>

In particular, it doubles the amount of memory required for column indices
in the matrix and for index sets. This is not a huge difference, but it is
noticeable.


> On every 64-bit architecture I know, 'int' is still 'long int', not 'long
> long int'. The only thing that is 64-bit is the pointers.
>

Nonsense, sizeof(long) is 8 on YOUR COMPUTER, Matt.

sizeof(int) is 4 on your computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110612/05cedeac/attachment.htm>


More information about the petsc-users mailing list