Then we might as well use size_t. :-) If I remember correctly, we discussed at some point (5 years back or so) whether to use size_t or dolfin:uint = unsigned int. A related discussion was which type to use for UFC. We landed on unsigned int. So a change will be needed also in UFC.
Is PetscInt = size_t? PS: I'm Cc:ing the list for further discussion. Quite a lot of traffic has moved off the list to questions/bug reports which means it will not be visible to everyone. -- Anders On Thu, May 24, 2012 at 06:37:25PM -0000, Jason Bacon wrote: > Any reason not to call it dolfin::size_t? The name size_t is meant to > indicate the size of a pointer, which is not the same size as a standard > uint on 64-bit systems. > > Cheers, > > -J > > On 05/24/12 13:12, Anders Logg wrote: > > On Thu, May 24, 2012 at 06:02:58PM -0000, Johan Hake wrote: > >> On 05/24/2012 07:28 PM, Jason Bacon wrote: > >>> Well, I think the code will have to be carefully examined and altered to > >>> avoid truncation errors when mixing PetscInt and smaller types. I > >>> attached the patches necessary to make it compile, but there may still > >>> be truncation issues where int arithmetic is used on subscripts elsewhere. > >>> > >>> I think this is an important issue, given that "int" subscripts limit > >>> arrays to 2^31 elements, and Dolfin will be used on many systems with > >>> far more address space than that. > >>> > >>> I personally make a point of using size_t for all array subscripts. > >>> It's standard, unsigned, and matches the address size on the underlying > >>> architecture. That would eliminate the issue on 64-bit systems, which > >>> is the only place it will matter anyway. > >> Sounds like a good solution, but it will take some thorough search and > >> replace... > > We can make dolfin::uint a typedef for size_t. > > > > And I expect some SWIG fixes will be necessary... > > > > > > > >> Johan > >> > >>> Cheers, > >>> > >>> -J > >>> > >>> On 05/24/12 11:53, Anders Logg wrote: > >>>> On Wed, May 23, 2012 at 02:02:57PM -0000, Jason Bacon wrote: > >>>>> Public bug reported: > >>>>> > >>>>> > >>>>> Have you guys tested with a 64-bit PETSc yet? ( PETSc built with > >>>>> --with-64-bit-indices and/or --with-64-bit-pointers). > >>>>> > >>>>> The Dolfin code interfacing with PETSc uses int in a lot of places where > >>>>> it should use PetscInt. I can send a minimal set of patches required to > >>>>> make it compile, but there are still runtime problems, so the code is > >>>>> going to need more thorough examination and testing. > >>>> We also use a lot of reinterpret_cast<> from 'unsigned int'. How will > >>>> that work with 64 bit PETSc? > >>>> > >>>> > >>> > > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp