Recent posts
https://software.intel.com/en-us/recent/954355
enOpenMP does not like fmax/fabs
https://software.intel.com/en-us/forums/topic/473111
<p>We have a code that is exhibiting greatly different runtimes between a Fortran and C version. The problem has been isolated to one simple loop:</p>
<p>#pragma omp parallel for reduction(max:dt)<br />
for(i = 1; i <= NR; i++){<br />
for(j = 1; j <= NC; j++){<br />
dt = fmax( fabs(t[i][j]-t_old[i][j]), dt);<br />
t_old[i][j] = t[i][j];<br />
}<br />
}</p>
<p>Which runs about 12 times slower than the equivalent Fortran loop:</p>
<p>!$omp parallel do reduction(max:dt)<br />
Do j=1,NC<br />
Do i=1,NR<br />
dt = max( abs(t(i,j) - told(i,j)), dt )<br />
Told(i,j) = T(i,j)<br />
Enddo<br />
Enddo<br />
!$omp end parallel do </p>
<p>Removing the dt assignment eliminates the disparity. Also, running these as serial codes shows no disparity, do the problem is not that the actual C implementation is just so bad. Also, eliminating just the reduction does not close the gap, so it is not the reduction operation itself.</p>
<p>All of those tests lead us to the conclusion that there is some terrible interaction between OpenMP and fmax/abs. Any help appreciated.</p>
<p>Thanks in advance,<br />
Jon</p>
Sat, 14 Sep 13 00:26:18 -0700Jon U.473111