Hi All,

I am working on some parallelism with Communicator. But I don't understand
exactly the syntax of _communicator.send and _communicator.receive. This is
the definition of send for sending a vector in parallel_implementation.h.

*template <typename T>*
*inline void Communicator::send (const unsigned int dest_processor_id,*
*                                std::vector<T> &buf,*
*                                const DataType &type,*
*                                Request &req,*
*                                const MessageTag &tag) const*
*{*
*  START_LOG("send()", "Parallel");*

*#ifndef NDEBUG*
*  // Only catch the return value when asserts are active.*
*  const int ierr =*
*#endif*
*    ((this->send_mode() == SYNCHRONOUS) ?*
*     MPI_Issend : MPI_Isend) (buf.empty() ? NULL : &buf[0],*
*                              cast_int<int>(buf.size()),*
*                              type,*
*                              dest_processor_id,*
*                              tag.value(),*
*                              this->get(),*
*                              req.get());*

*  libmesh_assert (ierr == MPI_SUCCESS);*

*  STOP_LOG("send()", "Parallel");*
*}*


Suppose I want to send a vector<double> from processor 0 to processor 1. I
tried the following:

    if (_communicator.rank() == 0)
    {
      std::vector<double> sender;
      sender.push_back(1.1);
      sender.push_back(2.2);
      Request & req;
*      _communicator.send(1, &sender, MPI::DOUBLE, req, 10.231);*
    }
    else if (_communicator.rank() == 1)
    {
      std::vector<double> receiver(2);
      Request & req;
*      _communicator.receive(0, &receiver, MPI::DOUBLE, req, 10.231);*
    }


I encountered the compilation errors as follows. Does anyone know how to
setup the correct syntax for this case?


*'Request' was not declared in this scope'MPI' has not been declared*


Thank you very much,
Lei


-------------------------------------------------------------------
Lei Zhao
Research Assistant
University of Wisconsin-Madison
206 Materials Science & Engineering
1509 University Avenue
Madison, WI 53706, US
Email: lzha...@wisc.edu
Tel.: (608)332-8385
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to