Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] max. message size
From: jiangzuoyan_at_[hidden]
Date: 2013-07-17 04:58:56


I did this too, FYI.

template<class T>
tmp::enable_if<is_builtin<T>::value>
send(
    const T *buf, size_t count, int dest, int tag, MPI_Comm comm) {
  int imax = std::numeric_limits<int>::max();
  MPI_Datatype dtype = datatype<T>();
  while (count > 0) {
    int c = imax;
    if ((size_t)c > count) c = count;
    count -= c;
    MPI_Send((void*)buf, c, dtype, dest, tag, comm);
    buf += c;
  }
}

template <class T>
tmp::enable_if<is_builtin<T>::value>
recv(
    T *buf, size_t count, int source, int tag, MPI_Comm comm,
    MPI_Status *status=MPI_STATUS_IGNORE) {
  int imax = std::numeric_limits<int>::max();
  MPI_Datatype dtype = datatype<T>();
  if (count > (size_t)imax && status == MPI_STATUS_IGNORE
      && (source == MPI_ANY_SOURCE || tag == MPI_ANY_TAG)) {
    MPI_Status t[1];
    return recv(buf, count, source, tag, comm, t);
  }
  while (count > 0) {
    int c = imax;
    if ((size_t)c > count) c = count;
    count -= c;
    MPI_Recv((void*)buf, c, dtype, source, tag, comm, status);
    if (count > 0) {
      if (source == MPI_ANY_SOURCE) source = status->MPI_SOURCE;
      if (tag == MPI_ANY_TAG) tag = status->MPI_TAG;
    }
    buf += c;
  }
}

                                                      Changsheng Jiang

On Wed, Jul 17, 2013 at 4:51 PM, mohammad assadsolimani <
m.assadsolimani_at_[hidden]> wrote:

>

Post removed!







> ______________________________**_________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/**mailman/listinfo.cgi/users>
>