Thursday, March 26, 2009

Arch linux: very first impression

Usually I don't write any reviews or any opinions on linux distros. However, I have to make an exception. The reason is that I have just install Arch linux! Arch linux is
a lightweight and flexible Linux® distribution that tries to Keep It Simple.
First on virtual box though, just to see what all the fuss is about. What I see is that this distro is quite interesting, it was easy to install. It was easy to set up fluxbox, and some other programs that I need (e.g. python-numpy, python-scipy, matplotlib). Currently I’m using CentOS on my HPC (high performance computing) server, and ubuntu 8.10 on desktop. In few weeks Ubuntu 9.04 released and I strongly think that I may move to Arch on desktop! Not 100% sure now, but I keep testing arch on virtualbox. Definitely, the first impression is positive! If I'll have some further info about this, I will update this post.

Wednesday, March 18, 2009

ubuntu-server 8.10: problem with vncsever

To install vncserver on ubuntu-server 8.10 one can use the followingsudo apt-get install tightvncserver fluxbox xtermorsudo apt-get install vnc4server fluxbox xterm where fluxbox is the name of window manager that we want. I like fluxbox, but there are others such as twm ot ctwm. xterm is terminal console. I used the first command.

After installation, each user can run its own vncserver to connect to. To start it, please run vncserver as a normal user (not root). When you run it for the first time vncserver will ask you for your password.

However, there is a problem with vncserver in this version of ubuntu. The problem is that file rgb.txt is missing, and as results vnc cannot display colors correctly. The errors in vncserver log file in ~/.vnc folder are be:Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'
xsetroot: unknown color "grey"
To be specific, in my case, when I starter xterm, it was just showing black "patch" and not a command prompt.When searching for this rgb.txt file one finds it in /usr/share/X11/rgb.txt. However, this is a broken link:ls -l /usr/share/X11/rgb.txt
lrwxrwxrwx 1 root root 16 2009-03-17 10:09 /usr/share/X11/rgb.txt -> /etc/X11/rgb.txt
File /etc/X11/rgb.txt does not exists. The solution is to manual upload the file to /etc/X11/ and to make it readable. The file can be found performing a search in google. With this file, the colors can be displayed correctly and finally xterm in vnc was displaying what it should be displaying, i.e. command prompt.

Monday, March 16, 2009

LS-DYNA parallel: SMP vs MPP

LS-DYNA, is an part of ANSYS software and it is a general purpose transient dynamic finite element program capable of simulating complex real world problems.

For large models, you can use the shared memory parallel processing (SMP) or the massively parallel processing (MPP) capabilities of ANSYS LS-DYNA to shorten the elapsed time necessary to run an analysis.

The shared memory parallel processing capabilities allow you to distribute model-solving power over multiple processors on the same machine.

The massively parallel processing (MPP) capabilities of ANSYS LS-DYNA allow you to run the LS-DYNA solver over a cluster of machines or use multiple processors on a single machine.

My question is which one is faster and how faster?

To answer to this question, I performed LS-DYNA simulation of an official LS-DYNA example airbag.deploy.k, once with SMP and once with MPP for different number of CPUs. To use LS-DYNA SMP I used the following example command:ls971.e110 pr=aa_r_dy ncpu=%d i=airbag.deploy.k where pr=aa_r_dy is my license, and %d is the number of CPUs to be used for solving the airbag problem. For LS-DYNA MPP I used:lsdyna110 -dis -np %d pr=aa_r_dy i=.airbag.deploy.k where %d is the number of CPUs to be used.

The above commands were used in a short Python script (it is here) that executes them with different values of %d, calculates execution times, and generates file with the time results. The times obtained were plotted against number of CPUs used:The tests were executed on a single server with 4 Intel Xeon processors and 24GB RAM. Each processor had 6 cores. The operating system (CentOS 5.2) sees this as 24 CPUs.


It can be seen for the graph, that solving LS-DYNA problems using MPP is faster than using SMP. However, the execution time does not reduce linearly with the number of CPUs. One reason may be that airbag.deploy.k is not well suited for solving using large number of CPUs.

Wednesday, March 11, 2009

Linux: Error while loading shared libraries

Just indicate the folder containing the library:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/folder/with/lirbary To check what libraries are used by a given program, one can use ldd:ldd ./ls971_mpphpmpi.e110 => not found => not found => /lib64/ (0x0000003874a00000) => /lib64/ (0x0000003874600000) => /usr/lib64/ (0x0000003885800000) => /lib64/ (0x0000003885400000) => /lib64/ (0x0000003874200000)
/lib64/ (0x0000003873200000)

Tuesday, March 10, 2009

Xen: performance of full virtualization vs. paravirtualization

I wanted to check what is the difference in performance between virtualization and paravirtualization using Xen. Before going any further some basic info about paravirtualization and full virtualization is given.

Under paravirtualization the kernel of the guest operating system is modified specifically to run on the hypervisor [from here], where hypervisor is a program that runs directly on the hardware of the host system in ring 0. The task of the hypervisor is to handle resource and memory allocation for the virtual machines in addition to providing interfaces for higher level administration and monitoring tools [from here]. Full virtualization provides support for unmodified guest operating systems. The term unmodified refers to operating system kernels which have not been altered to run on a hypervisor and therefore still execute privileged operations as though running in ring 0 of the CPU. In this scenario, the hypervisor provides CPU emulation to handle and modify privileged and protected CPU operations made by unmodified guest operating system kernels [from here].

To compare the performance of paravirtualized system with full virtualized syststem I created two virtual machines (two domU's). The first one was full virtualization with CentOS 5.2 x86_64, while the second one was paravirtualization with the same CentOS 5.2 x86_64. CentOS's were installed with identical sets of packages and configurations. The only difference between the two, was that one was installed using full virtualization, while the second was installed using paravirtualization. Both were installed with four virtual CPU's and 1GB of RAM. The host (dom0) was CentOS 5.2 x86_64 with 24 CPUs (4 physical Xeon CPUs, each with 6 cores) and 24GB of RAM. It must be noted the my CPUs support hardware virtualization (Intel VT-x). Hardware virtualization leverages virtualization features built into the latest generations of CPUs from both Intel and AMD [from here]. Therefore, the following title of this post could be better: Xen: performance of hardware virtualization vs. paravirtualization. However, I basically refer to the fact that in paravirtualization the kernel of the guest (i.e. domU) is modified, while in full and hardware virtualizations the kernel of the guest is not modified.
To compare the performance the following benchmarks were used: nbench, bench and primes 0.9. nbench and bench are single-threaded benchmarks, while primes is multi-threaded benchmark. Primes benchmark was executed with four CPUs and option #15 (i.e. find all prime number less than 256,000,000). The tests on one virtual machine were performed while the other was not running.

Some results are presented below. Full results are here (PV) and here (FV). Better results between the two virtualization method were marked using bold font. For complicity, results for dom0 are also given. Dom0 was the same CentOS 5.2 x86_64 as was used in virtual machines. However, there were differences in configuration, installed packages and services. In another words, dom0 was little more loaded than any domU. During the tests on dom0, virtual machines were shutdown. The full results for dom0 are here.

nbench results

Index (higher is better) Full virtualization Paravirtualizationdom0
MEMORY INDEX 18.892 18.99121.046
INTEGER INDEX 16.921 17.06217.969
FLOATING-POINT INDEX 28.499 28.78129.917

Update 17/03/09: I tested fully virtualized ubuntu-server 8.10 using nbench and got: 19.037,18.017 and 28.756.

Primes results

Time [s] (lower is better) Full virtualization Paravirtualizationdom0*
Time 116.423 112.432104.67
* - four CPUs were used.

Update 17/03/09: I tested fully virtualized ubuntu-server 8.10 using primes, and got 113.297 s.

bench results

Index (higher is better) Full virtualization Paravirtualizationdom0
Arithmetic Test (type = double) 409.6 411.6461.3
Dhrystone 2 without register variables484.4 489.8539.2
Process Creation Test [lps] 614.0 3176.72855.6
Shell scripts (4 concurrent) [lpm] 190.6 1250.01261.3


Paravirtualization is marginally faster than full virtualization in my case. Therefore, from the results obtained it does not appear that paravirtualization exhibits much greater performance over full virtualization. One reason for this may be the fact that my CPU's support hardware virtualization. However, my tests were not full. Things such as network bandwich, disk operations etc. were not tested. More tests is required.

Xen: Error: Device creation failed for domain

On CentOS 5.2 I had few paravirtualized domU's running. Everything went fine, but one day my Xen could not start any domU. The errors were:xm create /etc/xen/testPV
Using config file "/etc/xen/testPV ".
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
The above error was shown about 1-2 min after xm create command was issued. However, when I hit Ctrl+c during this time I got xm create /etc/xen/testPV
Using config file "/etc/xen/testPV".
Error: Device creation failed for domain testPV
I found that these erros were caused by the fact that udevd was not workig. To check if it is working I usedps aux | grep udevdudevd is (from man)
udevd allows the serialization of hotplug(8) events. The events generated by the kernel may arrive in random order in userspace, that makes it necessary to reorder them. udevd takes care of the kernel supplied sequence number and arranges the events for execution in the correct order. Missing sequences delay the execution of the following events until a timeout is reached.
So I started it as a root using:udevd --daemonOnce it was working I could start my domU's with xm create command. So it appears that in my case udevd was not working. Most likely I killed it by accident.

Sunday, March 08, 2009

Linux: creating ramdisk

The following comes from tip #45.

Remember the old days of RAM disks? Well, Linux has them too! If you've never tried them, a RAM disk is a virtual filesystem that runs entirely from your PC's main memory, which means it's lightning fast to read and write anything you want.

How much space you choose to allocate to your RAM disk is down to how much RAM you have and how much you plan to use it - if you have 1GB of RAM, you can easily spare 64MB for a ramdisk; if you have 2GB you can probably spare 256MB, and if you're lucky enough to have 4GB then you can easily stretch your RAM disk legs with 1GB.

Here's how to set up a 64MB disk - just change the 65536 for the size you want:mkfs -t ext3 -q /dev/ram1 65536
mkdir -p /ramdisk
mount /dev/ram1 /ramdisk -o defaults,r,w
or mkdir /ramdisk
mount none -t tmpfs -o size=256M /ramdisk
That will allocate 256MB of space to your RAM disk. If you skip the "-o size=256M" part, half your RAM will be used by default.

Saturday, March 07, 2009

Excel: Convert text to number

To convert number written as text in excel, one can use value function:

Friday, March 06, 2009

Missing in ANSYS 11 SP1 on RHEL4

According to ANSYS Version 11.0 Service Pack 1 - Platform Support Table, ANSYS 11 SP1 for Intel Xeon EM64T/AMD Opteron is fully supported on Red Hat Enterprise Linux 4.0. One would expect that installing and running ANSYS on this OS would be painless. However, although installation along with setting licence went smooth, I had problems starting ANSYS. The error was:/usr/ansys_inc/v110/ansys/bin/linem64t/ansys.e110: error while loading shared libraries: cannot open shared object file: No such file or directory Therefore, the first thing I did was to check if my RHEL4.5 comes with this library. To do this I did as a root:find / -name ""As a result I found this library in /usr/X11R6/lib/. This library belongs to openmotif package, however in my case I had 32bit version of this package. My RHEL4.5 and ANSYS were for x86_64 platform. The only thing I had to do, was to install 64bit version rpm -ivh openmotif-2.2.3-10.1.el4.x86_64.rpm Openmotif package contains libraries of graphical user interface that is used in ANSYS. This package can be found on RHEL4.5 installation CDs/DVD. Once the package was installed, was also located in /usr/X11R6/lib64/. This was enough to start ANSYS.

Very similar problems were found when the same ANSYS 11 SP1 was installed on CentOS5.2 on the same machine. So, in my case there was no apparent advantage in using RHEL4.5 over CentOS5.2. It appears that that similar problems occur whether I was using officially supported OS than not supported.

One would expect that when ANSYS claims that something is supported it would work out of the box. Unfortunately, this is not the case. This was not the only problem with ANSYS. I also cannot start CFX launcher. I get en error /var/tmp/ line 3: cfx5: command not found The same situation is in CentOS 5.2. However, since I do not need to use CFX I did not spend any time trying to make it work. If someone knows, how to fix it, I would be very grateful. It seems that some paths must be added to PATH environmental variable.

Finally, I have to point out that ANSYS Version 11.0 Service Pack 1 - Platform Support Table says RHEL 4.0 not 4.5! So maybe if I was using over 4 years old OS, everything would work out of box.

Wednesday, March 04, 2009

CentoOS: Long delay after password in ssh

From some computers, when I wanted to connect to my server using ssh, I had to wait about 30s before I could login. I goggled this and I found this and this. I tried both solution and they work. In second solution I had to edit /etc/hosts on my server and add my computer that I use to connect to the server.

Tuesday, March 03, 2009

CentOS: ANSYS: error while loading shared libraries:

After installing ANSYS 11 SP1 on CentoOS 5.2 x86_64 and trying to start some new job I got the error that is missing. Ansys does not come with it, so I installed it form CentOS5.2 dvd. To be specific, I installed the following package that contains this library:openmotif22-2.2.3-18.x86_64.rpmJust after this I had another error: "cannot restore segment prot after reloc: Permission denied". This is due to SElinux. Therefore, I disabled SElinux in CentOS5.2 using Security Level and Firewall in Gnome System->Administration. No reboot was required.