Personal tools

Difference between revisions of "Compiling with IFC 11"

From MohidWiki

Jump to: navigation, search
(Creating a new project)
 
(35 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
== Creating a new project ==
 
== Creating a new project ==
#Make sure you have installed in your computer Microsoft Visual Studio 2008 and Intel Fortran Compiler 11.0. If you don’t have both installed, please install them.
+
#Make sure you have installed in your computer Microsoft Visual Studio 2008 and Intel Fortran Compiler 11.1. If you don’t have both installed, please install them.
 +
#Make sure you have downloaded the last version of the code and solutions from codeplex ([[CodePlex]] or http://mohid.codeplex.com) for example via tortoise software.
 +
#Your folder structure will look like this after the download: [[Image:CodePlexFolderStructure.png|425px|thumb|center|CodePlex local folder structure]]
 
#Open Microsoft Visual Studio 2008.  
 
#Open Microsoft Visual Studio 2008.  
#Select '''"New Project"'''.
+
#Open the solution from the CODEPLEX structure above under folder > Solutions > VisualStudio2008_IntelFortran11
#Select Intel® Visual FORTRAN Projects and '''"Console Application"''' . Select an empty project and name the project, for example, "MohidWater". Select the location and Click OK.
+
#All the setting are already done.
#An empty project is created. Get all FORTRAN code files from SourceSafe and add them to the project. Right-click in the Source Files folder (in the project tree), and select "Add...Add Existing Item...". Add all the files containing the [[modules]].
 
#Get all the libraries needed from source safe in Libs\IntelFortran11.x (by F®ank). Note that the Intel compiler use different HDF5 libraries than the Compaq compiler.
 
  
== Release and Debug settings ==
+
== Build Solution ==
Please follow the steps below and set them EXACTLY as they are presented. Do not make additional changes in the settings unless you’re testing some optimizations. Note that settings under "Debug" and "Release" configurations are slightly different. You can select "Release" configuration and apply this settings first and then do the same for "Debug" configuration or select "All configurations".
+
#Select "Build...Build Solution"
 +
 
 +
== Build Solution in x64 ==
 +
 
 +
=== Pre-requisite ===
 +
If it is the firt time you build for the x64 architecture, then you must first install the x64 platform on Visual Studio 2008.
 +
# Close any opened instance of Visual Studio 2008.
 +
# Load the dvd iso file of Visual Studio 2008 (found in \\kepler\Software\VS2008\VisualStudio_Pro_2008_Eng.iso) with the [http://www.daemon-tools.cc/eng/home Daemon Tools] utility. This will install a "virtual" dvd drive with Visual Studio 2008 loaded in your system files.
 +
# Go to ''Control Panel --> Uninstall or change a program --> Microsoft Visual Studio 2008 Professional Edition --> Double click(win 7)|Add/Repair(win xp)''.
 +
# Install the ''x64 Compiler tools'' from the Visual Studio 2008 dvd.[[Image:VisualStudiox64.png|600px|thumb|center|Visual Studion 2008 Installation Options]]
 +
# Open a new instance of Visual Studio 2008. Then select ''Tools --> Options --> Intel Visual Fortran --> Compilers --> Platforms''. If the installation went ok, you should see a ''x64'' platform. Select it and then click ''ok''. You are now able to select and compile any configuration of Intel Fortran projects with the x64 platform. [[Image:Verifying-x64-architecture-is-available-IFC-VS2008.PNG|600px|thumb|center|Verifying the x64 architecture in Visual Studio project is available]].
  
#Now select "Project...Properties" and start editing your compilation settings.
+
=== Building Solution in x64 ===
#In "Fortran...General", set "Supress Startup Banner" to '''"Yes"''', define the path to the folder where the HDF5 libraries will be placed in the "Additional Include Directories" text box (local folder of Libs\IntelFortran11.x\HDF_1.6.8\Include from source safe). Also set "Optimization" to '''"Maximize Speed plus Higher Level Optimizations"'''.
+
# Select the [[Visual Studion Configuration|configuration]] of choice (Debug, Release, Release Double, etc...).
#In "Fortran...Optimization" define "I/O Buffering" to '''Yes'''.
+
# Select the [[Visual Studio Platform|platform]] x64. [[Image:X64-platform-in-vs2008.PNG|600px|thumb|center|Selecting the x64 archicture in a Visual Studio project]]
#In "Fortran...Preprocessor" set "Preprocessor Source File" to '''Yes''' and define again, in the Additional Include Directories text box, the path to the folder where the HDF5 libraries will be placed (local folder of Libs\IntelFortran11.x\HDF_1.6.8\Include from source safe).
+
# If the configuration isn't well configured please configure it as described below. Select ''Build''... ''Build Solution''.
#In "Fortran...Diagnostics", set "Warn For Non-Standard Fortran" to '''"Fortran 95"'''. Also, set the "Warn For Undeclared Symbols" to '''"Yes"''', "Warn For Unused Variables" to '''"Yes"''' and "Warn When Truncating Source Code Line" to '''"Yes"'''.
 
#In "Linker...General", set "Enable Incremental Link" to '''"No"''' and "Supress Startup Banner" to '''"Yes"'''. In the Additional Include Directories text box, set the path to i) the folder where the HDF5 libraries will be placed (local folder of Libs\IntelFortran11.x\HDF_1.6.8\Lib) ii) the folder where the SZlib libraries will be placed (local folder of Libs\IntelFortran11.x\SZlib_2.1\dll) and iii) the folder where the Zlib libraries will be placed (local folder of Libs\IntelFortran11.x\Zlib_1.2\dll). Note that the 3 paths are separated by ''';'''
 
#In "Linker.. Input", write down the names of the libraries in the "Additional Dependencies" text box. The names for the 2008 Visual Studio integration are:
 
'''hdf5.lib  hdf5_fortran.lib hdf5_f90cstub.lib zlib1.lib szlibdll.lib'''
 
  
== Specific Debug settings ==
+
==== Manually configuring a project configuration to build with x64 Hdf5 1.8.6 libraries. ====
Select the "Debug" configuration and change the following settings groups:
+
These instructions are prepared for the MohidWater in the ''Release'' configuration for the ''x64'' platform, but the same steps can be reproduced for MohidLand and MohidRiver. Insert the text in bold in the yellow areas in your project as signaled in the images below.
#In "Fortran...General", ser "Debug Information Format" to '''"Full"''' and "Optimization" to '''"Disable"'''.
+
* MohidBase1: '''..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\include\fortran; ..\..\..\..\ExternalLibs\Proj4\Include'''
#In "Fortran...Optimization", set "Optimization" to '''"Disable"'''.
+
[[Image:Properties-Fortran-AdditionalIncludeDirectories.PNG|600px|thumb|center|''..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\include\fortran; ..\..\..\..\ExternalLibs\Proj4\Include'']]
#In "Linker.. Input", in "Ignore Additional Libraries" write down '''LIBCMT.lib'''
+
* MohidBase2: '''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release'''
 +
[[Image:Properties-Fortran-AdditionalIncludeDirectories.PNG|600px|thumb|center|''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release'']].
 +
* MohidWater: '''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release;'''
 +
'''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release;'''
 +
'''..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\lib'''
 +
[[Image:Properties-Fortran-AdditionalIncludeDirectories.PNG|600px|thumb|center|''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release;
 +
..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release;
 +
..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\lib'']]
 +
'''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release; ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release'''
 +
[[Image:Properties-Linker-General-AdditionalLibraryDirectories.PNG|600px|thumb|center|''..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release; ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release'']]
 +
'''MOHIDBase1.lib MOHIDBase2.lib hdf5.lib  hdf5_fortran.lib hdf5_f90cstub.lib zlib.lib libszip.lib''' in ''Additional Dependencies'' and '''msvcrt.lib''' in ''Ignore Specific Libraries''
 +
[[Image:Properties-Linker-Input-AdditionalDependencies.PNG|600px|thumb|center|''MOHIDBase1.lib MOHIDBase2.lib hdf5.lib  hdf5_fortran.lib hdf5_f90cstub.lib zlib.lib libszip.lib'' in ''Additional Dependencies'' and ''msvcrt.lib'' in ''Ignore Specific Libraries'']]
  
== Build Solution ==
+
=== Present limitations for building some Mohid tool in x64 architecture in Windows ===
#Select "Build...Build Solution"
+
* Currently, only the Hdf5 1.8.6 libraries in 64bits are available in the [[codeplex]]. The [[Proj4]] and the [[netcdf]] libraries in 64bits are currently unavailable on the [[codeplex]]. This affects namely the [[ConvertToHdf5]], [[Convert2netcdf]] and [[ConvertToXYZ]] tools.
  
 
== Optional compilation settings ==
 
== Optional compilation settings ==
Line 49: Line 66:
 
  '''_GUI_'''              includes GUI code
 
  '''_GUI_'''              includes GUI code
  
 +
A more thorough explanation can be found on [[compilation preprocessor settings]]
  
 
[[Category:Programming]]
 
[[Category:Programming]]
 
[[Category:Compiling]]
 
[[Category:Compiling]]
 
 
[[Compiling with IFC 11 Delete]]
 

Latest revision as of 18:03, 23 May 2012

Please follow these instructions step by step and until the end:

Creating a new project

  1. Make sure you have installed in your computer Microsoft Visual Studio 2008 and Intel Fortran Compiler 11.1. If you don’t have both installed, please install them.
  2. Make sure you have downloaded the last version of the code and solutions from codeplex (CodePlex or http://mohid.codeplex.com) for example via tortoise software.
  3. Your folder structure will look like this after the download:
    CodePlex local folder structure
  4. Open Microsoft Visual Studio 2008.
  5. Open the solution from the CODEPLEX structure above under folder > Solutions > VisualStudio2008_IntelFortran11
  6. All the setting are already done.

Build Solution

  1. Select "Build...Build Solution"

Build Solution in x64

Pre-requisite

If it is the firt time you build for the x64 architecture, then you must first install the x64 platform on Visual Studio 2008.

  1. Close any opened instance of Visual Studio 2008.
  2. Load the dvd iso file of Visual Studio 2008 (found in \\kepler\Software\VS2008\VisualStudio_Pro_2008_Eng.iso) with the Daemon Tools utility. This will install a "virtual" dvd drive with Visual Studio 2008 loaded in your system files.
  3. Go to Control Panel --> Uninstall or change a program --> Microsoft Visual Studio 2008 Professional Edition --> Double click(win 7)|Add/Repair(win xp).
  4. Install the x64 Compiler tools from the Visual Studio 2008 dvd.
    Visual Studion 2008 Installation Options
  5. Open a new instance of Visual Studio 2008. Then select Tools --> Options --> Intel Visual Fortran --> Compilers --> Platforms. If the installation went ok, you should see a x64 platform. Select it and then click ok. You are now able to select and compile any configuration of Intel Fortran projects with the x64 platform.
    Verifying the x64 architecture in Visual Studio project is available
    .

Building Solution in x64

  1. Select the configuration of choice (Debug, Release, Release Double, etc...).
  2. Select the platform x64.
    Selecting the x64 archicture in a Visual Studio project
  3. If the configuration isn't well configured please configure it as described below. Select Build... Build Solution.

Manually configuring a project configuration to build with x64 Hdf5 1.8.6 libraries.

These instructions are prepared for the MohidWater in the Release configuration for the x64 platform, but the same steps can be reproduced for MohidLand and MohidRiver. Insert the text in bold in the yellow areas in your project as signaled in the images below.

  • MohidBase1: ..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\include\fortran; ..\..\..\..\ExternalLibs\Proj4\Include
..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\include\fortran; ..\..\..\..\ExternalLibs\Proj4\Include
  • MohidBase2: ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release
..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release
.
  • MohidWater: ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release;

..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release; ..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\lib

..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release; ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release; ..\..\..\..\ExternalLibs\HDF5_1.8.6_x64\lib

..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release; ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release

..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase1\x64\Release; ..\..\..\..\Solutions\VisualStudio2008_IntelFortran11\MOHIDNumerics\MOHIDBase2\x64\Release

MOHIDBase1.lib MOHIDBase2.lib hdf5.lib hdf5_fortran.lib hdf5_f90cstub.lib zlib.lib libszip.lib in Additional Dependencies and msvcrt.lib in Ignore Specific Libraries

MOHIDBase1.lib MOHIDBase2.lib hdf5.lib hdf5_fortran.lib hdf5_f90cstub.lib zlib.lib libszip.lib in Additional Dependencies and msvcrt.lib in Ignore Specific Libraries

Present limitations for building some Mohid tool in x64 architecture in Windows

Optional compilation settings

  1. To perform optional compilation, just add the compilation pre-processor keywords in "Properties...Fortran...PreProcessor", in the "Preprocessor Definitions" text box.

Exclude modules

Some modules can be completely excluded from compilation. If your simulations do not use these modules you can use this pre-processor keywords.

_LAGRANGIAN_	   excludes Modules Lagrangian + Jet + Oil
_AIR_	           excludes Modules InterfaceWaterAir + Atmosphere
_WAVES_	           excludes Module Waves
_SEDIMENT_	   excludes Modules SedimentProperties + Consolidation

Other options

Other keywords can also be used.

_USE_MPI           includes MPI code
_SHORT_LINE_LENGTH sets line_length = 64  (default line_length is 256)
_LONG_LINE_LENGTH  sets line_length = 1024(default line_length is 256)
_GUI_              includes GUI code

A more thorough explanation can be found on compilation preprocessor settings