As I want to implement Intel VML Functions from Intel MKL Library in a existing Software with more than 200 subroutines, I had performed a timing comparison test. The subroutines are written in Fortran90 and normally operate with arrays of size (10^6). I have implemented a test code for Multiplication using the do loop and the VML function vsmul(). Also i measured the timings for both do loop and VML fuctions. And results are VML function is slower than do loop.I am not sure whether my approach is correct or not.
So I want some comments on it.I read the post from other members , but there was not enough information .So i am asking it here again. I have read that Intel MKL libraries are faster, but I need to be pretty sure before changing the approach in 200 subroutines in my case.
My code is as Follows :
PROGRAM TIME
IMPLICIT NONE
INCLUDE 'mkl.fi'
INTEGER :: i = 1000000, L
REAL, DIMENSION (1000000) :: z, y, O, a
INTEGER :: t1, t2, t3, t4
call system_clock(t1)
call rand_ms(z,i)
call rand_ms(y,i)
call system_clock(t2)
DO L=1,i
a(L)=z(L)*y(L)
ENDDO
! Here I am using the do loop to calculate the timing for the ! multiplication of 2 arrays
call system_clock(t3)
call vsmul(i,z,y,O)
call system_clock(t4)
PRINT *, t2-t1, t3-t2, t4-t3
END PROGRAM TIME
! The following subroutine is meant to generate the Random numbers
! and those random numbers will be stored in an array.
subroutine rand_ms(vec,vecsiz)
INTEGER :: L, vecsiz
REAL, DIMENSION (vecsiz) :: z, vec
INTEGER, DIMENSION (2) :: seed = (/1,2/), k=1
REAL :: num
CALL RANDOM_SEED (PUT=seed)
DO L = 1, vecsiz
CALL RANDOM_NUMBER(num)
vec(L)=num
END DO
end subroutine
The output is as follows :
t3-t2 (Do loop) = 8 sec
t4-t3 (VML Function) = 49 sec