This is an archive of the discontinued LLVM Phabricator instance.

Patch out an (apparently unwarranted) fatal assertion in OpenMP runtime until preconditions are met
ClosedPublic

Authored by jmellorcrummey on Jul 16 2015, 8:43 AM.

Details

Summary

Compiling the code below with g++ and linking it to the LLVM OpenMP runtime compiled in debug mode trips an assertion that produces a fatal error. When the assertion is skipped, the program runs successfully to completion and produces the same answer as the sequential code. Intel will restore the assertion with a patch that fixes the issues that cause it to trip.

The program:

#include <inttypes.h>
#include <stdio.h>
#include <omp.h>

#define NTHREADS 8
#define NBOUND 40

uint64_t result[NBOUND];

uint64_t fib(int n)
{

if (n < 2) return n;
else return fib(n-1) + fib(n-2);

}

void testparallel()
{
#pragma omp parallel num_threads(NTHREADS)

{

#pragma omp for

  for(int i = 0; i < NBOUND; i++)  result[i] = fib(40);
}

}

void teststatic()
{
#pragma omp parallel for schedule(static)

for(int i = 0; i < NBOUND; i++) result[i] += fib(40);

}

int main(int argc, char **argv)
{

int i;

testparallel();
teststatic();

for(i=0;i< NBOUND;i++) printf("%lld ", result[i]);
printf("\n");

}

Diff Detail

Repository
rL LLVM

Event Timeline

jmellorcrummey retitled this revision from to Patch out an (apparently unwarranted) fatal assertion in OpenMP runtime until preconditions are met.
jmellorcrummey updated this object.
AndreyChurbanov accepted this revision.Jul 16 2015, 1:19 PM
AndreyChurbanov edited edge metadata.

LGTM

Note, we are going to restore the assertion later, when related problem with threads task states synchronization is fixed in the library.

This revision is now accepted and ready to land.Jul 16 2015, 1:19 PM

Is there any reason why this hasn't been committed yet?

This revision was automatically updated to reflect the committed changes.