[Openmp-dev] Bug in OpenMP runtime when compiled in debug mode and exercised using the GNU API

Churbanov, Andrey Andrey.Churbanov at intel.com
Mon Jul 13 13:25:21 PDT 2015


John,

Thank you for reporting the bug, it was just typo in the debug assertion statement.

I have committed the fix without pre-commit review, because it is too trivial typo, I think.

Thanks,
Andrey

From: openmp-dev-bounces at cs.uiuc.edu [mailto:openmp-dev-bounces at cs.uiuc.edu] On Behalf Of John Mellor-Crummey
Sent: Monday, July 13, 2015 8:01 PM
To: openmp-dev at dcs-maillist2.engr.illinois.edu
Subject: [Openmp-dev] Bug in OpenMP runtime when compiled in debug mode and exercised using the GNU API


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.

Compiling the simple code below with g++ and linking it to the LLVM OpenMP runtime compiled in debug mode produces a fatal error.

The program:

#include <omp.h>

#define NUM_THREADS 2

int fib(int i)
{
  if (i < 2) return i;
  else return fib(i-1) + fib(i-2);
}


int main(int argc, char **argv)
{
  int i, inner_threads;
  for (inner_threads = 1; inner_threads <= NUM_THREADS; inner_threads++) {
#pragma omp parallel for schedule(runtime) num_threads(inner_threads)
    for (i = 0; i < NUM_THREADS; i++) {
      fib(10);
    }
  }
  return 0;
}

The error:

Assertion failure at kmp_dispatch.cpp(1392): p_last && p_lb && p_ub && p_st.
OMP: Error #13: Assertion failure at kmp_dispatch.cpp(1392).
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 http://www.intel.com/software/products/support/.

The explanation:

On line 642 of kmp_gsupport.c, there is a call to

  status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, (kmp_int *)p_lb,        \
               (kmp_int *)p_ub, (kmp_int *)&stride);

The NULL is passed to the parameter shown in red below

template< typename T >
static int
__kmp_dispatch_next(
    ident_t *loc, int gtid, kmp_int32 *p_last, T *p_lb, T *p_ub, typename traits_t< T >::signed_t *p_st
)

This always fails the assertion below from line 1392 of kmp_dispatch.c

    KMP_DEBUG_ASSERT( p_last && p_lb && p_ub && p_st ); // AC: these cannot be NULL

I could fix it by eliminating the debug assertion, but I think it would be better for someone who understands the kmp dispatching mechanisms to think about how they are being used from the GOMP wrappers.

--
John Mellor-Crummey         Professor
Dept of Computer Science    Rice University
email: johnmc at rice.edu<mailto:johnmc at rice.edu>      phone: 713-348-5179


--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park, 
17 Krylatskaya Str., Bldg 4, Moscow 121614, 
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150713/f716868d/attachment.html>


More information about the Openmp-dev mailing list