Monthly Archives: August 2011

MPI on ARM!!

In the last months I’ve heard and read about many people trying to get MPI parallel computing systems running on ARM microcontrollers. Of course this is a good idea. This allows us to build clusters that consumes less energy.

Well, I decided to give it a try and started trying to compiled OpenMPI for the ARM Cortex A9. After some tries I gave up and started trying mpich2. Well, it worked. Here’s the prove:

root@pandaboard:~/mpich2-1.4.1/examples# mpirun -hosts
192.168.1.123,192.168.1.117 -l -n 4 ./cpi 100 0
[0] Process 0 of 4 is on pandaboard
[2] Process 2 of 4 is on pandaboard
[3] Process 3 of 4 is on opportunity
[1] Process 1 of 4 is on opportunity
[0] pi is approximately 3.1415926544231252, Error is 0.0000000008333321 [0] wall clock time = 0.005402

That’s a MPI program (just a simple one) running on an ARM Cortex A9 (PandaBoard). Even more interesting is that I compiled “cpi” for both ARM and x86 architectures with mpicc. This means that the nodes of this 2-machine-cluster is made of one ARM and one x86 (opportunity). Here we have a program running in a cluster where the nodes have different architectures!

By the way, mpich2 worked like a charm on the PandaBoard (after some tricks)

WebSpectrum

I did this some time ago and wanted to share with anyone interested. Basically it’s a Matlab/Simulink model that analyzes the input from the soundcard line-in using a FFT block and writes its output to a text file in /tmp/fft.out.

The systems works very well on PCs (x86) and ARMs (tested on BeagleBoard and PandaBoard). I used Matlab/Simulink Embedded IDE Link to generate C code and compiled it for the mentioned architectures.

After running the binary automatically generated from Matlab the model, we simply have to access a PHP page (fft.php). In the BeagleBoard i used lighthttpd as webserver. This PHP program reads the file /tmp/fft.out and draws a graphic spectrum on the web browser, automatically refreshing it at each 1 second.

There is also some labels in the web page showing the frequencies computed by the FFT present in the signal at a given instant. The output is very precise. I’ll try to post a screenshot of the system running later.

PHP and model are attached.

The S-Function is as simple as:

FILE *fp;
int i;

fp = fopen(“/tmp/fft.out”, “w”);

for (i=0;i<=31;i++) {
//u0 is the input from simulink block
fprintf(fp, “%frn”, u0[i]);
}

fclose(fp);

Here is a screenshot of the system working with a 3.2Khz sinewave input connected to the audio line in:

 

PHP code source file + Simulink Model file (.mdl)

HTC G1 with Android 2.2

I was already nervous….thinking I’ve bricked my phone, but yes, the first boot takes forever! Mine took about 10 minutes!

The only thing made me calm is following the boot progress with “adb logcat” while the phone started.

The first boot showed a beatiful CyanogenMod splash screen but programs seemed to be crashing (logcat). After 20 minutes, still this splash screen.

Wiped everything with RA and reflashed CyanogenMod-6.1.0

And finally got the welcome android screen asking for my Google username! 🙂