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");
}