Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
29 Views

Intel Math Library

Jump to solution

The Intel C++ compiler requires one to include the header file: mathimf.h  so as to use Intel provided math functions. What does the FORTRAN compiler do? Does it use Intel math functions by default? Or do I have to do something to enable that?

Thanks!

0 Kudos

Accepted Solutions
Highlighted
29 Views

The Intel Fortran compiler uses the Intel math library if it provides the function, the C math library if it doesn't. You don't have control over this.

View solution in original post

0 Kudos
4 Replies
Highlighted
Black Belt
29 Views

I suppose there are several levels to this.

The documentation of mathimf is confusing, at least to me, but I don't think your characterization of it determining whether Intel C++ or C99 use Intel functions is accurate to a great extent.  You could examine your own calling .o by using nm to get more information.

ifort never calls any x87 long double functions, as gfortran real(10) would do, so that functionality of mathimf.h isn't relevant, and you can't call glibc long double functions from ifort.

There is a fairly complete set of Intel math functions, requiring at least SSE2, shared by ifort and icc, and you have no real choice about those being called by ifort in preference to those from glibc, which might be called if Intel math functions are missing, or with ifort -mia32.

Auto-vectorized math function calls are always to the Intel libsvml.   To some extent, you can over-ride default auto-vectorization choices by the fast-transcendentals option, as well as by -fp-math and no-vec settings.

There are both Intel math functions which make a choice of code path according to CPU architecture at run time, and those which don't switch at run time, invoked by -fimf-arch-consistency, 

Most of these work the same with Intel Fortran and C++.

0 Kudos
Highlighted
Novice
29 Views

I did nm my output (attached) once with mathimf.h and once with math.h . There is no difference.

I am calling a sine function inside, so there is something that uses the math library.

0 Kudos
Highlighted
30 Views

The Intel Fortran compiler uses the Intel math library if it provides the function, the C math library if it doesn't. You don't have control over this.

View solution in original post

0 Kudos
Highlighted
29 Views

Dear Intel Developers Community,

An issue relative to control on math lib to be used. Situation:

1. When a compiled fortran code is executed, the computation time is T

2. When this same fortran code is transformed as a dynamic lib of a C++ application, the execution is 5*T.

It was identified that cos() calls in the fortran code were responsible for that performance downgrade:

in situation 1, it is cos() of lib libimf.so ​that is called.

In situation 2, is is cos() of lib libm.so.6 that is called

How to keep control on Library to be used in situation 2?

BR

Gael.

 

 

 

 

0 Kudos