Paul,
To check my program, I am compiling most of my program with /check, but trying to use /opt for a few routines that are compute intensive. With these compile options mix, the following code example does not appear to work correctly with /opt. the module was compiled with /check
count_best = 0
count_last = 0
sum_ri = 0
!
do id = 1,num_node
if (mod (id,500000) == 0) write (*,2001) 'Checking sector allocation',id
!
x = (node_data(id)%ix - 1) * grid_dx + xmin_g
y = (node_data(id)%iy - 1) * grid_dx + ymin_g
!
! find nearest segment centre
ri = 1.e30
ik = 0
do k = 1,channel_no+1
rk = (x - sector_data(k)%x1)**2 + (y - sector_data(k)%y1)**2
if ( rk >= ri ) cycle
ri = rk
ik = k
end do
!
count_best(ik) = count_best(ik) + 1
count_last(k) = count_last(k) + 1
sum_ri = sum_ri + sqrt(ri)
I have included count_best, count_last and sum_ri stats to confirm the behaviour. with /opt, ik is always 1, implying rk is not being updated (correctly calculated) for each itteration of k. average of ri is 30,498 (metres) I have checked that the itteration goes for 730 cycles (channel_no+1)
with /debug used for the module and routine, ik is being correctly calculated in the range 1:730 and ri averages 160 metres
This is a large program with a 2.5gb data set so not easy to send. num_node = 7,548,638
Any suggestions, as I would like to be able to use /opt for some key loops.
John