Archive for July, 2013

Old Town Trolly Tours – San Diego

July 26, 2013

Its pretty much fun to listen to the tour guide…. Got a discounted price tour for $15 due to the XSEDE13 conference… Well worth the money…. Word of advice, sit on the right hand side of the trolly facing the front. Thats the side most of the good stuff you are gonna see…


My First MPI program

July 23, 2013

This was long overdue IMO. Here’s the simple hello world…

#include <stdio.h> 
#include <mpi.h> 
int main(int argc, char **argv) { 
 int rank, size;  MPI_Init(&argc, &argv); 
 MPI_Comm_rank(MPI_COMM_WORLD, &rank); 
 MPI_Comm_size(MPI_COMM_WORLD, &size); 
 printf("I'm the process number %d out of %d ", rank, size)); 
 return 0; 

to compile,

$ mpicc hello.c -o hello_exec

Note: if you have writtern in C++, use “mpic++” instead.

you can execute this as a normal application as usual but if you want it to execute in a cluster, use “mpirun” command.

$ mpirun -np 5 ./hello_exec

Note: “-np” is for number of processes to spawn. If you haven’t provided where to spawn the processes they will be created in the node 0 which is usually the host machine which you are triggering the MPI application. But if you know the other nodes you just need to specify those nodes. 

$ mpirun -f hosts.txt -np 5 ./hello_exec


$ mpirun -hosts host1,host2,host3 -np 5 ./hello_exec

and the mpirun will spawn processes in those hosts in round robbin fasion.