Autoparallelism

Autoparallelism

The question is:
I tried a cycle with a simple operation like summing i with i=1:num.
If num is a big integer like 210.000.000 or more I get a wrong result.
The compare is between a mixed program wher I have a C routine and a Fortran routine that calculate the sum a s following:
-----------
SUBROUTINE ciclo (A)
IMPLICIT NONE
DOUBLEPRECISION, INTENT (INOUT) :: A
DOUBLEPRECISION :: B
INTEGER :: I
A=0
DO I=1,2100000000
A=A+DBLE(I)
END DO
END SUBROUTINE ciclo
-----------
void cicloc(double* a){
int i;
*a=0;
for (i=1;i<=2100000000;i++) {
*a=*a+i;
}
}

Both routines ar in a project of visual c++ 6.0 with a main written in c.

I include the project with sum testing routine and comment (I am sorry these are in italian).

The results are:
cycle with 2.100.000.000
not parallel:
FORTRAN->2.20500000006711400e+018;
C->2.20500000006711400e+018;

parallel:
FORTRAN->2.20500000008267650e+018; (WRONG!!!)
C->2.20500000006711400e+018;
----------------------------
cycle with 210.000.000

parallel:
FORTRAN->2.20500001034657560e+016; (WRONG!!!)
C->2.20500000671088640e+016;
matlab->2.205000006710886e+016

----------------------------
cycle with 21.000.000

parallel:
FORTRAN->2.20500010500000000e+014;
C->2.20500010500000000e+014;

Also, the autoparallelism copilation is working only in release, not in debug (but I think this is ok).

Thank you,

Guido Lombardi

PS: for parallel fortran compilation I used the /Qparallel switch in Fortran Build Tool of VC++ 6 toolbar.

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.