Tuesday, 15 May 2012

fortran - Why is bounds checking changing the behavior of my program? -



fortran - Why is bounds checking changing the behavior of my program? -

i have thermal hydraulics code written in fortran work on. debug version, utilize -check bounds alternative in ifort 11.1 during compile time. have caught array bounds errors in past in way. recently, though, seeing solution blowing given case. peculiar thing was converging nicely release version of code. sure enough, removing -check bounds flag debug makefile cleared problem.

the unusual thing debug version working fine many other test cases used before , wasn't throwing errors on going outside of array bounds in code. behavior seems unusual me , have no thought if there kind of bug in code or what. have ideas causing sort of behavior?

as requested, flags utilize release , debug are:

release: -c -r8 -traceback -extend-source -override-limits -zero -unroll -o3

debug: -c -r8 -traceback -extend-source -override-limits -zero -g -o0

of course, original question indicates, toggle -check bounds flag on , off debug case.

i suspect numerical algorithm here more fortran code. have ensured of convergence , stability criteria have been met?

what sounds round-off error causing solution fail converge. if on edges of safe convergence, compiler optimizations can tip things 1 way or another.

i utilize gfortran more ifort, don't know specifics of -unroll option, unrolling loops can alter rounding though calculations seem should remain same. also, debug alter exact order of memory , register access. if number in processor in internal representation, written memory , read again, value can change. can alleviated extent careful selection of kind. it's nature, processor specific rather portable.

in theory, total compliance ieee 754 create floating point operations reproducible, not case. if debug causing these problems opposed other bug in code, other mysterious things related inner workings of processor cause blow up.

i add together write statements @ various key points in code output info matrices (or whatever info structures using). sure utilize binary output. open form='unformatted' , access='direct'.

fortran intel-fortran

No comments:

Post a Comment