Data Race issue in Intel® oneAPI Math Kernel Library

ID 659263
Updated 1/29/2020
Version Latest
Public

author-image

By

This article describes the Data Race issue reported by one of Intel® oneAPI Math Kernel Library (Intel® oneMKL) customers and which we are not aware of. The Intel® Inspector tool reports Data Races issues connected with dfdNewTask1D routine from oneMKL Data Fitting components when this function is called from within #pragma omp parallel for the region. Here is a snippet of the code where the problem comes from:

#pragma omp parallel for
for(int i=0;i<100;i++)
{
    DFTaskPtr task;
    double xdata[100];
    double ydata[100];
    
    MKL_INT xhint = DF_NON_UNIFORM_PARTITION;
    MKL_INT yhint = DF_NO_HINT;
    
    int status = dfdNewTask1D( &task, 100, xdata, DF_NON_UNIFORM_PARTITION, 100, ydata, DF_NO_HINT );    
    status = dfDeleteTask( &task );
}

 

Affected Products: all versions of Intel oneMKL

Affected oneMKL domains: Data Fitting, Summary Statistic and Random Number Generators

Affected Operation Systems: All supported OS. Please refer to the Intel oneMKL System requirements to see the list of supported operating systems.

The suggested temporary workaround of the problem:  all DataFitting functions should be called for the first time from out of any parallel region. The below example shows how this case could look like:

DFTaskPtr task1;

double xdata1[100];
double ydata1[100];

int status1 = dfdNewTask1D( &task, 100, xdata1, DF_NON_UNIFORM_PARTITION, 100, ydata1, DF_NO_HINT );
status1 = dfDeleteTask( &task1 );

#pragma omp parallel for
for(int i=0;i<100;i++){

    DFTaskPtr task;
    
    double xdata[100];
    double ydata[100];

    int status = dfdNewTask1D( &task, 100, xdata, DF_NON_UNIFORM_PARTITION, 100, ydata, DF_NO_HINT );
    status = dfDeleteTask( &task );
}