[petsc-users] 64 bit integers

Barry Smith bsmith at mcs.anl.gov
Fri Aug 17 11:33:51 CDT 2012


On Aug 17, 2012, at 11:12 AM, Michele Rosso <mrosso at uci.edu> wrote:

> The problem is that I use petsc only in a small part of my code.
> Given that I have integers everywhere and I use other libraries as well,
> I cannot/ don't want to  re-define all the integers I have as PetscInt.
> 
> Michele

   So do you want all the rest of the integers in your code to be 64 bit integers or can they still be 32 bit integers?  If so you do things like

        integer    myoldint
        PetscInt   mypetscversionofoldint

       mypetscversionofoldint = myoldit
       call PETSc function with mypetscversionofallint variables.

       Note, course, that myoldint limits the size integers you can pass to PETSc

   Or do you want to automagically make all integer  in your FORTRAN code suddenly be 64 bit int??   If so

        you can use the crazy FORTRAN command line flags that cause the Fortran compiler to make everything declared integer to be 64 bit. Now all your integers are 64 bit so you can pass them directly to PETSc functions.  We don't generally recommend this approach because it is fraught with danger and the Fortran compiler sometimes does other stuff like promoting the length of other things at the same time. If you go this route you need to manually stick that special fortran flag into your makefiles in the FFLAGS variable.   Good luck.


    Barry


     

            
      


> 
> 
> On 08/17/2012 09:08 AM, Matthew Knepley wrote:
>> On Fri, Aug 17, 2012 at 11:04 AM, Michele Rosso <mrosso at uci.edu> wrote:
>> Thank you.
>> How can I convert?
>> 
>> Don't use integer, use PetscInt. See any PETSc example.
>> 
>>   Matt
>>  
>> Michele
>> 
>> On 08/17/2012 08:55 AM, Matthew Knepley wrote:
>>> On Fri, Aug 17, 2012 at 10:16 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>>> On Fri, Aug 17, 2012 at 10:12 AM, Michele Rosso <mrosso at uci.edu> wrote:
>>> Does this mean that Fortran compiler invoked by the PETSc Makefile will
>>> compile to code with the 64 bit integer option so that also Fortran Integer will be 64 bit?
>>> 
>>> NO, that would be bad because it breaks library interfaces.
>>> 
>>> You have to use the right types internally. If you use PetscInt everywhere, then you'll be fine. If you mix types, you have to find out where to convert.
>>> 
>>> I meant that if you use PetscInt in Fortran it was also be a 64-bit integer.
>>> 
>>>    Matt
>>> 
>>> -- 
>>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>>> -- Norbert Wiener
>> 
>> 
>> 
>> 
>> -- 
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>> -- Norbert Wiener
> 



More information about the petsc-users mailing list