Friday 5 March 2010

Installation of Code_Saturne 2.0-rc1 on Ubuntu 9.10

NEW - A post "Installation of Code_Saturne 2.0-rc1 on Ubuntu 10.04 (64 bit)" was recently published and recommended if you have already updated to Ubuntu 10.04.

NEW - On the Code_Saturne forum, David Monfort made very good and useful comments on this post. Please don't miss them.

Code_Saturne 2.0-rc1 is recently released (see the announce, from which all the source packages can be downloaded), and thanks to David's helpful comments on my previous post "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04", I quickly reviewed the installation procedure of this new release, 2.0-rc1. Probably, there can be some interesting points to share with you.

1. Regarding using apt-get to install HDF5 and MED libraries

As advised by David, I found it is easy to install HDF5 and MED by apt-get. libhdf5-dev is a virtual package provided by either one from these:
libhdf5-serial-dev
libhdf5-openmpi-dev
libhdf5-mpich-dev
libhdf5-lam-dev

I explicitly selected libhdf5-openmpi-dev to install. Additionally, hdf5-tools is also necessary to provide h5dump if want to manually compile MED.

$ sudo apt-get install libhdf5-openmpi-dev hdf5-tools

Regarding MED, libmedc-dev is the right one, which depends on another two packages: libmedc1 and libhdf5-serial-1.6.6-0.

sudo apt-get install libmedc-dev

apt-get actually installs slightly older versions of HDF5 and MED, 1.6.6 and 2.3.1, respectively. This is a drawback. More severely, when I 'configure' fvm and ecs, they complained about the old version.
MED >= 2.3.4 headers not found
compatible MED headers not found

Then I think I have to compile MED 2.3.6 by myself.

When trying to compile MED 2.3.6 with the apt-get installed HDF5, I passed the configure but blocked at the make stage.
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -DH5_USE_16_API -g -O2 -MT MEDchampCr.lo -MD -MP -MF .deps/MEDchampCr.Tpo -c MEDchampCr.c -fPIC -DPIC -o .libs/MEDchampCr.o
In file included from /usr/include/hdf5.h:24,
                 from ../../include/med.h:21,
                 from MEDchampCr.c:19:
/usr/include/H5public.h:54:20: error: mpi.h: No such file or directory
/usr/include/H5public.h:56:21: error: mpio.h: No such file or directory

I don't know why but I did install openmpi packages. Ok, since the old version got problems, I turned to compile them again.

2. Process to install 2.0-rc1

If compile the source code, I gladly found most part of the post "Installation of Code_Saturne 2.0.0 on Ubuntu 9.04" can also work well for 2.0-rc1, except the following points:

a. Metis got a confliction with '/usr/include/bits/mathcalls.h'. I am not familiar with this mathcalls.h, but I did a patch to avoid the confliction.
:~/saturne/metis-4.0$ make
(cd Lib ; make )
make[1]: Entering directory `~/saturne/metis-4.0/Lib'
cc -O2 -I. -c coarsen.c
In file included from ./metis.h:36,
                 from coarsen.c:13:
./proto.h:462: error: conflicting types for ‘__log2’
/usr/include/bits/mathcalls.h:145: note: previous declaration of ‘__log2’ was here
make[1]: *** [coarsen.o] Error 1
make[1]: Leaving directory `/home/salad/saturne/metis-4.0/Lib'
make: *** [default] Error 2

We can actually change the function name 'log2' to 'ilog2' in the related head files and source codes under the directory, Lib. The files include: proto.h, rename.h, kmetis.c, kvmetis.c, mkmetis.c and util.c.

You can download my patched version of Metis-4.0 from this link.

b. MEI is now compulsory to be prepared for the compilation of ncs.

It is not difficult to prepare MEI. Firstly, make sure all necessary packages are installed.
:/$ sudo apt-get install bison flex swig python-dev

Then the compilation is easy.

# ship into mei-1.0.1
:/$ ./configure --with-bft=/usr/local
:/$ make
:/$ sudo make install

Note that explicitly specifying --with-bft=/usr/local is necessary for Python to find bft.

c. Regarding ncs, remember to extract the patch file patches-portability-ncs-20rc1.tgz to the ncs directory. When 'configure' ncs, the option 'LIBS=-lm' can be ignored now. It was a bug existing in version 2.0.0-beta2.

# ship into ncs-2.0.0-rc1
:/$ ./configure --with-mpi=/usr/lib/openmpi --with-prepro=/usr/local --with-mei=/usr/local

Once again, an explicit --with-mei=/usr/local is necessary for the python modules.

d. Because there is no eps figure contained in the latex document directories any more, mentioned by David, package texlive-extra-utils is not necessary to install either. However, transfig is still necessary to provide the tool, fig2dev.

# for LaTeX documents
:/$ sudo apt-get install tetex-bin tetex-base transfig

To be honest tetex is already obsoleted from Ubuntu; texlive is much better and can be used instead. I get used to tetex, so I am still using it.

For those who don't use latex elsewhere, maybe installing these huge latex packages to compile Code_Saturne documents seems to be a waste. Don't worry. I prepare my compiled documents (pdf files) here for you to use directly. You can copy the pdf files into the directory /usr/local/share/doc/ncs to let Code_Saturne find them.

e. Before we use command 'cs config' to check the newly installed Code_Saturne status, and then in 2.0-rc1 version, the script 'cs' changes its name to 'code_saturne'.

:/$ code_saturne config

Probably one has to re-create his study and case configurations again with 2.0-rc1, because I tried to open an old xml file, which was previously produced by 2.0.0-beta2, with the SaturneGUI, and it complained that it seems to be for an old version.

3. Future work

The future work ideas are from the mentioned comments, and they include:

a. Different ATLAS packages are provided on Ubuntu for different CPU instruction sets, libatlas-base-dev, libatlas-3dnow-dev, libatlas-sse-dev and libatlas-sse2-dev etc. libatlas-base-dev is only a generic one and should work on every supported CPU architecture. Benchmark could be made to find a most optimised ATLAS package for a specific CPU.

b. MEI is expected to be a very useful feature. With help of MEI, some work, for which FORTRAN user routines have to be written in the past days, can be done by simply expressed formulae. Definitely it is interesting for me to try this.

c. CFDSTUDY is a plugin that allows Code_Saturne to be embedded in the Salome platform. Please read this. An integrated CFD environment can be imagined from this.

d. Last but not least, I tried to apt-get install code-saturne because I know Code_Saturne is already in Debian "unstable" depository. I guess making Code_Saturne available from apt-get might be an ultimate solution for people to install it easily.

salad@salad-desktop:~$ sudo apt-get install code-saturne
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package code-saturne is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package code-saturne has no installation candidate

This actually implies we have to work harder to make an easier life.

1 comment:

  1. In trading there are professionals who are dedicated to stripping money off you and you have to be diligent, disciplined and confident about your edge in the markets. Work hard and stay focused on keeping your edge.

    ReplyDelete