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

Where is mathimf.h when using MS C++?

jj2007
Beginner
1,520 Views
#include <stdio.h>
#include <Mkl.h>
#include <Math.h>

//#include <Mathimf.h>	// cannot open

int main() {
	printf("Bessel J0(5)\t%1.19f\n", j0(5.0));	// testing MKL ******************************
}

Works like a charm, although I expected j0() to reside in Mathimf.h - but that file is not present on my machine... any idea why?

Questions:

1. When using Math.h instead of the non-existent MathImf.h, will my program use the slow old MS C++ j0()?

2. Does the true MKL j0() reside somewhere else?

3. I would like to use LoadLibrary & GetProcAddress. Is there a DLL in C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\redist\ia32\mkl\ that contains this Bessel function?

 

0 Kudos
1 Solution
Zhen_Z_Intel
Employee
1,520 Views

Hi,

In windows, if you would like to use mathimf.h, you have to use Intel c++ compiler, it could not used for MS compiler. The mathimf.h is stored in include folder of Intel compiler, please have a check if you have it. To answer your question:

1. You do not need to worry this problem, if you choose to use Intel compiler, even you use math.h instead of mathimf.h; the program will be built by intel math lib. It has same functionality by using "math.h" instead of "mathimf.h" if you build with Intel compiler. But if you use MS compiler, these math function will be built by microsoft defined math library, these math functions' performance will not be optimized. See this article.

2. There 's no function called j0() in MKL, it's actually defined in math.h/ mathimf.h. Intel MKL is mainly used for matrix/vector calculation. Even there might be any mkl data fitting function for bessel spline, it is actually built by compiler linked math lib. That means, if you build with icl, it will be linked with Intel math lib, if you build with MS, it will be linked with MS math lib. You could refer more info from MKL user guide.

3. For Intel math library, different math lib with different suffix will be linked under different mode. For instance, he libmmt.lib is linked for multi-threaded static library. Please view this link to learn.

Hope it would be useful to you. Thank you.

Best regards,
Fiona

View solution in original post

0 Kudos
4 Replies
Zhen_Z_Intel
Employee
1,521 Views

Hi,

In windows, if you would like to use mathimf.h, you have to use Intel c++ compiler, it could not used for MS compiler. The mathimf.h is stored in include folder of Intel compiler, please have a check if you have it. To answer your question:

1. You do not need to worry this problem, if you choose to use Intel compiler, even you use math.h instead of mathimf.h; the program will be built by intel math lib. It has same functionality by using "math.h" instead of "mathimf.h" if you build with Intel compiler. But if you use MS compiler, these math function will be built by microsoft defined math library, these math functions' performance will not be optimized. See this article.

2. There 's no function called j0() in MKL, it's actually defined in math.h/ mathimf.h. Intel MKL is mainly used for matrix/vector calculation. Even there might be any mkl data fitting function for bessel spline, it is actually built by compiler linked math lib. That means, if you build with icl, it will be linked with Intel math lib, if you build with MS, it will be linked with MS math lib. You could refer more info from MKL user guide.

3. For Intel math library, different math lib with different suffix will be linked under different mode. For instance, he libmmt.lib is linked for multi-threaded static library. Please view this link to learn.

Hope it would be useful to you. Thank you.

Best regards,
Fiona

0 Kudos
jj2007
Beginner
1,520 Views

Hi Fiona,

Thanks for your nice reply.

> 1. You do not need to worry ... these math functions' performance will not be optimized.

Good to know ;-)

> 2. There 's no function called j0() in MKL

But there is a MKL Special Functions page that (wrongly) gives that impression:

The Intel® Math Library supports the following special functions:

...

j0

Description: Computes the Bessel function (of the first kind) of x with order 0.

Calling interface:
double j0(double x);
long double j0l(long double x);
float j0f(float x);

Re 3., sure, but as stated in my initial post, I am using LoadLibrary & GetProcAddress, which works fine so far, even when used from a very exotic language ;-).

Again, thanks for your nice reply, really appreciated.

JJ

0 Kudos
Nikita_A_Intel
Employee
1,520 Views

Hello.

You are referring to a math library special functions page. This is Intel Compiler documentation, not Intel MKL. So the j0() is defined in the math library from Intel Compiler. Thus it would be libmmd.dll from Intel Compiler suite or from redistributables package that could be found here.

Thanks,
Nikita

0 Kudos
jj2007
Beginner
1,520 Views

Nikita Astafiev (Intel) wrote:
This is Intel Compiler documentation, not Intel MKL.

Thanks, Nikita. I was not aware of this subtle difference. The link to the redistributables helped me to realise that libmmd.dll is actually installed on my Win7-64 machine, so this works just fine:

    Dll "%CommonProgramFiles%\Intel\Shared Libraries\redist\ia32\compiler\libmmd.dll"
    Declare double j0, C:1
    Print Str$("Bessel J0(5)=%9f\n", j0(5.0)#)

For those interested: The Redistributable libraries page states "For the redistributable package of Intel C++ Professional Compiler for Windows, the installation directory is [Common Files]\Intel\Shared Files\cpp", where [Common Files] should actually read %CommonProgramFiles% as shown in the code snippet above.

There is a lot to discover here, thanks again ;-)

0 Kudos
Reply