<div dir="ltr"><div><div><div>Hi,<br><br></div>I try to broadcast a self-defined data type struct, but I found that every time the last value I cannot send it out. ex:<br></div>my data struct is:<br><span style="color:rgb(116,27,71)">typedef struct image_info_type{<br>
int width;<br> int length;<br> int page_num;<br> int buffer_width;<br> int buffer_length;<br> long int buffer_size;<br> long int image_size;<br>} image_info_type;</span><br>
<br></div><div>in my MPI program:<br><span style="color:rgb(116,27,71)"> ...............<br> int count = 7;<br> MPI_Datatype MPI_Imageinfo;<br> MPI_Datatype types[7] = {MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_LONG, MPI_LONG};<br>
int len[7] = {1, 1, 1, 1, 1, 1, 1};<br> MPI_Aint disp[7];<br> long int base;<br> MPI_Address(image_info, disp);<br> MPI_Address(&(image_info->width), disp+1);<br> MPI_Address(&(image_info->length), disp+2);<br>
MPI_Address(&(image_info->page_num), disp+3);<br> MPI_Address(&(image_info->buffer_width), disp+4);<br> MPI_Address(&(image_info->buffer_length), disp+5);<br> MPI_Address(&(image_info->buffer_size), disp+6);<br>
base = disp[0];<br> for(i=0; i<7; i++)<br> disp[i] -= base;<br><br> MPI_Type_struct(count, len, disp, types, &MPI_Imageinfo);<br> MPI_Type_commit(&MPI_Imageinfo);</span><br>
<span style="color:rgb(116,27,71)">...................</span><br><br></div><div>However, when I print out every information on each rank. the image_size is always 0. I cannot figure out anything wrong with my program. I would appreicate that if any one can give any suggestions. Thank you!<br>
</div><div><br clear="all"><div><div><div><br>-- <br>Best Regards,<div>Sufeng Niu</div><div>ECASP lab, ECE department, Illinois Institute of Technology</div><div>Tel: 312-731-7219</div>
</div></div></div></div></div>