Monday 20 July 2009

Installation of Code_Saturne 1.3.3 on Ubuntu 9.04

Installation of Code_Saturne (CS for short) is a process of compiling. Therefore, before compile the code packages (download from EDF R&D), you are supposed to

1. Install necessary packages using apt-get. They are listed below:

# for compiling
:/$ sudo apt-get install build-essential gfortran libxml2 libxml2-dev
# for GUI
:/$ sudo apt-get install libx11-dev python-tk tix
# for LaTeX documents
:/$ sudo apt-get install tetex-bin tetex-base transfig texlive-extra-utils
# for openmpi (support for parallel computing)
:/$ sudo apt-get install openmpi-bin openmpi-dev libibverbs-dev
# for ATLAS mathematic library (check CPU flags first)
:/$ cat /proc/cpuinfo | grep flags
:/$ sudo apt-get install libatlas-headers libatlas-sse2-dev


2. Create and tidy a HOME directory for CS. I prefer mkdir a dir called Code_Saturne under my home directory.

:/$ mkdir Code_Saturne
:/$ cd Code_Saturne
:/$ mkdir Noyau Enveloppe Interface src

Unpack the downloaded install script package directly into "Code_Saturne" and a sub-dir "Install" will be created. Ship into Install and read through README.txt document. According to this document, we should

*. extract ncs package into Noyau
*. extract ecs package into Enveloppe
*. extract ics package into Interface
*. extract packages bft, fvm, hdf5, med, metis into directory src

(metis is only for parallel computing. hdf5 and med are only for supporting a MED file format. They are optional.)

3. Then we need some modifications on the source codes we extracted. These modification hints are all based on my experiences. Probably you won't encounter problems if you don't follow them, but I did. Therefore, I tried to solve the problems and recorded the solutions here.

*. For Noyau/ncs-1.3.3/bin/macros_Linux.mk, find the line

BLAS_LDFLAGS =-lcblas -latlas

add "-L$(BLAS_HOME) " to this line, like this:

BLAS_LDFLAGS =-L$(BLAS_HOME) -lcblas -latlas

*. In order to compile LaTeX documents, you need to Google and download a file named "lastpage.sty". Then copy it into the three directories under Noyau/ncs-1.3.3/doc/

:/$ cp lastpage.sty Noyau/ncs-1.3.3/doc/THEORY/latex/
:/$ cp lastpage.sty Noyau/ncs-1.3.3/doc/TUTORIAL/latex/
:/$ cp lastpage.sty Noyau/ncs-1.3.3/doc/USER/latex/

*. For src/hdf5-1.6.8/perform/zip_perf.c, change line 549 to

output = open(filename, O_RDWR | O_CREAT, S_IRWXU);

*. For src/med-2.3.4/include/MEDerreur.hxx, make it writable first

:/$ chmod u+w include/MEDerreur.hxx

and then add this line to the head of the file.

#include <cstring>


4. Modify the "setup" configuration file under the directory Code_Saturne/Install/. setup file defines which libraries will be used and which libraries will be compiled. Some of the libraries are optional, therefore by default, the initial setup file only configured compilation of bft, fvm, ecs, ics and ncs. I suggest to use additonal libraries blas, metis, mpi, hdf and med, because

*. blas can optimize the calculation speed.
*. metis and mpi enable the ability to perform parallel computing. If you use a dual core computer or a cluster, this is helpful to save lots of calculation time.
*. hdf and med give support to use the MED mesh file format. SALOME can export UNV and MED formats, but MED is smaller than UNV.

In order to use these libraries, setup file has to be configured manually.

*. Find the blas line and modify it into

blas   /usr/lib/sse2      atlas-3.8.2    yes   no

*. Find the metis line and modify it and the following 4 lines together into

metis  None   metis-4.0   yes   yes
mpi /usr/lib/openmpi openmpi-1.2.8 yes no
cgns None cgns-2.5.3 no no
hdf None hdf5-1.6.8 yes yes
med None med-2.3.4 yes yes


5. Finally, compile the whole package. Ship into Code_Saturne/Install/ and execute on terminal

./install_saturne.py

Then the automatic configuration and make process will start. The process needs a while to finish, depending on the power of the computer. Wait for ten minutes and see whether everything is fine and whether it finished successfully.

2 comments:

  1. hello, many thanks for this help but i've found a little error at the beginning
    in place of:
    :/$ sudo apt-get install build_essential

    i had to use:
    :/$ sudo apt-get install build-essential

    else everything is ok

    ReplyDelete
  2. Many thanks for your reminding me. It is a mistake. I have fixed it.

    I am glad to communicate experience.

    ReplyDelete