Tuesday, June 2, 2009

MPI vs Pthread

I did a performance comparison between my MPI & pthread codes for Matrix multiplication. Matrices used were 1000*1000 and MPI code was run on UCSC's swelanka cluster (using 4 CPUs). While the MPI code took only 2.6 seconds to multiply two 1000*1000 matrices, the pthread code took more that 45 seconds(on avg).

1 comment:

evg said...

Hello! I compiled your code in OpenSUSE 11.1 and run it on my three year old laptop with Intel Core Duo processor. In the source for pthread version I changed NDIM from 200 to 512 and also initialized the second matrix with i*j, so the both versions had the same initial conditions and calculated the same product. The results are:

pthreads - 4s

MPI - 7s

I run it with two threads (time ./mm-pth 2) for pthreads and with two processors for mpi (time mpirun -np 2 ./mm-mpi -parallel).