[Pympi-users] repeat send and receive problem
Status: Alpha
Brought to you by:
patmiller
From: Jairo S. <jai...@gm...> - 2007-06-28 00:01:23
|
Hi pympi-users ! my question perhaps is not a real problem with pympi, is more about programming and complexity. I hope that you can help me ! The next piece of code work fine just one time: if (mpi.rank==0): for i in range(1,mpi.size): mpi.send(m_matrix,i,tag=98) dml=[] for l in range(1,mpi.size): m_menor,status=mpi.recv(tag=97) dml.append(m_menor) dmg=[] dmg.append(min(dml)) m_matrix=upgma(m_matrix,m_nom,dmg) for n in range(len(m_matrix[0])): print m_matrix[0][n] print m_matrix[1] else: e_matrix,status=mpi.recv(tag=98) vvif=vivf(e_matrix) print vvif[0],vvif[1],mpi.rank e_menor=upgmaNuc.menor(e_matrix,vvif[0],vvif[1]) mpi.send(e_menor,0,tag=97) I need to repeat "n times" the same code in master (rank=0) and exactly "n times" in slaves (rank!=0), but if i try to repeat "n times" it doesnt work, it return me "UnboundLocalError: local variable 'pos' referenced before assignment". I couldnt understand this error if (mpi.rank==0): for n in range(3): for i in range(1,mpi.size): mpi.send(m_matrix,i,tag=98) dml=[] for l in range(1,mpi.size): m_menor,status=mpi.recv(tag=97) dml.append(m_menor) dmg=[] dmg.append(min(dml)) m_matrix=upgma(m_matrix,m_nom,dmg) for n in range(len(m_matrix[0])): print m_matrix[0][n] print m_matrix[1] else: for n in range(3): e_matrix,status=mpi.recv(tag=98) vvif=vivf(e_matrix) e_menor=upgmaNuc.menor(e_matrix,vvif[0],vvif[1]) mpi.send(e_menor,0,tag=97) Thanks, -- jDSL Bucaramanga, Colombia UIS Rugby Club (c) 2007 |