Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
56 Views

Floating Point Exception in vectorized pow function

 

Hi,

The following code fails with a Floating Point (Inavlid) Exception in __svml_powf4_l9 ()
 

      program powtest

          real s(1601)
          real power
          integer iz
          integer nz
          real dz
          character*16 out
          integer i

          power = 2.0
          nz = 1601
          dz = 5

          i = ieee_flags('set', 'exception', 'invalid', out)    !

          do iz = 1, nz
              z = (iz-1)*dz*.005
              s(iz) = z**power
          enddo

          print * , maxval(s)

      end

My processor is a Intel(R) Xeon(R) CPU E3-1240 v3 on Debian GNU/Linux 9.4

The FPE goes away if I compile with -fp-model consistent that looks like it is preventing the loop from being vectorized.

LOOP BEGIN at pow.f90(21,11)
   remark #15527: loop was not vectorized: function call to powf cannot be vectorized   [ pow.f90(23,24) ]
LOOP END

Or if I pass the -fpe0 flag to the compiler. This has the same effect for a different reason:

 remark #15335: loop was not vectorized: vectorization possible but seems inefficient. Use vector always directive or -vec-threshold0 to override

It looks to me that something goes wrong with the vectorized version of the pow function. Any ideas?

0 Kudos
3 Replies
Highlighted
Moderator
56 Views

I can reproduce what you see in the 19.0.0, 19.0.1, and 19.0.2 compilers.  It seems fixed in 19.0.3 which is 2019 Update 3.  

what version of the compiler are you using?

0 Kudos
Highlighted
Beginner
56 Views

Greetings Ronald,

I was using 18.0.5 but can confirm that the problem is fixed in 19.0.3. Thanks a lot for that.

I am a bit surprised though that there was a bug in svml in such a fundamental computation and how this has endured so many version updates.

If you could share some more details on what was the problem I would be curious.

 

 

 

 

0 Kudos
Highlighted
Beginner
56 Views

Hi Ronald,

I am seeing similar issue in log function  _svml_clogf4_l9 () that seems to persist in 19.0.3

Can this be looked into.

 

 

0 Kudos