All platforms:
Third part libraries:
- zlib: it is necessary previously obtain or compile the zlib compression library (www.zlib.net)
- hdf5: this library is optional www.hdfgroup.org. Required only to write postprocess files with this format (files opened with GiD_PostHDF5=3 flag)
To build GiDPost as Python module you'll need:
- python3
- SWIG: (Simplified Wrapper and Interface Generator) a tool used to connect C or C++ code with scripting languages like python. https://www.swig.org/
To install the required packages in Linux just do the following as root:
Ubuntu (Debian and the like):
apt-get install zlib1g-dev libhdf5-serial-dev apt install python3 swig
Scientific Linux (Redhat and the like):
yum install zlib-devel.x86_64 hdf5-devel.x86_64 yum install python3.x86_64 swig.x86_64
Note:
Bear in mind that there are several hdf5 development packages and that you should choose the right for you.
For instance, in Ubuntu these are the HDF5 development packages available:
libhdf5-mpi-dev libhdf5-mpich-dev libhdf5-openmpi-dev libhdf5-serial-dev
And in Scientific Linux the HDF5 development packages available:
hdf5-devel.x86_64 hdf5-mpich-devel.x86_64 hdf5-openmpi.x86_64
Required third part tool:
- CMake: The CMake tool (www.cmake.org) is used to have a cross-platform build system.
Must download and install this program to compile gidpost.lib (gidpost.a on Linux).
To use the graphical interface of cmake use cmake-gui or ccmake .
Note: For MS Visual Studio a project obtained from CMake is also included in the distribution, to avoid the requirement of install CMake.
Note: Users that don't want to use CMake could also manually create off course its own makefile for Unix/Linux or its own compiler project.
All the source code to generate the library is included, it can be compiled in other platforms.
The third party code, "cfortran.h", is also provided as a link between C and FORTRAN. It has its own distribution policy. Please, read the file "cfortran.doc" about the licence terms of this code.
Precompiled version:
The 'binaries' folder stores precompiled release versions of the library for Windows and Linux (x32 and x64 platforms), to avoid the requirement of compile them.
Compiling gidpost:
to compile the gidpost library using the command line:
How to build (Linux - gcc):
$ cd .../gidpost $ mkdir build-linux $ cd build-linux $ cmake -DHDF5=ON -DBUILD_FORTRAN_EXAMPLES=ON .. ;# gfortran is needed to BUILD_FORTRAN_EXAMPLES (by default it's off) $ make $ cd examples $ ./testc -help ;# to view format options $ ./testc -f hdf5 ;# to write a gid post file in hdf5 format $ ./testf90 ;# fortran 90 example writing hdf5 gid post file
How to build python module (Linux):
Once you have configured and buil the GiDPost library, then:
$ cd .../gidpost/gidpost-swig/ $ make $ make test
How to build (Linux - nvidia hpc sdk ):
$HOME/.bashrc
:$ NVARCH=`uname -s`_`uname -m`; export NVARCH $ NVCOMPILERS=/opt/nvidia/hpc_sdk; export NVCOMPILERS $ MANPATH=$MANPATH:$NVCOMPILERS/$NVARCH/23.5/compilers/man; export MANPATH $ PATH=$NVCOMPILERS/$NVARCH/23.5/compilers/bin:$PATH; export PATH
$ cd .../gidpost $ mkdir build-linux $ cd build-linux $ cmake -DHDF5=ON -DBUILD_FORTRAN_EXAMPLES=ON \ -DMAKE_CXX_COMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/bin/nvc++ \ -DMAKE_C_COMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/bin/nvc \ -DMAKE_Fortran_COMPILER=/opt/nvidia/hpc_sdk/Linux_x86_64/23.5/compilers/bin/nvfortran \ .. ;# you can also use 'ccmake/cmake-gui ..' with 'Advanced options' enabled. $ make $ cd examples $ ./testc -help ;# to view format options $ ./testc -f hdf5 ;# to write a gid post file in hdf5 format $ ./testf90 ;# fortran 90 example writing hdf5 gid post file
For the graphical interface of cmake use cmake-gui or ccmake .
e.g. for Windows, to compile with Microsoft Visual Studio 2005, fill in
Where is the source code: C:/gid project/gidpost
Where to build the binaries: C:/gid project/gidpost/win/vs2005
and press "Configure"
select generate a project of "Visual Studio 8 2005", "use default native compilers"
then some errors appear (lines in red)
select GIDPOST_USE_SYSTEM_ZLIB and press "Configure"
then must specify the path to the zlib include and the zlib library
(zlib must be compiled previously using its own mechanism, or get it precompiled)
To add HDF5 extra features the HDF5 library must be compiled using its own mechanism, or get it precompiled
and then set in Cmake the values pointing to its include directory and library
press Configure, and then in 'Ungrouped Entries' appear HDF5, select it to be used.
and press Configure once more
Finally in the CMake tree, for Visual Studio is preferred instead /MD the flag /MT (to avoid dependencies of MSCVRTxxx.dll)
and instead /MDd /MTd for the debug version
Press Configure, and then "Generate", to create the VS project, then the project is created
C:\gid project\gidpost\win\vs2005\gidpost.snl and can be opened with Visual Studio