*NIX platforms
From MohidWiki
This is a tutorial on how to install MOHID in linux and derived other platforms. To complement this tutorial, you can also check out some video tutorials in the Codeplex article.
Contents
Installing
Prerequisites
NOTE: this article was written assuming the fortran compiler is Intel. If this is not the case then change where there is written "ifort" with the fortran compiler in use (ex: pgf90, g90, etc...).
HDF5 libraries
To compile Mohid it is mandatory to have the HDF5 [1] libraries compiled. In HDF5's web page it is possible to obtain both binary distribuitions and the source code. Most of the times it is necessary to build from source which takse the following steps:
- download the source code, e. g. hdf5-1.6.5.tar.gz;
-
> tar -zxvf hdf5-1.6.5.tar.gz
-
> cd hdf5-1.6.5
-
> F9X=ifort ./configure --enable-fortran (--prefix=$HDF5ROOTDIR --enable-parallel)
-
> make
-
> make check
-
> make install
Libraries may be found in ./hdf5/lib/ and, typically, in /opt/hdf5/hdf5/lib. Detailed information may be found in file ./release_docs/INSTALL .
Zlib libraries
To use the HDF5 libraries it is mandatory to have installed the zlib libraries. So install the zlib package for your linux distro. Also, keep a record of where the libz.a library is installed (it might come in handy later on).#
Netcdf libraries
The netcdf libraries are optional since they are not required to run MohidWater. However they are useful for other modules of the Mohid Suite such as ConvertToHDF5. You can get them from the official site. Here's the report on how to build them for windows.
Building MohidWater
To compile MohidWater using the makefiles from the main path, execute the compilation steps:
-
> for i in `find . | grep .f90 | grep -v 'GOTMvar'`; do mv $i `echo $i | sed -e 's/f90/F90/'`;done
-
> source /opt/intel/fc/9.0/bin/ifortvars.sh
-
> make Nix
The first line is required in order to properly configure intel fortran 9.0 to work. It may be unnecessary in future versions of intel fortran.
To clean the distribution, type:
-
> make Nix.clean
NOTE: For the latest intel fortran code version you get:
> source /opt/intel/Compiler/11.0/074/bin/intel64/ifortvars_intel64.sh
Running Mohid projects in linux
General guidelines that change from windows
- There are no graphical interfaces available. No GUI, no PostProcessor and no GIS.
- Linux is case-sensitive. This is very important.
- Linux reads paths to files and folders using the slash '/' instead of the backslash '\'.
Required files for mohidwater to run (preserve letters capitalization!). You must copy (and edit) the files manually:
exe/nomfich.dat exe/Tree.dat
TroubleShooting
Q: the makefile keeps giving me errors :(
A:Here's a list of what could be causing these errors:
- Open the makefiles and check that fields are properly filled.
- Make sure that mod and bin directories exist in the module's folder. Otherwise simply make them with the mkdir command.
- Make sure that "ifort" is a valid command. If it isn't then you probably didn't loaded its environment variables. Type "source /opt/intel/fc/9.0/bin/ifortvars.sh" for that.
- Make sure that the intel fortran compiler was properly installed.
Q: the makefile complains when compiling ModuleGOTM.f90
A: Probably you have to rename
- GOTMVariables_in.f90 ---> GOTMvariables_in.f90
- GOTMVariables_out.f90 ---> GOTMvariables_out.f90.
This error shows up in linux because it's case-sensitive whereas windows isn't. Also, make sure that the extension is written in lower case.
Q: By the time i'm linking the final MohidWater binary I get some error about unreferenced functions "compress2" and others in HDF5 files...
A: Probably you need to specify to link against the libz.a library. Identify the exactly the location of libz.a (ex: in my system it can be found at /opt/zlib/lib/libz.a) then add the following line in MohidWater makefile:
LIBS_NIX = \ $(BASE2LIB) \ $(BASE1LIB) \ $(LIB_HDF5_NIX)/libhdf5_fortran.a \ $(LIB_HDF5_NIX)/libhdf5.a \ $(LIB_HDF5_NIX)/libhdf5_hl.a \ $(LIB_NETCDF_NIX)/libnetcdf.a \ /opt/zlib/lib/libz.a