GiD - The personal pre and post processor

Compiling the library and examples

GiDPost can be build as library to be linked into the calculation program or as python module (look into As python module ).

This page explains how to build gidpost as library to be linked to you program.

 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 install the required packages in Linux just do the following as root:
Ubuntu (Debian and the like):

apt-get install zlib1g-dev libhdf5-dev libhdf5-hl-100   ;# version number depends on linux distribution and version
apt-get install hdf5-tools hdf5view                     ;# recommended tools to manage and look into hdf5 files

Scientific Linux (Redhat and the like):

yum install zlib-devel.x86_64 hdf5-devel.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     ;# by default the package 'libhdf5-dev' installs the -serial version


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 (Linux - nvidia hpc sdk ):



First, remember to add the environment variables to your $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

Once done, log in again and:
$ 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


COPYRIGHT © 2022 · GID · CIMNE