- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a source code doing an Akima spline that works perfectly in one dll but crashes in another one and I absolutely don't understand why!
Of course, the data sets used for the spline are different but nothing special here.
Here is the code.
subroutine AkimaSpline(NDATA, XDATA, FDATA, X, Y)
use IFWIN
use MKL_DF
use MKL_DF_TYPE
implicit none
! Arguments
integer(4), intent(in) :: NDATA
real(8), intent(in) :: XDATA(NDATA), FDATA(NDATA)
real(8), intent(in) :: X
real(8), intent(out) :: Y
! Constants
integer(4), parameter :: ERROR_INSUFFICIENT_DATA = APPLICATION_ERROR_MASK + ERROR_SEVERITY_ERROR + #00000002
! Variables locales
! Data Fitting task descriptor
type (DF_TASK) task
! local pointers
real(8), allocatable :: xx(:)
real(8), allocatable :: yy(:)
real(8), allocatable :: scoeff(:)
integer nx, xhint, ny, yhint, sorder, stype, scoeffhint
integer bc_type, ic_type, errcode, dorder(1)
integer nsite, sitehint, ndorder, rhint
real(8) site(1), r(1), datahint(2)
! Body of subroutine
! If not enough data points, raise exception
if (NDATA < 5) call RaiseException(ERROR_INSUFFICIENT_DATA, EXCEPTION_NONCONTINUABLE, 0, NULL)
! Parameters describing interpolation interval
nx = NDATA
if (allocated(xx)) deallocate(xx)
allocate(xx(NDATA))
xx(1:NDATA) = XDATA(1:NDATA)
xhint = DF_NON_UNIFORM_PARTITION
! Parameters describing function
ny = 1
if (allocated(yy)) deallocate(yy)
allocate(yy(NDATA))
yy(1:NDATA) = FDATA(1:NDATA)
yhint = DF_NO_HINT
! Parameters describing order and type of the spline
sorder = DF_PP_CUBIC
stype = DF_PP_AKIMA
! Parameter describing additional info about spline coefficients
if (allocated(scoeff)) deallocate(scoeff)
allocate(scoeff(sorder*(nx-1)))
scoeff(:) = 0.d0
scoeffhint = DF_NO_HINT
! Parameters describing boundary conditions type
bc_type = DF_BC_NOT_A_KNOT
! Parameters describing internal conditions type
! No internal conditions are provided for Akima cubic spline
ic_type = DF_NO_IC
! Create Data Fitting task
errcode = dfdNewTask1D(task, nx, xx, xhint, ny, yy, yhint)
call CheckDfError(errcode,.false.)
! Edit task parameters for Akima cubic spline construction
errcode = dfdEditPPSpline1D(task, sorder, stype, bc_type, ic_type=ic_type, scoeff=scoeff, scoeffhint=scoeffhint)
call CheckDfError(errcode,.false.)
! Construct Akima cubic spline using STD method
errcode = dfdConstruct1D(task, DF_PP_SPLINE, DF_METHOD_STD)
call CheckDfError(errcode,.false.)
! Compute piecewise polynomial cubic spline at X
nsite = 1
ndorder = 1
site(1) = X
dorder(1) = 1
sitehint = DF_NON_UNIFORM_PARTITION ! DF_NO_HINT
datahint(1) = 1.d0
datahint(2) = dble(DF_NO_APRIORI_INFO) ! No additional information about breakpoints or sites is provided.
rhint = DF_MATRIX_STORAGE_COLS ! The library packs interpolation results in row-major format.
errcode = dfdInterpolate1D(task, DF_INTERP, DF_METHOD_PP, nsite, site, sitehint, ndorder, dorder, datahint, r, rhint)
call CheckDfError(errcode,.false.)
Y = r(1)
! Delete Data Fitting task
errcode = dfDeleteTask(task)
call CheckDfError(errcode,.false.)
! Memory deallocations
if (allocated(scoeff)) deallocate(scoeff)
if (allocated(yy)) deallocate(yy)
if (allocated(xx)) deallocate(xx)
end subroutine AkimaSpline
The crash happens when calling the dfdNewTask1D routine (my app closes directly).
The differences between the two dlls is may be in the project settings but I don't know where !
here are the settings of the dll who crashes:
/nologo /debug:full /Od /fpp /DSIMULIS_INSIDE /DWIN32 /DHTML_CODE /DDVF /DUNIT_OP /arch:IA32 /extend-source:132 /debug-parameters:all /warn:interfaces /Qsave /align:commons /assume:byterecl /Qinit:zero /Qinit:arrays /fpe:1 /fp:source /fpconstant /Qfp-speculation=strict /iface:mixed_str_len_arg /module:"Win32\Debug\\" /object:"Win32\Debug\\" /Fd"Win32\Debug\vc170.pdb" /traceback /libs:dll /threads /dbglibs /Qmkl:sequential /c
(Note: I already tried to remove the /arch:IA32 but without success)
and the ones for the dll who works perfectly:
/nologo /debug:full /Od /fpp /DWIN32 /DFRENCH /DSTARDUST /reentrancy:threaded /extend-source:132 /debug-parameters:all /warn:interfaces /Qauto /assume:byterecl /fpe:1 /fp:source /fpconstant /Qfp-speculation=strict /iface:mixed_str_len_arg /module:"Win32\Debug\\" /object:"Win32\Debug\\" /Fd"Win32\Debug\vc170.pdb" /traceback /check:bounds /check:uninit /libs:static /threads /dbglibs /Qmkl:parallel /c
My compiler version is 2021.10.0 (oneAPI 2023.2.1) and I have installed only the minimum set ot tools I need (fortran compiler, tools (advisor, profiler and inspector) along with the mkl lib 32 bit from OneAPI basic and HPC kits).
Any Idea ?
Best regards,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Finally, I found that the difference comes from the libraries' settings. In the project that works, the setting is:
/libs:static
whereas in the dll who crashes, it is
/libs:dll
In my application I have a lot of dlls using this setting (to reduce their size) and the runtime libraries are preloaded by the calling process. Here is the list of the preloaded dlls:
- libmmd.dll
- libmmdd.dll
- libifcoremdd.dll
- libifportmd.dll
- mkl_core.2.dll
- mkl_sequential.2.dll
Do I need another one when using the interpolation functions?
Note that the crash also happened on my computer where intel OneAPI is installed and used to build my projects.
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Any idea about how to solve this issue with the use of dynamic linking with the MKL (static link works but dynamic linking makes the call to dfdNewTask1D crash violently).
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Philippe,
Thanks for posting on Intel Communities.
Thanks for elaborating on the details.
Finally, I found that the difference comes from the libraries' settings. In the project that works, the setting is: /libs:static whereas in the dll who crashes, it is /libs:dll
>> Glad to know that you are able to find the root cause. However, regarding the crash, could you please let us know if all the required routines were added to the dll and all the project properties were set properly? Could you please get back to us with the configuration properties settings? We will get back to you soon with an update as currently we are facing a technical issue.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shanmukh,
Any update concerning a possible fix?
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Phillippe,
We have tried running the shared source code. However, it seems a few dependent module files were missing as mentioned below. Could you please share with us the same, so that we could triage the issue better?
Error in opening the compiled module file. Check INCLUDE paths. [MKL_DF]
Error in opening the compiled module file. Check INCLUDE paths. [MKL_DF_TYPE]
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shanmukh,
Here are the missing files.
Note that they came from the include folder of the MKL installation directory ("C:\Program Files (x86)\Intel\oneAPI\mkl\<version>\include\").
They are maybe not the latest ones since I needed to include them in my Mercurial repository. Should it be the source of the problem?
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This is to kindly remind you that 32-bit version will be deprecated in the upcoming Intel® oneMKL 2024.0 release and targeted to be removed after one year deprecation notice.
In addition, Could you please get back to us with the comprehensive reproducer which will contains all input data that not only includes the subroutines like this so that we could build statically, dynamically and check the behavior?
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
A gentle reminder:
Could you please get back to us with the earlier requested details to look into your issue further?
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
here is a ZIP file that contains two solutions/projects, one for building the dll which contains the AkimaSpline routine above and which is build using runtime libs (AkimaSpline folder) and the second which uses the AkimaApline dll to perform spline calculations. The runtime libs are loaded in the Akima_Test console app before calling the AkimaSpline dll. You need to build both Debug configurations.
Best regards,
P.S.: To come back to your comment about the deprecation of the 32-bit version of the mkl, I am quite disappointed since we are still building 32-bit version of some of our software even if we are working on a 64-bit version, I hope that we will be ready before the 32-bit version disappear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for sharing the files.
As mentioned earlier, Could you please cross-verify the project settings if all the properties were set as expected ? (the settings for the 64-bit platform mentioned by you) Besides this, we are working on your issue. We have tried compiling the 2 project files shared. Akima_Test compiled fine, however, we are facing issues in compiling the AkimaSpline project file. We are trying to resolve the same.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You are right, the settings for the 64-bit platform were not correct (the /Qmkl:sequential item is missing in the libraries category), but as I was only focusing on 32-bit version I did not notice that. Anyway, trying to build a version which can also be run in 64-bit, I got different behavior in using the 32-bit debug version inside the debugger or directly in a console window. In the debugger, the app crashes simply, but in the console window I got the following message (sorry if part of it is in french):
INTEL MKL ERROR: Le module spÚcifiÚ est introuvable. mkl_vml_avx512.2.dll.
Intel MKL FATAL ERROR: cannot load mkl_vml_avx512.2.dll or mkl_vml_p4.2.dll
Anyway, this means that another runtime library is required (mkl_vml_avx512.2.dll or mkl_vml_p4.2.dll).
I added mkl_vml_avx512.2.dll to the list of preloaded dlls and now it works fine. I will check with my other dll in which the problem was identified. Do you have a list of the required MKL dlls depending on the functions used? because I have another dll which can use PARDISO solver, and I am afraid it does not work either and I don't know which additional dlls I need.
If you want to check on your side (you can simply comment the line relating to mkl_vml_avx512.2.dll in the RuntimeLibraries.txt file by placing a semi-colon ";" at the beginning of the line), the updated ZIP archive is attached.
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Phillipe,
>>Do you have a list of the required MKL dlls depending on the functions used?
Please find the requested information below. Kindly go through the links as per your requirements.
Contents of the redist\\intel64 Directory:
Dynamic Libraries in the lib\\intel64 Directory:
Linking with Computational Libraries:
Thanks for sharing the updated zip file.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
A gentle reminder:
Could you please let us know if there is any update on the earlier issue?
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Since a new thread <https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/dfdNewTask1D-crash-cont-d/m-p/1539864#M35389> is raised on behalf of this thread, we will no longer monitor this thread. We will continue addressing this issue in the other thread.
Best Regards,
Shanmukh.SS

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page