Fortran: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 13: Line 13:


MS VS -> Project -> Properties -> Fortran -> General -> Additional Include Directories ('''C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\ia32''')
MS VS -> Project -> Properties -> Fortran -> General -> Additional Include Directories ('''C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\ia32''')
MS VS -> Project -> Properties -> Linker -> Input -> Additional Dependencies (mkl_lapack95.lib for w32 and mkl_lapack95_lp64.lib for x64)


I also ALREADY have set up MS VS -> Tools -> Options -> Intel Visual Fortran -> Compilers.
I also ALREADY have set up MS VS -> Tools -> Options -> Intel Visual Fortran -> Compilers.

Revision as of 11:21, 18 November 2015

Using IMSL library

The Fortran code includes

USE Numerical_Libraries

My IMSL library is installed under C:\Program Files (x86)\VNI\imsl\fnl600 directory.

Using MKL Lapack library

I have installed Visual Studio 2010 and Intel Fortran Compiler XE 12.0.

For some reason, I need to follow this instruction to make it work.

MS VS -> Project -> Properties -> Fortran -> General -> Additional Include Directories (C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\ia32)

MS VS -> Project -> Properties -> Linker -> Input -> Additional Dependencies (mkl_lapack95.lib for w32 and mkl_lapack95_lp64.lib for x64)

I also ALREADY have set up MS VS -> Tools -> Options -> Intel Visual Fortran -> Compilers.

  • Libraries
$(IFortInstallDir)compiler\lib\ia32
$(IFortInstallDir)mkl\lib\ia32
$(VCInstallDir)atlmfc\lib
$(VCInstallDir)lib
$(WindowsSdkDir)lib
$(FrameworkSDKDir)\lib
$(FNL_DIR)\IA32\lib
  • Includes
$(IFortInstallDir)compiler\include
$(IFortInstallDir)compiler\include\ia32
$(IFortInstallDir)mkl\include\ia32
$(VCInstallDir)atlmfc\include
$(VCInstallDir)include
$(WindowsSdkDir)include
$(FrameworkSDKDir)\include
$(FNL_DIR)\IA32\include\dll

The Fortran code does NOT even need to include the following line (??)

USE MKL95_LAPACK

and in fact, including the following line will result in an error.

USE MKL95_LAPACK, only : DGESVD

The mkl\include folder contains *.mod files and mkl\lib folder include *.lib files.

Misc

Change stack size

In Compaq Visual Fortran, go to Project Settings -> Win32 Release -> Link. In the Project Options text box, add something like /stack:0x989680 (the decimal value is 10000000 or 10MB).

Timing

system_clock tells the elapsed wall time between two successive calls.

integer(kind=8):: tclock1, tclock2, clock_rate
real(kind=8):: elapse_time

call system_clock(tclock1)

<code to be timed>

call system_clock(tclock2, clock_rate)
elapse_time = float(tclock2 - tclock1) / float(clock_rate)

cpu_time tells the CPU time used between two successive calls

real(kind=8):: t1, t2, elapsed_cpu_time
call cpu_time(t1)

<code to be timed>

call cpu_time(t2)
elapsed_cpu_time = t2 - t1

Since Unix provides a timing command called time, we can compare the system time and cpu time reported by Fortran's functions and Unix's time command; e.g. time ./a.out where a.out is the executable file written by a Fortran code. See an example from the High Performance Scientific Computing (University of Washington); the web lecture and the video lecture.