0
votes

I have this code, and I compiled it with MT and MD in the Fortran runtime library option. What I obtain is

10 runs with MD: 5.29 seconds in average

10 runs with MT: 6.5 seconds in average

Anyone has an idea about this difference? I think the results are supposed to be the same in this case, right?

program perform
  implicit none

  real x,y
  real*8 t1,t2

  integer i

  call cpu_time(t1)

  do i=1,1000000000
    x=sin(0.1)
    y=cos(0.2)
    x=asin(0.2)
    y=acos(0.5)
    x=tan(1.2)
  enddo

  call cpu_time(t2)

  print *,t2-t1
end program perform
1
hi, did you try to run the code? i know that MD uses DLLs version of runtime library and MT uses the static version, for me,this case seems incomprehensible,:( - user2136629

1 Answers

1
votes

MT is statically linked to the Fortran libraries. MD is dynamically linked. If you wish to distribute your program, with MT, you only need to supply the program. With MD, you need to supply the program and whatever Fortran DLLs it uses and whatever DLLs those DLLs use.

You can see the dependencies by running the program depends (from http://www.dependencywalker.com/). Just drop your MT version and see what DLLs it uses. Then drop the MD version and see what DLLs it uses.