<div dir="ltr"><div></div><div>I wrote my assignment using MPI, and tested it both locally on Open MPI (1.6.5) and on IBM Blue Gene/P (with mpi implementation provided by IBM). Everything worked fine. Turns out that our solutions are tested also in our labs where MPICH, is installed:<br>
</div><div><br>$ mpich2version <br>MPICH2 Version: 1.4.1p1<br><br></div><div>And when I run my solution there I get this strange error:<br></div><div>$ mpirun -n 2 msp-par.exe 10 10 1<br>Internal Error: invalid error code 409e10 (Ring ids do not match) in MPIR_Reduce_impl:1087<br>
Fatal error in PMPI_Reduce: Other MPI error, error stack:<br>PMPI_Reduce(1270).....: MPI_Reduce(sbuf=0x7fff693a92e8, rbuf=0x7fff693a9300, count=1, dtype=USER<struct>, op=0x98000000, root=0, MPI_COMM_WORLD) failed<br>
MPIR_Reduce_impl(1087):<br><br></div><div>I am literally out of ideas what is wrong!<br><br></div><div>Below source code fragments (c++):<br></div><div><br>struct msp_solution<br>{<br> int x1, y1, x2, y2;<br> m_entry_t max_sum;<br>
msp_solution();<br> msp_solution(const pair<int, int> &c1, const pair<int, int> &c2, int max_sum);<br> friend bool operator<(const msp_solution &s1, const msp_solution &s2);<br>};<br>
<br>void max_msp_solution(msp_solution *in, msp_solution *inout, int, MPI_Datatype*)<br>{<br> *inout = max(*in, *inout);<br>}<br><br></div>// somewhere in code<br><div><div><div><div><div>{<br> MPI_Datatype MPI_msp_solution_t;<br>
MPI_Op max_msp_solution_op; <br><br> // create MPI struct from msp_solution<br> MPI_Datatype types[] = { MPI_INT, MPI_LONG_LONG_INT };<br> int block_lengths[] = { 4, 2 };<br> MPI_Aint base_addr, x1_addr, max_sum_addr;<br>
MPI_Get_address(&collected_solution, &base_addr);<br> MPI_Get_address(&collected_solution.x1, &x1_addr);<br> MPI_Get_address(&collected_solution.max_sum, &max_sum_addr);<br><br> MPI_Aint displacements[] = <br>
{ <br> x1_addr - base_addr, <br> max_sum_addr - base_addr <br> };<br><br> MPI_Type_create_struct(2, block_lengths, displacements, types, &MPI_msp_solution_t);<br> MPI_Type_commit(&MPI_msp_solution_t);<br>
<br> // max reduction function<br> MPI_Op_create((MPI_User_function *) max_msp_solution, 1, &max_msp_solution_op);<br><br> ...<br><br> msp_solution solution, received_solution;<br></div><div> MPI_Comm comm,<br>
</div><div> ...<br> // comm is created using MPI_Comm_split</div><div> // solution is initialized<br></div><div> MPI_Reduce(&solution, &received_solution, 1, MPI_msp_solution_t, max_msp_solution_op , 0, MPI_COMM_WORLD);<br>
</div><div> // ERROR above!!!<br></div><div>}<br><br><br></div><div>Is there some error in this? How can I make it run?<br></div><div>P.S. MPI_Send and MPI_Recv on my struct MPI_msp_solution_t seems to work fine<br></div>
<div><br>Thanks in advance!<br>Best regards,<br></div><div>Kuba<br></div></div></div></div></div></div>