dancing around MPI. Python approach |
Oct 25 |
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"
чтоли и себе на питоне сдлать? :/// там такая лажа с мпи… тем более что Мухлынин ставил… видимо недавно душа Билли сделал fork() - и воплотилась в сабжа… ох сколько народу его теперь ругает за купленный паливный и неработающий код :))
талаев, думаю, даже не понял что это на питоне. и, как я понял, ему плевать