Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Access Violation in mkl_vml_mc3 with latest MKL

David_Hirschfeld
Beginner
529 Views

With the latest MKL (v. 11.0.2.149) the below code segfaults. With the previous MKL version it compiled and ran fine. This is with VS2012 compiling in x64. Solution attached. Is there anything wrong with the code or is this a bug in the latest MKL version? Thanks, Dave #include #include #include #include using namespace std; int main () { const int nx = 11; // #rows in x const int ny = 1; // #cols in y vector x(nx), y(nx); for(int i=0; i coeffs(ny*(nx-1)*s_order); status = dfdEditPPSpline1D(task, s_order, s_type, bc_type, nullptr, ic_type, nullptr, &coeffs[0], scoeffhint); status = dfdConstruct1D(task, DF_PP_SPLINE, DF_METHOD_STD); const MKL_INT nsite = 1; vector xi(nsite), yi(nsite); MKL_INT ndorder = 1; MKL_INT dorder = 1; double* datahint; datahint = DF_NO_APRIORI_INFO; MKL_INT rhint = DF_MATRIX_STORAGE_ROWS; MKL_INT sitehint = DF_NON_UNIFORM_PARTITION; xi[0] = 10; status = dfdInterpolate1D(task, DF_INTERP, DF_METHOD_PP, nsite, &xi[0], sitehint, ndorder, &dorder, datahint, &yi[0], rhint, NULL); status = dfDeleteTask(&task); for(int i=0; i<nsite; ++i){ cout << yi << ", "; } return 0; }

0 Kudos
8 Replies
David_Hirschfeld
Beginner
529 Views

The above code doesn't seem to format correctly. It's available in the attached zip file and also viewable in the following gist:

https://gist.github.com/dhirschfeld/4976770

0 Kudos
Gennady_F_Intel
Moderator
529 Views

Dave, thanks for the test. we will check the issue on our side.

0 Kudos
Gennady_F_Intel
Moderator
529 Views

David, we see the similar behavior on our side on win32/64 with the latest 11.0.update2. Thanks for the issue. We will back to you as soon as any news.

is that blocking  issue for your application?

0 Kudos
David_Hirschfeld
Beginner
529 Views

Thanks for looking into it. I've reverted to 11.1 in the meantime as 11.2 either segfaults the code or returns unallocated memory giving incorrect results.

On another note, can you explain or point me to documentation explaining exactly what DF_QUASI_UNIFORM_PARTITION means in terms of the x-data passed to the interpolator? I found the description "Partition is quasi-uniform" less than enlightening :P

http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/GUID-E308EE83-B72B-4570-B4B3-AD6EAE08DC0A.htm#TBL17-3

Thanks,

Dave

0 Kudos
mecej4
Honored Contributor III
529 Views

I found the description "Partition is quasi-uniform" less than enlightening
I hope that you found it quasi-enlightening. :)
If you read the description for the argument x, you may find the answer. "Quasi-uniform" is the same as "Uniform", but lacks the end points a and b.

0 Kudos
Andrey_N_Intel
Employee
529 Views

Hello Dave,

Uniform partition x={x(1),...,x(n)} is one in which all cells [x(i),x(i+1) ) have the same length delta = x(i+1)-x(i). The library expects that for uniform partition you provide the end-points of the partition interval, number of points, and specify related hint.

For quasi-uniform partition this is not the case, that is delta depends on i, delta = delta(i). At the same time, it is expected that those delta(i) slightly vary around a constant level, 1<=M/m <= C, where M=max{x(i),i=1,...,n-1}, m=min{x(i),i=1,..,n-1}, and C is a constant close to 1. For this reason we call it quasi-uniform. For this type of the partition the library expects array of n points, and the relavant hint. It makes sense to extend the documentation with additional details and references to literature. Thanks for catching this.

Feel free to ask more questions and/or share your feedback on Data Fitting component of Intel(R) MKL.

I have the quick update on the issue: as Gennady reported we reproduced the bug and are investigating it. Likely, it is caused by the code optimizations for a scalar case we integrated into Intel(R) MKL 11.0.2. Would keep you updated.

I have a couple of quick suggestions on your example above:

1. If you do not provide datahint, please set the pointer to null. Do not use the constant DF_NO_APRIORI_INFO to initialize it as this constant is intended to be used for initialization of the the first (in zero-based indexing) element of array datahint. Please, see additional details in description of Interpolate1D routine in Intel(R) MKL Manual

2. For linear type of spline please use DF_NO_BC to initialize boundary conditions (in general case), additional details can be found in the description of EditPPSpline1D editor in Intel(R) MKL Manual.

I also have the question for you: can you please briefly clarify the reasons for which you call the interpolation routine for one point(site) instead of accumulating the interpolation sites to a buffer and making one call to the interpolation routine with this buffer? This would help you to get additional performance gain vs a scalar case. Or, generally you use a vector approach, and use the example as just a short test to reproduce the issue?

Thanks,

Andrey

 

0 Kudos
David_Hirschfeld
Beginner
529 Views

Thanks for the detailed info/explanations!

The code was just a minimal example to demonstrate the problem. I found that the bug only manifested itself when passed a single value. This could happen in practice because the number of intyerpolation sites is function of a larger optimization process.

0 Kudos
Gennady_F_Intel
Moderator
529 Views

David, please check the lates 11.0 update3. The issue has been fixed there. regards, Gennady

0 Kudos
Reply