<div dir="ltr"><div><div><div>Hi, sufeng:<br><br></div>I think you may first initialize array first, since you print out b without initialization,<br></div>it could print out anything.<br><br></div>Yi<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Jul 3, 2013 at 1:12 PM, Sufeng Niu <span dir="ltr"><<a href="mailto:sniu@hawk.iit.edu" target="_blank">sniu@hawk.iit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>Hi,<br><br></div>I am a beginner and just try to use remote memory access, and I wrote a simple program to test it:<br><br>#include "mpi.h"<br>#include <stdio.h><br>#define SIZE 8<br>
<br>int main(int argc, char *argv[])<br>{<br> int numtasks, rank, source=0, dest, tag=1, i;<br> float a[64] =<br> {<br> 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,<br>
1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,<br> 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,<br> 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0,<br>
};<br> float b[SIZE];<br><br> MPI_Status stat;<br><br> MPI_Init(&argc,&argv);<br> MPI_Comm_rank(MPI_COMM_WORLD, &rank);<br> MPI_Comm_size(MPI_COMM_WORLD, &numtasks);<br>
<br> MPI_Win win;<br><br> // check processor rank<br> char processor_name[MPI_MAX_PROCESSOR_NAME];<br> int name_len;<br> MPI_Get_processor_name(processor_name, &name_len);<br> printf("-- processor %s, rank %d out of %d processors\n", processor_name, rank, numtasks);<br>
<br> MPI_Barrier(MPI_COMM_WORLD);<br><br> if (numtasks == 4) {<br> if (rank == 0) {<br> printf("create window \n");<br> MPI_Win_create(a, 8*sizeof(float), sizeof(float), MPI_INFO_NULL, MPI_COMM_WORLD, &win);<br>
<br> }<br> else {<br> MPI_Win_create(MPI_BOTTOM, 0, sizeof(float), MPI_INFO_NULL, MPI_COMM_WORLD, &win);<br> }<br><br> MPI_Win_fence(0, win);<br>
<br> if (rank == 1){<br> MPI_Get(b, SIZE, MPI_FLOAT, 0, 8, SIZE, MPI_FLOAT, win);<br><br> MPI_Win_fence(0, win);<br> }<br><br> printf("rank= %d b= %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n", rank,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);<br>
}<br> else<br> printf("Must specify %d processors. Terminating.\n",SIZE);<br><br> MPI_Win_free(&win);<br> MPI_Finalize();<br>}<br><br></div><div>However the terminal gives some odd results:<br>
rank= 0 b= 0.0 0.0 0.0 0.0 0.0 0.0 -71847793475452928.0 0.0<br>rank= 2 b= 0.0 0.0 0.0 0.0 0.0 0.0 222086852849451401216.0 0.0<br>rank= 3 b= 0.0 0.0 0.0 0.0 0.0 0.0 -74882.4 0.0<br>rank= 1 b= 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0<br>
</div><div>the rank 1 is correct results, but others should be all zero.<br></div><div>terminal also give some comments: "Assertion failed in file src/mpid/ch3/src/ch3u_rma_sync.c at line 5061: win_ptr->my_counter >= 0<br>
internal ABORT - process 0"<br></div><div><br></div><div>another question is if I use remote memory access. all process which does not create window for share must add additional line: MPI_Win_create(MPI_BOTTOM, 0, data_type, MPI_INFO_NULL, MPI_COMM_WORLD, &win); correct?<br>
<br></div><div>Thanks a lot!<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div><div><div>-- <br>Best Regards,<div>Sufeng Niu</div><div>ECASP lab, ECE department, Illinois Institute of Technology</div>
<div>Tel: <a href="tel:312-731-7219" value="+13127317219" target="_blank">312-731-7219</a></div>
</div></div></div></font></span></div>
<br>_______________________________________________<br>
discuss mailing list <a href="mailto:discuss@mpich.org">discuss@mpich.org</a><br>
To manage subscription options or unsubscribe:<br>
<a href="https://lists.mpich.org/mailman/listinfo/discuss" target="_blank">https://lists.mpich.org/mailman/listinfo/discuss</a><br></blockquote></div><br></div>