Fortran: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
= Using IMSL library = | |||
The Fortran code includes | |||
<syntaxhighlight lang='fortran'> | |||
USE Numerical_Libraries | |||
</syntaxhighlight> | |||
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 [https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/293545 this instruction] to make it work. | |||
MS VS -> Project -> Properties -> Additional Include Directories ('''C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\ia32''') | |||
I also ALREADY have set up MS VS -> Tools -> Options -> Intel Visual Fortran -> Compilers. | |||
* Libraries | |||
<pre> | |||
$(IFortInstallDir)compiler\lib\ia32 | |||
$(IFortInstallDir)mkl\lib\ia32 | |||
$(VCInstallDir)atlmfc\lib | |||
$(VCInstallDir)lib | |||
$(WindowsSdkDir)lib | |||
$(FrameworkSDKDir)\lib | |||
$(FNL_DIR)\IA32\lib | |||
</pre> | |||
* Includes | |||
<pre> | |||
$(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 | |||
</pre> | |||
The Fortran code does NOT even need to include the following line (??) | |||
<syntaxhighlight lang='fortran'> | |||
USE MKL95_LAPACK | |||
</syntaxhighlight> | |||
and in fact, including the following line will result in an error. | |||
<syntaxhighlight lang='fortran'> | |||
USE MKL95_LAPACK, only : DGESVD | |||
</syntaxhighlight> | |||
The '''mkl\include''' folder contains *.mod files and '''mkl\lib''' folder include *.lib files. | |||
= Misc = | = Misc = | ||
== Change stack size == | == Change stack size == | ||
Revision as of 16:21, 16 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 -> Additional Include Directories (C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\include\ia32)
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.