Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1 View

what is __libm_error_support and why does it take so much time

I am developing a FORTRAN code where the exponent function (exp) takes substantial time.

Its profile shows that __libm_error_support takes almost the same time as exp.

Can I specify some option to avoid this subroutine? What does it do exactly?

I tried to specify -fno-math-errno on the critical modules but it did not help.

Also, what is exp.L and is there a faster version of exp? Small numbers

near zero (underflow) etc are no problem for my application, if they are computed

exactly or set to 0.

time   seconds   seconds    calls  Ts/call  Ts/call  name
  8.75     21.82    21.82                             exp.L
  8.29     42.50    20.68                             mkl_lapack_dlaed4
  7.72     61.74    19.24                             LN8_M4_Kgas_1
  6.30     77.45    15.71                             __libm_error_support

...

  1.00    164.35     2.50                             exp


I am using ifort 14.0 (cannot upgrade as free compiler is no longer provided).

-------------------

Continuing the soliloquy, I have wormed into this problem with the following results.

1. The offending __libm_error_support is found in Intel's libimf library.

2. I found the source code of libm_error_support.c on the Internet and got some

idea of what it is about.

3. libm_error_support seems to be called when some error or error-like situation

arises. In my case, it was an underflow, like exp(-x) for a large x. libm_error_support

is called for each such call to exp, whereas when x is not a problem (for example,

when it is 1.0), libm_error_support is not called.

4. I was not able to find a compiler option to prevent libm_error_support from being called.

It is a waste to call it internally as it does nothing useful (for me).

5. I was able to improve the efficiency of my code by doing an "if",

like if(x>100) res=0; else res=exp(-x). In my case it worked marvelously, because

I do not have something like exp(-1000)*exp(1000), which would be ruined by the if.

In my code, exp is used like s=s+exp(-x), so neglecting small values is fine.

 

Summarizing I solved my problem and obtained a substantial boost of efficiency.

I find it very strange that I could not find any human-readable description on libm_error_support,

what it does, when it is called and how to prevent it being called.

 

 

 

 

0 Kudos