s o m e t h i n g a b o u t m e

dancing around MPI. Python approach

I chose Python because of its simplicity and the size of coverage area :) there are a lot more docs about Python&MPI friendship then about Java&MPI (there are no tutorials/manuals about mpijava at all)

MPIJava seems to me complicated and confusing. And PyMPI is great, simple and fast-to-implement.

So, the result is: 70 lines of code on Python (create 5 matrixes, split 2 of them on equal parts, spread them through all workers, gather computation results) and one evening of fun coding :) because I’m a newbie in Python and it is very impressive and it admires me

example:

if mpi.rank == 0 :
    MB = MT = MC = MD = ME = create_matrix(n)
    mpi.bcast((MT, MD, ME))
    print mpi.rank, "MT, MD, ME broadcasted"
else :
    print mpi.rank, "Waiting for messages"
    MB = MC = []
    MT, MD, ME = mpi.bcast()

localMB = mpi.scatter(MB)
localMC = mpi.scatter(MC)

print mpi.rank,"MB, MC scattered"

MAr = sub_matrix(mult_matrix(localMB, MT), mult_matrix(mult_matrix(localMC, MD), ME))
MA = mpi.gather(MAr)

if mpi.rank == 0 :
    #print "String received", masterString
    print mpi.rank,"Results gathered"
    print print_matrix(MA)
else:
    print mpi.rank,"Worker finished his work"

RSS feed | Trackback URI

2 Comments »

Comment by t0n Subscribed to comments via email
2007-11-06 17:07:03

чтоли и себе на питоне сдлать? :/// там такая лажа с мпи… тем более что Мухлынин ставил… видимо недавно душа Билли сделал fork() - и воплотилась в сабжа… ох сколько народу его теперь ругает за купленный паливный и неработающий код :))

Comment by Traut
2007-11-06 18:24:13

:) да уж, отвечать за свой продукт нужно - кастомер сёрвис, горячая линия нужна

талаев, думаю, даже не понял что это на питоне. и, как я понял, ему плевать

 
 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.