Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

bug of sgemm, 2015 mkl gives wrong result, but 2013 gives correct

$
0
0

The compile option of 2015:

/work1/soft/intel2015/composer_xe_2015.0.090/bin/intel64/ifort -i8 -openmp main.f90 -o i64_2015 -L /work1/soft/intel2015/composer_xe_2015.0.090/mkl/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -Wl,-rpath /work1/soft/intel2015/mkl/lib/intel64

The option of 2013

/work1/soft/intel/composer_xe_2013.0.079/bin/intel64/ifort -i8 -openmp main.f90 -o i64_2013 -L /work1/soft/intel/composer_xe_2013.0.079/mkl/lib/intel64/ -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -Wl,-rpath /work1/soft/intel/composer_xe_2013.0.079/mkl/lib/intel64

 

The 2013 gives 2.0000, but 2015 gives 0.000

The code is shown below

program testi8
  implicit none
  integer,parameter :: REL = 4
  integer,  parameter :: num  = 2500000000, one = 1
  real(REL),dimension(:,:),allocatable :: a, b, c
  integer :: i, j

  print*, "allocate arrays..."
  allocate(a(1, num ), b(num, 1), c(1,1))
  a = 0.0_REL
  b = 0.0_REL
  c = 0.0_REL

  print*, "value arrays..."
  do i = 1, num
     if(i.eq.1) then
        a(1,1) = 1.0_REL
     else if(mod(i, 2).eq.0) then
        a(1, i) = 1.0_REL
     else
        a(1, i) = -1.0_REL
     end if
     b(i, 1) = 1.0_REL
  end do

  call sgemm('n', 'n', one, one, num, 1.0_REL, a, one, b, num, 0.0_REL, c, one)

  print*, "result"
  print*, c

end program testi8

 

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>