Sunday, 16 August 2009

Installation of Code_Saturne 2.0.0 on Ubuntu 9.04

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.

Code_Saturne version 2.0.0-beta2 was released at the beginning of this August. Since the user routines were changed into FORTRAN95 (.f90 extension) free format, it is suggested to update onto this version.

Code_Saturne 2.0.0 changed its installation onto "autoconf". Therefore, its compilation can be completed by using a typical procedure "configure && make && make install". If you don't mention a target directory for the "configure" scripts, all code will be installed into /usr/local. With respect to the usage, sourcing of a "cs_profile" file is not needed anymore, and you can directly use a unique "cs" script under /usr/local/bin.

The following is an instruction on how to compile Code_Saturne 2.0.0-beta2 on Ubuntu 9.04.

First of all, for CS 2.0.0, install necessary packages by using apt-get.

# for compiling source code
:/$ sudo apt-get install build-essential gfortran libxml2 libxml2-dev
# install BLAS mathematic libraries
:/$ sudo apt-get install libatlas-headers libatlas-base-dev
# for openmpi (support for parallel computing)
:/$ sudo apt-get install openmpi-bin openmpi-dev libibverbs-dev
# for ssh-server (support for parallel computing)
:/$ sudo apt-get install openssh-server
# for GUI
:/$ sudo apt-get install python-qt4
# for GUI, provide pyuic4, pyrcc4 and pylupdate4
:/$ sudo apt-get install pyqt4-dev-tools
# optional, only necessary if compile MEI
:/$ sudo apt-get install bison flex swig python-dev
# for LaTeX documents
:/$ sudo apt-get install tetex-bin tetex-base
# for LaTeX documents, provide fig2dev
:/$ sudo apt-get install transfig
# for LaTeX documents, provide epstopdf
:/$ sudo apt-get install texlive-extra-utils

Download packages bft-111, fvm-0140, ecs-200 and ncs-200 from the official website, and then together with the extra downloaded packages, metis-4.0, hdf5-1.6.9 and med-2.3.5, extract these packages into a temporary directory, in which you can "configure; make; sudo make install" them one by one.

1. Compile metis-4.0, hdf5-1.6.9, med-2.3.5 and bft-1.1.1

# ship into metis-4.0
:/$ make
:/$ cp graphchk kmetis mesh2dual mesh2nodal oemetis onmetis partdmesh partnmesh pmetis /usr/local/bin/
:/$ cp libmetis.a /usr/local/lib/
:/$ cp Lib/*.h /usr/local/include/

# ship into hdf5-1.6.9
:/$ ./configure --prefix=/usr/local
:/$ make
:/$ sudo make install

# ship into med-2.3.5
:/$ ./configure --with-hdf5=/usr/local
:/$ make
:/$ sudo make install

# ship into bft-1.1.1
:/$ ./configure
:/$ make
:/$ sudo make install

2. Compile fvm-0.14.0

# ship into fvm-0.14.0
:/$ ./configure --with-mpi=/usr/lib/openmpi
:/$ make
:/$ sudo make install

3. Compile ecs-2.0.0

# ship into ecs-2.0.0-beta2
:/$ ./configure
:/$ make
:/$ sudo make install

4. Compile ncs-2.0.0

# ship into ncs-2.0.0-beta2
:/$ ./configure --with-mpi=/usr/lib/openmpi --with-prepro=/usr/local LIBS=-lm
:/$ make
:/$ sudo make install
# optional, to produce and install pdf documents
:/S cp ~/fullpage.sty ~/lastpage.sty doc/style/
:/$ make pdf
:/$ sudo make install-pdf

After this is finished, use "cs config" to check the status of the newly installed Code_Saturne 2.0.0 beta2.

Ps, this instruction did not include the compilation of MEI, because I encountered an error during my trying it. I thought it is okay to ignore this error. However, after finishing the whole installation, I found the option "user law" was grey and disabled.

make[1]: Entering directory `/home/salad/Code_Saturne/src/mei-1.0.0/pytests'
cp: `../pytests/mei_test.py' and `../pytests/mei_test.py' are the same file
make[1]: *** [all] Error 1

Sunday, 9 August 2009

Linux/Ubuntu on a Lenovo ThinkPad

I installed Ubuntu 9.04 onto my ThinkPad T61. ThinkPad series is famous to be Linux friendly, and also because the big improvement of Linux/Ubuntu, after I finished the installation, I found most hardware drivers are installed and ready to use, even including the Fn keys. It is a shame that I still have more than 569 MB ThinkPad driver files for Windows XP stored on my harddisk.

* CPU Temperature and the Cooling Fans

A very useful tool GNOME Sensors Applet can indicate CPU, harddisk and GPU temperatures as well as cooling fan speed. Use apt-get to install the applet and monitor what you want.

:/$ sudo apt-get install sensors-applet

Although it is BIOS's responsibility to optimize the cooling fan speed in order to limit the temperatures, another tool ThinkPad Fan Control (tp-fan) allow you to control the fan speed manually. To install tp-fan, enable its PPA source, and then use apt-get

:/$ sudo apt-get install tpfand

However, it is not recommended to use tp-fan to adjust the temperature thresholds controlling the fan running level.

Actually, by looking up proc files under /proc/acpi/ibm ThinkPad runtime status can be obtained, including the cooling fan. Then it is known that the fan has 0-7 eight levels to be running at.

:/$ cat /proc/acpi/ibm/fan

* FingerPrint Reader

Install ThinkFinger to use the FingerPrint Reader device.

:/$ sudo apt-get install thinkfinger-tools

Its usage is detailedly described on "Install ThinkFinger on Ubuntu".

* Harddisk Active Protection System (APS)

First of all, it is necessary to download these packages. You have to compile them manually except the third one, the script. Actually, the first one is already available in the system, and the second one can be easily installed by using apt-get; however, these binary versions cannot work as expected.1. Unpack, compile and install tp_smapi. Then modify /etc/modules and /etc/modprobe.d/local.conf. Load the modules

:/$ sudo modprobe thinkpad_ec tp_smapi hdaps

Please refer to Reference 1.

2. Use typical "./configure --prefix=/usr/ && make && sudo make install" to build hdapsd. hdapsd will be installed into /usr/sbin/. hdaps-gl, in package hdaps-utils, can be used to test hdaps. Refer to Reference 2.

3. Make the hdapsd script executable, copy it into /etc/init.d/, and then run it.

:/$ chmod +x hdapsd
:/$ sudo cp hdapsd /etc/init.d/
:/$ sudo /etc/init.d/hdapsd start

4. Build the GNOME hdaps applet and install it. Then add the applet onto a GNOME panel. The applet is an indicator to show whether the magnetic head of the harddisk is parked.

:/$ sudo apt-get install libpanel-applet2-dev
:/$ cd ~/gnome-hdaps-applet-20081204
:/$ gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
:/$ sudo cp gnome-hdaps-applet /usr/bin/
:/$ sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
:/$ sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
:/$ sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/

5. Refering to Reference 2, smartctl can be used to look up the park times of the magnetic head of harddisks. Among the smartctl output, the last number of the line, which contains "Load_Cycle", is the park times.

:/$ sudo apt-get install smartmontools
:/$ sudo smartctl -a /dev/sda | grep Load_Cycle

This park times has a limitation in an alive harddisk. It implies frequently parking the head is not a good idea either. Therefore, default value for the parameter "SENSITIVITY", 15, is too low. We can make it higher, for example, to 50, by modifying /etc/default/hdapsd.

# sensitivity
SENSITIVITY=50

Actually, on Windows I guess it is also necessary to adjust the 'shock detection sensitivity' lower to 'medium'.



References:

1. Enabling Active Protection System on a ThinkPad T61

2. X200下的HDAPS妖魔鬼怪