Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ouissem_B
Beginner
858 Views

Spline interpolation using Intel MKL

Hi all,

I'm very new to using Intel MKL libraries and I would like to use the Spline Interpolation function for one of my Fortran projects.

Could someone please help me with a simple example on how to use it as a subroutine that I could call from my main file?

Many thanks for your help.

Best regards,
Ouissem

0 Kudos
17 Replies
858 Views

Hello Ouissem B,

Data Fitting domain of Intel MKL supports spline based computations.

The training materials on Data Fitting available at https://software.intel.com/sites/default/files/article/184622/df-training-materials_1.pdf can be a good start for learning of the content of the algorithms and their usage model.

Additional details on spline API are available in Intel MKL Manual, https://software.intel.com/en-us/node/471318.

Intel MKL provides the Fortran examples that demonstrate how to use the spline based computations, please have a look at the datafittingf folder in the example directory.

Please, let us know, if you have any additional questions

Ouissem_B
Beginner
858 Views

Hello Victoriya,

Thank you very much for your valuable reply.

I started reading the Training Materials and it helped me better understand how the data fitting API does work.

Looking in the DataFittingF folder, I've started adapting the 'dfscubicspline_interp.f' routine to my project, and I do have a small question if you don't mind: What does the 'nblocks' variable refers to?

Again, thank you for your reply and help.

Kind regards,

Ouissem

Victoriya Kardakova (Intel) wrote:

Hello Ouissem B,

Data Fitting domain of Intel MKL supports spline based computations.

The training materials on Data Fitting available at https://software.intel.com/sites/default/files/article/184622/df-training-materials_1.pdf can be a good start for learning of the content of the algorithms and their usage model.

Additional details on spline API are available in Intel MKL Manual, https://software.intel.com/en-us/node/471318.

Intel MKL provides the Fortran examples that demonstrate how to use the spline based computations, please have a look at the datafittingf folder in the example directory.

Please, let us know, if you have any additional questions

858 Views

Hello Ouissem,

The example 'dfscubicspline_interp.f' gives the idea how to interpolate with Intel MKL Data Fitting component in parallel mode.

The array of interpolation sites of size NSITE_BLOCK*NNBLOCKS  is split into blocks and can be processed in parallel using dfsInterpolate1D routine, and the number of blocks specified in the nblocks variable equal to NNBLOCKS.

Ouissem_B
Beginner
858 Views

Hello Victoriya,

Thank you for your reply.

I'm trying to adapt the 'dfscubicspline_interp.f' program to use it as a subroutine in my main project.

For the time being, I'm assuming NNBLOCKS = 1. If that doesn't require much parallelism effort from my side (I'm a bit short on time), it would be very useful to use NNBLOCKS > 1.

The think is that, after making my modifications, and when I'm trying to compile, I get errors such as:

Erreur   3             error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MKL_DF_TYPE]                \\...\mkl_interp_cspline.f90          34

Erreur   9             error #6785: This name does not match the unit name.   [MKL_DF_TYPE]                \\...\mkl_df.f90          310        

Erreur   19           error #6457: This derived type name has not been declared.   [DF_TASK]                \\...\mkl_df.f90          324

It seems that the INCLUDE paths have not been setup properly. Is there a way to set them up properly witout reinstalling the whole library?

Again, thank you Victoriya for your replies, your help is much appreciated.

Kinds regards,

Ouissem

Victoriya Kardakova (Intel) wrote:

Hello Ouissem,

The example 'dfscubicspline_interp.f' gives the idea how to interpolate with Intel MKL Data Fitting component in parallel mode.

The array of interpolation sites of size NSITE_BLOCK*NNBLOCKS  is split into blocks and can be processed in parallel using dfsInterpolate1D routine, and the number of blocks specified in the nblocks variable equal to NNBLOCKS.

858 Views

Hello Ouissem,

At first glance your environment for building/running the example is not properly configured.

Can you describe the building process of the example including environment configuration step?

Also, please, have a look at Intel MKL Link Line Advisor tool at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ to get additional details on the compiler and linker options necessary to build Intel MKL based application.

Ouissem_B
Beginner
858 Views

Hello Victoriya,

Actually, I'm using Microsoft Visual Studio and all I've done to now is set the Fortran compiler to use the MKL library (Configuration Properties > Fortran > Libraries > Use Intel Math Kernel Library > Sequential /Qmkl).

Many thanks,

Ouissem

Victoriya Kardakova (Intel) wrote:

Hello Ouissem,

At first glance your environment for building/running the example is not properly configured.

Can you describe the building process of the example including environment configuration step?

Also, please, have a look at Intel MKL Link Line Advisor tool at https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/ to get additional details on the compiler and linker options necessary to build Intel MKL based application.

858 Views

Hello Ouissem,

Could you please provide the command line that is used for the example compilation? You could find it in Microsoft Visual Studio project properties. It seems MKL include directory is missed there.

Gennady_F_Intel
Moderator
858 Views

in that case, I'd recommend you have a look at the article describing how to build such projects with mkl,  Please follow the link you will find out user's typical issue - https://software.intel.com/en-us/articles/how-to-use-lapack95

Ouissem_B
Beginner
858 Views

Hi Victoriya,

this is the Command Line used for my actual project.

/nologo /debug:full /Od /Qunroll:3 /Qparallel /warn:all /module:"Debug\\" /object:"Debug\\" /traceback /check:bounds /check:stack /libs:static /threads /dbglibs /winapp /4Yportlib /Qmkl:sequential /c

Many thanks for your help.

Ouissem

Victoriya Kardakova (Intel) wrote:

Hello Ouissem,

Could you please provide the command line that is used for the example compilation? You could find it in Microsoft Visual Studio project properties. It seems MKL include directory is missed there.

Ouissem_B
Beginner
858 Views

Hi Gennady,

Thank you for the link, I will have a look at it, and I will let you know

Many thanks for your reply. Best Regards.

Ouissem

Gennady Fedorov (Intel) wrote:

in that case, I'd recommend you have a look at the article describing how to build such projects with mkl,  Please follow the link you will find out user's typical issue - https://software.intel.com/en-us/articles/how-to-use-lapack95

Ouissem_B
Beginner
858 Views

Hi all,

I think that I've managed to configure my Visual Studio to use MKL, since I don't have any related error.

I'm trying to adapt the 'dfscubicspline_interp.f' program to use it as a subroutine in my main project. 

While compiling my subroutine, I get this kind of warnings / errors:

warning #6717: This name has not been given an explicit type.   [TASK]              \\emc1\...\mkl_df_interp_cspline.f90  199        

warning #6717: This name has not been given an explicit type.   [SUNIFORMRANDSORTEDDATA]                \\emc1\gso\3-Etudes\Prive\Exemples Intel Fortran\datafittingf\source\generatedata.inc       577        

warning #6717: This name has not been given an explicit type.   [SUNIFORMRANDDATA]                \\emc1\...\generatedata.inc       509      

 

[...]

 

error #6633: The type of the actual argument differs from the type of the dummy argument.   [TASK]                \\emc1\...\mkl_df_interp_cspline.f90   199        

error #6633: The type of the actual argument differs from the type of the dummy argument.   [TASK]                \\emc1\...\mkl_df_interp_cspline.f90   210        

error #6633: The type of the actual argument differs from the type of the dummy argument.   [TASK]                \\emc1\...\mkl_df_interp_cspline.f90   269        

error #5508: Declaration of routine 'SPEAKDATA' conflicts with a previous declaration \\emc1\...\generatedata.inc     624 

Hope this could give some insights about my problem. Please fill free to ask for any details that I can provide.

Kind regards,
Ouissem

858 Views

Hello Ouissem,

You appear not to add USE statement for the modules used in the subroutine. For example, TASK symbol is defined in MKL_DF_TYPE module, so please add the following statements into your program and let us know how it works for you:

USE MKL_DF_TYPE
USE MKL_DF

 

Ying_H_Intel
Employee
858 Views

Hi Ouissem,

is there any result with the use statement?

Regards,

Ying

Ouissem_B
Beginner
858 Views

Victoriya Kardakova (Intel) wrote:

Hello Ouissem,

You appear not to add USE statement for the modules used in the subroutine. For example, TASK symbol is defined in MKL_DF_TYPE module, so please add the following statements into your program and let us know how it works for you:

USE MKL_DF_TYPE
USE MKL_DF

 

Ying H (Intel) wrote:

Hi Ouissem,

is there any result with the use statement?

Regards,

Ying

HiVictoriya and Ying,

Thank you very much for your replies, and my apologies for my late answer.

Actually, both statement are included in my routine. In fact, as a first step, I used the 'dfscubicspline_interp.f' routine exactly the way it is, and which I'm adapting using my own entries. 

Up to now, the code seems to properly compile the subroutine, but crushes when executing it. I'm suspecting a coding errors (wrong definition of the targets/pointers). I probably need to better understand the existing routine before using it.

Again, thank you very much for your valuable help.

Kind regards.

Ouissem

mecej4
Black Belt
858 Views

Please give details regarding how you compiled the example code, the compiler version used and details of the crash.

I copied the files dfscubicspline_interp.f and the three .inc files from the ...\mkl\examples\datafittingf\source directory to a working directory, and built the program using ifort /Qmkl dfscubicspline_interp.f . The resulting EXE ran without any error and gave reasonable output results.

Ouissem_B
Beginner
858 Views

Hi mecej4,

Thank you for your reply.

Indeed, there was no problem compiling and running the dfscubicspline_interp.f program as it is provided.

In my case, I changed few things and made it as a subroutine, to call it from my main program:

subroutine MKL_DF_TEST ( ntop, ntop_int, top, top_int, p3dmax, p3dmax_int )

integer *4, intent (in) :: ntop
integer *4, intent (in) :: ntop_int
real (4), dimension (ntop), intent (in) :: top
real (4), dimension (ntop_int), intent (in) :: top_int
real (4), dimension (ntop), intent (in) :: p3dmax
real (4), dimension (ntop_int), intent (out) :: p3dmax_int

where p3dmax is the input and p3dmax_int the result of the interpolation.

The code crashs at this line (corresponding to L199 in the original dfscubicspline_interp.f routine):

errcode = dfsConstruct1D( task, type, method )
CALL CheckDfError(errcode)

 

I'm using iFort 11.1 on MS-Visual Studio 2013 / Windows.

Thank you very much for your help.

Kind regards,

Ouissem

mecej4 wrote:

Please give details regarding how you compiled the example code, the compiler version used and details of the crash.

I copied the files dfscubicspline_interp.f and the three .inc files from the ...\mkl\examples\datafittingf\source directory to a working directory, and built the program using ifort /Qmkl dfscubicspline_interp.f . The resulting EXE ran without any error and gave reasonable output results.

Ouissem_B
Beginner
858 Views

Hi!

I'm sorry for this late reply, the thing is that I'm working on this issue for a side project, and I hadn't much time to put on it.

Actually, I've managed, with the help of a collegue, to make my subroutine work. The issue was related to a bad definition of a pointer, which made the code crash each time it was used.

Thank you all for your help.

Kind regards,

Ouissem

Reply