<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Yesterday, I posted an OpenMP fatal assertion when compiled in debug mode. Here is another. As I stated yesterday, I would file this bug with bugzilla, but I can’t figure out where the OpenMP bugs should go. If someone could enlighten me, I’d be grateful.</div><div class=""><br class=""></div><div class=""><b class=""><font color="#ff2600" class="">Compiling the code below with g++ and linking it to the LLVM OpenMP runtime compiled in debug mode produces a fatal error.</font></b></div><div class=""><br class=""></div><div class=""><b class="">The program:</b></div><div class=""><br class=""></div><div class=""><div class=""><div class="">#include <inttypes.h></div><div class="">#include <stdio.h></div><div class="">#include <omp.h></div><div class=""><br class=""></div><div class="">#define NTHREADS 8</div><div class="">#define NBOUND 40 </div><div class=""><br class=""></div><div class="">uint64_t result[NBOUND]; </div><div class=""><br class=""></div><div class="">uint64_t fib(int n) </div><div class="">{</div><div class="">  if (n < 2) return n;</div><div class="">  else return fib(n-1) + fib(n-2);</div><div class="">}</div><div class=""><br class=""></div><div class="">void testparallel()</div><div class="">{</div><div class="">#pragma omp parallel num_threads(NTHREADS) </div><div class="">  {</div><div class="">#pragma omp for</div><div class="">    for(int i = 0; i < NBOUND; i++)  result[i] = fib(40);</div><div class="">  }</div><div class="">}</div><div class=""><br class=""></div><div class="">void teststatic()</div><div class="">{</div><div class="">#pragma omp parallel for schedule(static)</div><div class="">  for(int i = 0; i < NBOUND; i++) result[i] += fib(40);</div><div class="">}</div><div class=""><br class=""></div><div class="">int main(int argc, char **argv)</div><div class="">{</div><div class="">  int i;</div><div class=""><br class=""></div><div class="">  testparallel();</div><div class="">  teststatic();</div><div class=""><br class=""></div><div class="">  for(i=0;i< NBOUND;i++) printf("%lld ", result[i]);</div><div class="">  printf("\n");</div><div class="">}</div><div class=""><br class=""></div></div></div><div class=""><b class="">The error:</b></div><div class=""><br class=""></div><div class=""><div class=""><div class="">Assertion failure at kmp_runtime.c(2089): master_th-><a href="http://th.th" class="">th.th</a>_task_team == parent_team->t.t_task_team[master_th-><a href="http://th.th" class="">th.th</a>_task_state].</div><div class="">OMP: Error #13: Assertion failure at kmp_runtime.c(2089).</div><div class="">OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see <a href="http://www.intel.com/software/products/support/" class="">http://www.intel.com/software/products/support/</a>.</div><div class=""><br class=""></div><div class="">This assertion triggers on both the PPC64 and Intel64 architectures on which I tested it.</div><div class=""><br class=""></div></div></div><div class=""><font color="#ff2600" class=""><b class="">When the runtime is not compiled in debug mode, the program runs successfully to completion and produces the same answer as the sequential code.</b></font></div><div class=""><div class=""><br class=""></div><div class="">While the assertion triggers when executing teststatic(), removing the prior call to testparallel() makes the assertion disappear.</div><div apple-content-edited="true" class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-size: 12px;" class=""><font face="Courier" class="">--<br class="">John Mellor-Crummey         Professor<br class="">Dept of Computer Science    Rice University<br class="">email: <a href="mailto:johnmc@rice.edu" class="">johnmc@rice.edu</a>      phone: 713-348-5179</font><br class=""></div></div></span></div></span>
</div>
<br class=""></div></body></html>