- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I am using MKL compilers_and_libraries_2017.4.210 (update 3) and following the developer guide to construct a cubic spline interpolation workflow. However no matter how I configure my inputs the scoeff values from dfdEditPPSpline1D() output stays bad memory allocation. The function return a good status but then crashes in the next function dfdConstruct1D(). I wonder whether I miss something in my configuration or inclusion of files, or whether there is a bug. My source code was copied below with dummy input data.
Regards,
Tianhua
--------------------------------------------
For compile, I included 34 h files that are enough for my project.
For link I included mkl_core.lib, mkl_core_dll.lib, mkl_intel_ilp64.lib, mkl_intel_ilp64_dll.lib, mkl_sequential.lib and mkl_sequential_dll.lib.
For execution, I included mkl_core.dll, mkl_sequential.dll and mkl_vml_def.dll
Those appear enough.
Dummy source code which has bad memory of scoeff pointer and crashes in the next function.
------{
//setup MKL data structures
#define SPLINE_ORDER DF_PP_CUBIC /* A cubic spline to construct */
int status; /* Status of a Data Fitting operation */
DFTaskPtr task; /* Data Fitting operations are task based */
/* Parameters describing the partition */
MKL_INT nx; /* The size of partition x */
MKL_INT xhint; /* Additional information about the structure of breakpoints */
/* Parameters describing the function */
MKL_INT ny; /* Function dimension */
MKL_INT yhint; /* Additional information about the function */
/* Parameters describing the spline */
MKL_INT s_order; /* Spline order */
MKL_INT s_type; /* Spline type */
MKL_INT ic_type; /* Type of internal conditions */
double* ic; /* Array of internal conditions */
MKL_INT bc_type; /* Type of boundary conditions */
double* bc; /* Array of boundary conditions */
double scoeff[(20 - 1)* SPLINE_ORDER]; /* Array of spline coefficients */
MKL_INT scoeffhint; /* Additional information about the coefficients */
MKL_INT sitehint; /* Additional information about the structure of
interpolation sites */
MKL_INT ndorder, dorder; /* Parameters defining the type of interpolation */
double* datahint; /* Additional information on partition and interpolation sites */
double *r; /* Array of interpolation results */
r = new double[20];
MKL_INT rhint; /* Additional information on the structure of the results */
MKL_INT* cell; /* Array of cell indices */
/* Initialize the partition */
nx = 10;
nsite = 20;
double x[10], y[10];
for (int i = 0; i < 10; i++)
{
x = i;
y = pow(i, 3);
}
for (int i = 0; i < 20; i++)
{
site = i;
}
for (int i = 0; i < 19 * SPLINE_ORDER; i++)
scoeff = -9999.0;
xhint = DF_NON_UNIFORM_PARTITION; /* The partition is non-uniform. */
/* Initialize the function */
ny = 1; /* The function is scalar. */
yhint = DF_NO_HINT; /* No additional information about the function is provided. */
status = dfdNewTask1D(&task, nx, x, xhint, ny, y, yhint);
if (status == 0)
{
/* Initialize spline parameters */
s_order = DF_PP_CUBIC; /* Spline is of the fourth order (cubic spline). */
s_type = DF_PP_NATURAL; /* Spline is of the natural cubic spline type. */
/* Define internal conditions for cubic spline construction (none in this example) */
ic_type = DF_NO_IC;
ic = NULL;
/* Use not-a-knot boundary conditions. In this case, the is first and the last
interior breakpoints are inactive, no additional values are provided. */
bc_type = DF_BC_FREE_END; //natural cubic spline
bc = NULL;
scoeffhint = DF_NO_HINT; /* No additional information about the spline. */
status = dfdEditPPSpline1D(task, s_order, s_type, bc_type, 0, ic_type,
0, &scoeff[0], scoeffhint);
//continue only when the internal boundary condition task is successful
if (status == 0)
{
/* Use a standard method to construct a cubic Bessel spline: */
/* Pi(x) = ci,0 + ci,1(x - xi) + ci,2(x - xi)2 + ci,3(x - xi)3, */
/* The library packs spline coefficients to array scoeff: */
/* scoeff[4*i+0] = ci,0, scoef[4*i+1] = ci,1, */
/* scoeff[4*i+2] = ci,2, scoef[4*i+1] = ci,3, */
/* i=0,...,N-2 */
status = dfdConstruct1D(task, DF_PP_SPLINE, DF_METHOD_STD);
// skip the data construction check, TZ May 2017
sitehint = DF_NON_UNIFORM_PARTITION; /* Partition of sites is non-uniform */
ndorder = 1;
dorder = 1;
datahint = DF_NO_APRIORI_INFO; /* No additional information about breakpoints or
sites is provided. */
rhint = DF_MATRIX_STORAGE_ROWS; /* The library packs interpolation results
in row-major format. */
cell = NULL; /* Cell indices are not required. */
/* Solve interpolation problem using the default method: compute the spline values
at the points site(i), i=0,..., nsite-1 and place the results to array r */
status = dfdInterpolate1D(task, DF_INTERP, DF_METHOD_PP, nsite, site,
sitehint, ndorder, &dorder, datahint, r, rhint, cell);
/* De-allocate Data Fitting task resources */
status = dfDeleteTask(&task);
}
--------------------
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It crashes on my side, at the line
status = dfdConstruct1D(task, DF_PP_SPLINE, DF_METHOD_STD);
No warning, no error message, just termination of execution. The output window after the project terminates was shown in the message to Egor.
'mkl_df_issue.exe' (Win32): Loaded 'D:\NGI\slim_NGI\testMKL\mkl_df_issue\mkl_df_issue\x64\Release\mkl_df_issue.exe'. Symbols loaded.
'mkl_df_issue.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'mkl_df_issue.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'mkl_df_issue.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'mkl_df_issue.exe' (Win32): Loaded 'D:\NGI\slim_NGI\testMKL\mkl_df_issue\mkl_df_issue\x64\Release\mkl_sequential.dll'. Module was built without symbols....
Tianhua
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »