ADOL-C
ADOL-C copied to clipboard
Data races in OpenMP thread-parallel implementation
The liborpar
example in ADOL-C/examples/additional_examples/openmp_exam often fails with an error message like:
ADOL-C error: forward sweep on tape 12 aborted!
Number of dependent(1) and/or independent(120) variables passed to forward is
inconsistent with number recorded on tape (1, 112)
terminate called after throwing an instance of 'FatalError'
what(): errorcode=-1 function=zos_forward file=./uni5_for.c line=1112 what=
Aborted
Running the example through ThreadSanitizer hints at data races in ADOL-C/src/tape_handling.cpp.
The following is an excerpt from the full log file for quick reference:
==================
WARNING: ThreadSanitizer: data race (pid=2993043)
Write of size 1 at 0x7f858c6ccaea by main thread:
#0 beginParallel() ../../../../ADOL-C/src/tape_handling.cpp:1227 (libadolc.so.2+0x32323)
#1 ADOLC_OpenMP::ADOLC_OpenMP(ADOLC_OpenMP const&) ../../../../ADOL-C/include/adolc/adolc_openmp.h:36 (liborpar+0x4
02b19)
#2 main._omp_fn.0 ../../../../ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp:166 (liborpar+0x402b19)
#3 GOMP_parallel ../../../libgomp/parallel.c:178 (libgomp.so.1+0x15295)
#4 __libc_start_main ../csu/libc-start.c:308 (libc.so.6+0x24082)
Previous read of size 1 at 0x7f858c6ccaea by thread T3:
#0 beginParallel() ../../../../ADOL-C/src/tape_handling.cpp:1229 (libadolc.so.2+0x31969)
#1 ADOLC_OpenMP::ADOLC_OpenMP(ADOLC_OpenMP const&) ../../../../ADOL-C/include/adolc/adolc_openmp.h:36 (liborpar+0x4
02b19)
#2 main._omp_fn.0 ../../../../ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp:166 (liborpar+0x402b19)
#3 gomp_thread_start ../../../libgomp/team.c:125 (libgomp.so.1+0x1da55)
Location is global 'waitForMaster_begin' of size 1 at 0x7f858c6ccaea (libadolc.so.2+0x000000177aea)
Thread T3 (tid=2993063, running) created by main thread at:
#0 pthread_create ../../../../libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x5edc5)
#1 gomp_team_start ../../../libgomp/team.c:845 (libgomp.so.1+0x1e06b)
#2 __libc_start_main ../csu/libc-start.c:308 (libc.so.6+0x24082)
SUMMARY: ThreadSanitizer: data race ../../../../ADOL-C/src/tape_handling.cpp:1227 in beginParallel()
==================