Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
732 Discussions

Runtime Error with OpenMP Cancel Directive in Dynamic Loop

leavelet
Beginner
422 Views

I am facing an intermittent runtime error when using the OpenMP cancel for directive within a dynamic scheduling context.

Below are the error message and the code snippet where the issue occurs. This error is particularly perplexing as it is data-specific; it occurs 90% of the time with certain data sets but not at all with others.

 

Error Message:

 

OMP: Error #13: Assertion failure at kmp_dispatch.cpp(2430).
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/.

Thread 37 "dbrunner" received signal SIGABRT, Aborted.

 

 

Command Line:

 

export OMP_CANCELLATION=TRUE # root cause
export OMP_NESTED=TRUE
export OMP_DYNAMIC=TRUE
export OMP_PLACES=sockets 
export OMP_PROC_BIND=spread
./dbrunner 

 

Machine Configuration:

 

CPU: intel xeon platinum 8358
OS: Rockylinux 9.3, GCC: 11.4.1
OneAPI Version: 2024.1 (latest)

 

Code Snippet:

Full source code is attached.

 

#pragma omp parallel for schedule(dynamic)
for (int i = 0; i < count; i++)
{
    auto l = leftGroups[i];
    auto r = rightGroups[i];

    valid[i] = ::isForeignKey(l, r, primary, foreign) ? 1 : 0;
    if (!valid[i])
    {
        #pragma omp cancel for
    }
}

for (auto& v: valid)
{
    if (v == 0) return false;
}

 

Backtrace:

 

#0  0x0000155554aa154c in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x0000155554a54d06 in raise () from /lib64/libc.so.6
#2  0x0000155554a287f3 in abort () from /lib64/libc.so.6
#3  0x0000155554eb70b1 in __kmp_abort_process () at ../../src/kmp_runtime.cpp:514
#4  0x0000155554ead0bd in __kmp_fatal (message=...) at ../../src/kmp_i18n.cpp:905
#5  0x0000155554e843e6 in __kmp_debug_assert (msg=<optimized out>, file=<optimized out>, line=2430) at ../../src/kmp_debug.cpp:100
#6  0x0000155554e87d3c in __kmp_dispatch_next<int> (loc=0x4ab4c0, gtid=36, p_last=<optimized out>, p_lb=0x15549eff230c, p_ub=0x15549eff2308, p_st=0x15549eff2320, codeptr=0x0)
    at ../../src/kmp_dispatch.cpp:2430
#7  __kmpc_dispatch_next_4 (loc=0x4ab4c0, gtid=36, p_last=<optimized out>, p_lb=0x15549eff230c, p_ub=0x15549eff2308, p_st=0x15549eff2320) at ../../src/kmp_dispatch.cpp:2982
#8  0x000000000041b6d2 in ForeignKeyChecker::isForeignKey(Selection const&, Selection const&) [clone .extracted] ()
#9  0x0000155554f34283 in __kmp_invoke_microtask () from /opt/intel/oneapi/compiler/2024.1/lib/libiomp5.so
#10 0x0000155554ec2973 in __kmp_invoke_task_func (gtid=36) at ../../src/kmp_runtime.cpp:8487
#11 0x0000155554ec13ee in __kmp_launch_thread (this_thr=0x155552e26b00) at ../../src/kmp_runtime.cpp:6740
#12 0x0000155554f35421 in __kmp_launch_worker (thr=0x155552e26b00) at ../../src/z_Linux_util.cpp:560
#13 0x0000155554a9f802 in start_thread () from /lib64/libc.so.6
#14 0x0000155554a3f450 in clone3 () from /lib64/libc.so.6

 

 

0 Kudos
1 Reply
cw_intel
Moderator
345 Views

> This error is particularly perplexing as it is data-specific; it occurs 90% of the time with certain data sets but not at all with others.

Did you add the data to the reproducer so that I can reproduce the problem? I ran the code you provided and the problem did not occur.

 

0 Kudos
Reply