[petsc-users] Inaccuracy while calculating numbers on different machines 32-bit and 64-bit.

Markus Iivonen Markus.Iivonen at metropolia.fi
Wed Mar 21 11:05:03 CDT 2012


I've read that inaccuracy is quite common problem but on the other hand my values aren't that small that there should be any inaccuracy at least I think so...

So the problem is that when I run the code on the other machine it causes inaccuracy which happens as early as 0.00000 digits.

My program calculates two different values at the same time. First value is really accurate and it is calculated by boost bisection the second value is produced by two different functions which makes matrix and vector calculations using PETSc. Here are some example values:

Where to compare:

0.01985308798     -0.8497140415
1                          0.3683436681
0.509926544        -0.2559051838
0.754963272         0.06256485518

Here is what my one computer produces:

0.0198531   -0.849714
1                 0.368344
0.509927    -0.255905
0.754963     0.0625649

And here is what happens when I'll run the program on other machine.

0.0198531      -0.849714
1                    0.368321  
0.509927       -0.255922 
0.754963        0.062544

My one machine is running ubuntu 32-bit and other is running 64-bit. The actual values where I'm comparing to are calculated on the 64-bit system but different program.

If I run the example value program which generated my base values on my 32-bit desktop it will give the same values as my C++ program and the example program on 64-bit system. When I run the C++ program on the 64-bit system the inaccuracy occurs. The values that I'm using are always doubles.

Somehow the inaccuracy seems to happen mostly in the values that are produced by PETSc matrix and vector operations.

Compilers, libraries and library confs are exactly same on the both machines. I did also try to set locales but it didn't have any affect, I just searched something and found this about PetscInt:

PETSc type that represents integer - used primarily to represent size of arrays and indexing into arrays. Its size can be configured with the option --with-64-bit-indices - to be either 32bit or 64bit [default 32 bit ints]

So should I maybe conf 64-bit machine with --with-64-bit-indices or should I try to find the problem somewhere else ?

Thank You.


More information about the petsc-users mailing list