if(selector_on){
// collective seems not handled by the active selector, try with default one
- name=const_cast<char*>("default");
for (int i = 0; table[i].name; i++)
- if (!strcmp(name, table[i].name)) {
+ if (!strcmp("default", table[i].name)) {
return i;
}
}
int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
{
- int size = smpi_comm_size(comm);
- int sendsize = smpi_datatype_size(sendtype) * sendcount;
+ int size = comm->size();
+ int sendsize = sendtype->size() * sendcount;
if (sendsize < 200 && size > 12) {
return smpi_coll_tuned_alltoall_bruck(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
} else if (sendsize < 3000) {
MPI_Request *requests;
// FIXME: check implementation
- int rank = smpi_comm_rank(comm);
- int size = smpi_comm_size(comm);
+ int rank = comm->rank();
+ int size = comm->size();
XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
- smpi_datatype_extent(sendtype, &lb, &sendext);
- smpi_datatype_extent(recvtype, &lb, &recvext);
+ sendtype->extent(&lb, &sendext);
+ recvtype->extent(&lb, &recvext);
/* Local copy from self */
- int err = smpi_datatype_copy(static_cast<char *>(sendbuf) + rank * sendcount * sendext, sendcount, sendtype,
+ int err = Datatype::copy(static_cast<char *>(sendbuf) + rank * sendcount * sendext, sendcount, sendtype,
static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount, recvtype);
if (err == MPI_SUCCESS && size > 1) {
/* Initiate all send/recv to/from others. */
/* Create all receives that will be posted first */
for (i = 0; i < size; ++i) {
if (i != rank) {
- requests[count] = smpi_irecv_init(static_cast<char *>(recvbuf) + i * recvcount * recvext, recvcount,
+ requests[count] = Request::irecv_init(static_cast<char *>(recvbuf) + i * recvcount * recvext, recvcount,
recvtype, i, system_tag, comm);
count++;
}else{
/* Now create all sends */
for (i = 0; i < size; ++i) {
if (i != rank) {
- requests[count] = smpi_isend_init(static_cast<char *>(sendbuf) + i * sendcount * sendext, sendcount,
+ requests[count] = Request::isend_init(static_cast<char *>(sendbuf) + i * sendcount * sendext, sendcount,
sendtype, i, system_tag, comm);
count++;
}else{
}
}
/* Wait for them all. */
- smpi_mpi_startall(count, requests);
+ Request::startall(count, requests);
XBT_DEBUG("<%d> wait for %d requests", rank, count);
- smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+ Request::waitall(count, requests, MPI_STATUS_IGNORE);
for(i = 0; i < count; i++) {
if(requests[i]!=MPI_REQUEST_NULL)
- smpi_mpi_request_free(&requests[i]);
+ Request::unref(&requests[i]);
}
xbt_free(requests);
}
MPI_Request *requests;
/* Initialize. */
- int rank = smpi_comm_rank(comm);
- int size = smpi_comm_size(comm);
+ int rank = comm->rank();
+ int size = comm->size();
XBT_DEBUG("<%d> algorithm alltoall_basic_linear() called.", rank);
- smpi_datatype_extent(sendtype, &lb, &sendext);
- smpi_datatype_extent(recvtype, &lb, &recvext);
+ sendtype->extent(&lb, &sendext);
+ recvtype->extent(&lb, &recvext);
/* simple optimization */
- int err = smpi_datatype_copy(static_cast<char *>(sendbuf) + rank * sendcount * sendext, sendcount, sendtype,
+ int err = Datatype::copy(static_cast<char *>(sendbuf) + rank * sendcount * sendext, sendcount, sendtype,
static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount, recvtype);
if (err == MPI_SUCCESS && size > 1) {
/* Initiate all send/recv to/from others. */
/* Post all receives first -- a simple optimization */
count = 0;
for (i = (rank + 1) % size; i != rank; i = (i + 1) % size) {
- requests[count] = smpi_irecv_init(static_cast<char *>(recvbuf) + i * recvcount * recvext, recvcount,
+ requests[count] = Request::irecv_init(static_cast<char *>(recvbuf) + i * recvcount * recvext, recvcount,
recvtype, i, system_tag, comm);
count++;
}
* TODO: check the previous assertion
*/
for (i = (rank + size - 1) % size; i != rank; i = (i + size - 1) % size) {
- requests[count] = smpi_isend_init(static_cast<char *>(sendbuf) + i * sendcount * sendext, sendcount,
+ requests[count] = Request::isend_init(static_cast<char *>(sendbuf) + i * sendcount * sendext, sendcount,
sendtype, i, system_tag, comm);
count++;
}
/* Wait for them all. */
- smpi_mpi_startall(count, requests);
+ Request::startall(count, requests);
XBT_DEBUG("<%d> wait for %d requests", rank, count);
- smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+ Request::waitall(count, requests, MPI_STATUS_IGNORE);
for(i = 0; i < count; i++) {
if(requests[i]!=MPI_REQUEST_NULL)
- smpi_mpi_request_free(&requests[i]);
+ Request::unref(&requests[i]);
}
xbt_free(requests);
}
MPI_Request *requests;
/* Initialize. */
- int rank = smpi_comm_rank(comm);
- int size = smpi_comm_size(comm);
+ int rank = comm->rank();
+ int size = comm->size();
XBT_DEBUG("<%d> algorithm basic_alltoallv() called.", rank);
- smpi_datatype_extent(sendtype, &lb, &sendext);
- smpi_datatype_extent(recvtype, &lb, &recvext);
+ sendtype->extent(&lb, &sendext);
+ recvtype->extent(&lb, &recvext);
/* Local copy from self */
- int err = smpi_datatype_copy(static_cast<char *>(sendbuf) + senddisps[rank] * sendext, sendcounts[rank], sendtype,
+ int err = Datatype::copy(static_cast<char *>(sendbuf) + senddisps[rank] * sendext, sendcounts[rank], sendtype,
static_cast<char *>(recvbuf) + recvdisps[rank] * recvext, recvcounts[rank], recvtype);
if (err == MPI_SUCCESS && size > 1) {
/* Initiate all send/recv to/from others. */
/* Create all receives that will be posted first */
for (i = 0; i < size; ++i) {
if (i != rank && recvcounts[i] != 0) {
- requests[count] = smpi_irecv_init(static_cast<char *>(recvbuf) + recvdisps[i] * recvext,
+ requests[count] = Request::irecv_init(static_cast<char *>(recvbuf) + recvdisps[i] * recvext,
recvcounts[i], recvtype, i, system_tag, comm);
count++;
}else{
/* Now create all sends */
for (i = 0; i < size; ++i) {
if (i != rank && sendcounts[i] != 0) {
- requests[count] = smpi_isend_init(static_cast<char *>(sendbuf) + senddisps[i] * sendext,
+ requests[count] = Request::isend_init(static_cast<char *>(sendbuf) + senddisps[i] * sendext,
sendcounts[i], sendtype, i, system_tag, comm);
count++;
}else{
}
}
/* Wait for them all. */
- smpi_mpi_startall(count, requests);
+ Request::startall(count, requests);
XBT_DEBUG("<%d> wait for %d requests", rank, count);
- smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+ Request::waitall(count, requests, MPI_STATUS_IGNORE);
for(i = 0; i < count; i++) {
if(requests[i]!=MPI_REQUEST_NULL)
- smpi_mpi_request_free(&requests[i]);
+ Request::unref(&requests[i]);
}
xbt_free(requests);
}