[mpich-discuss] send/receive a vector

Z.Rahmani za.rahmani at gmail.com
Tue Jan 7 11:34:46 CST 2014


For more information I copied some part of my code below:

double x_in[1024];/* buffer for random numbers */
int main(int argc,char** argv)
{
.....

MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&numtasks);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
if (rank == 0 && numtasks != 5) {
   printf("Number of tasks = %d\n",numtasks);
   printf("Only need 5 tasks - extra will be ignored...\n");
   }

MPI_Barrier(MPI_COMM_WORLD);

/******** Thread 0 ************************************/
if (rank == 0) {

   printf("task %d has started...\n", rank);

   dest = 1;

      /* send message to worker - message tag set to 1.  */
      /* If return code indicates error quit */

   rc = MPI_Send(x_in, 1, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD);
   if (rc != MPI_SUCCESS) {
       printf("Send error in task 0!\n");
       MPI_Abort(MPI_COMM_WORLD, rc);
       exit(1);}
}
.
.
.
.
.

I am waiting for your advice.

Thanks,
Zahra




On Tue, Jan 7, 2014 at 12:13 PM, Wesley Bland <wbland at mcs.anl.gov> wrote:

> It’s not clear what you’re asking for here. Could you provide a very small
> (not your complete code) code example showing what you’re talking about?
>
> Thanks,
> Wesley
>
> On Jan 7, 2014, at 11:03 AM, Z.Rahmani <za.rahmani at gmail.com> wrote:
>
> > Dear all,
> >
> > I want to send / receive a vector of integer values via mpich in a
> 5-thread plan but it seems each send function just sending one value, the
> first one. How can I resolve this problem? can I use loop commands inside a
> mpi function?
> >
> > thanks,
> > Zahra
> > _______________________________________________
> > discuss mailing list     discuss at mpich.org
> > To manage subscription options or unsubscribe:
> > https://lists.mpich.org/mailman/listinfo/discuss
>
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20140107/2e695ad8/attachment-0001.html>


More information about the discuss mailing list