Compiling C++ code with MPI for parallel processing

#include “mpi.h”
int main(int argc,char** argv)
{
MPI_Init(&argc,&argv);


MPI_Finalize();
}
then compile with
mpicxx
to run it, use
mpirun -np 4 ./a.out
for using 4 copies in 4 processors.

Atlas spectral response simulation does not converge

I am simulating a photodetector using Atlas from Silvaco. The simulation uses Luminous module to calculate the photocurrent for a range of optical wavelength. Somehow the simulation cannot converge for higher wavelengths.
It turns out due to the Schrodinger-Poisson calculation. I added in SCHRO in models statement since I wanted to calculate the conduction band [...]

C++ code using acos for complex number in IT++

I am currently trying out IT++ and so far it was great. It is as easy as Octave but written for C++ programming. One thing that I had trouble was that in my code I need to compute
complex acos(complex a)
However, it gives me error
for the function acos. It turns out acos for complex number was [...]

check memory leak in a program or code

We can use “valgrind”, simply compile your code with -g option, and then run
valgrind –leak-check=full ./program > output.log
if you run “top” then you will see a process called “memcheck”.
this is a kind of output you will get:
==1651== Memcheck, a memory error detector.
==1651== Copyright (C) 2002-2007, and GNU GPL’d, by Julian Seward et al.
==1651== Using [...]

Installing IT++ in Linux

I am currently trying to use IT++ in Kubuntu 8.04. Download the source from
http://itpp.sourceforge.net/
unzip the archive, and cd into the directory. Then do as usual: ./configure, make, make check, make install. But when I did a make check, 2 tests failed. It is documented in the FAQ #1. So I need to run configure as
./configure [...]

Enable wireless connection in Kubuntu Intrepid 8.10

After I upgraded to Kubuntu Intrepid, knetwork-manager can detect wireless, and it’s activated, but it can never connect to the network.
After browsing through, I decided to try WICD, to install in Kubuntu, follow the instruction given in this page.
After installation, quit knetwork-manager, and run from konsole “wicd-client&”, this will run the tray application. click the [...]

Installing g77 in Ubuntu/Kubuntu Intrepid 8.10

One of the biggest annoyance in updgrading to Kubuntu Intrepid is that g77 is no longer in repository. So I need to install g77 from source. To do that:
wget http://gcc.releasenotes.org/releases/gcc-3.4.6/gcc-3.4.6.tar.gz
tar xvzf gcc-3.4.6.tar.gz

then cd to that directory, and run configure with this options:
./configure –enable-languages=c,f77 –disable-checking –prefix=$HOME/local
make CC=/usr/bin/gcc
make install

more info in this post.
UPDATE: I am having some [...]

Kubuntu intrepid network problem: activated but cannot browse

I am not sure what happened, but suddenly my kubuntu couldn’t connect to internet, while my windows can. It seems that my eth0 is activated, but somehow I couldn’t browse the net. I suspect it’s the DNS problem. So this is what I did and it solves the problem
# route add default gw 10.0.0.2
# cp [...]

Calling ARPACK functions from C++ using liboctave

Previously I post on how to call GSL function, now it’s time for ARPACK. In octave, when you run interactively, you just need to run “eigs” for various matrix function. So Octave has provided some bindings to call ARPACK functions. So following the same steps as calling GSL function:
download arpack-1.0.6.tar.gz.
unzip the file and type [...]

Disable touchpad in Kubuntu 8.10 Intrepid

Kubuntu intrepid changed some of its settings and I can’t use my old method to disable my touchpad of my laptop. To overcome this problem,
sudo apt-get install gsynaptics
After that download shmconfig.fdi.tar.gz
extract the files and copy to
/etc/hal/fdi/policy/
restart your Kubuntu, and after login, go to Konsole and type
gsynaptics
You can disable your touchpad using the GUI. Hope this [...]