[Openmp-commits] [PATCH] D11269: Patch out an (apparently unwarranted) fatal assertion in OpenMP runtime until preconditions are met
John Mellor-Crummey
johnmc at rice.edu
Thu Jul 16 08:43:51 PDT 2015
jmellorcrummey created this revision.
jmellorcrummey added reviewers: AndreyChurbanov, llvm-commits.
jmellorcrummey added subscribers: llvm-commits, openmp-commits.
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");
}
http://reviews.llvm.org/D11269
Files:
runtime/src/kmp_runtime.c
Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -2086,7 +2086,11 @@
if ( __kmp_tasking_mode != tskm_immediate_exec ) {
// Set master's task team to team's task team. Unless this is hot team, it should be NULL.
+#if 0
+ // Patch out an assertion that trips while the runtime seems to operate correctly.
+ // Avoiding the preconditions that cause the assertion to trip has been promised as a forthcoming patch.
KMP_DEBUG_ASSERT(master_th->th.th_task_team == parent_team->t.t_task_team[master_th->th.th_task_state]);
+#endif
KA_TRACE( 20, ( "__kmp_fork_call: Master T#%d pushing task_team %p / team %p, new task_team %p / team %p\n",
__kmp_gtid_from_thread( master_th ), master_th->th.th_task_team,
parent_team, team->t.t_task_team[master_th->th.th_task_state], team ) );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11269.29915.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150716/e9c99cfb/attachment.bin>
More information about the Openmp-commits
mailing list