Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Continuing work on datatypes
authordegomme <augustin.degomme@unibas.ch>
Thu, 9 Mar 2017 10:18:38 +0000 (11:18 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Thu, 9 Mar 2017 16:53:03 +0000 (17:53 +0100)
107 files changed:
include/smpi/forward.hpp
src/smpi/colls/allgather-2dmesh.cpp
src/smpi/colls/allgather-3dmesh.cpp
src/smpi/colls/allgather-NTSLR-NB.cpp
src/smpi/colls/allgather-NTSLR.cpp
src/smpi/colls/allgather-SMP-NTS.cpp
src/smpi/colls/allgather-bruck.cpp
src/smpi/colls/allgather-loosely-lr.cpp
src/smpi/colls/allgather-mvapich-smp.cpp
src/smpi/colls/allgather-ompi-neighborexchange.cpp
src/smpi/colls/allgather-pair.cpp
src/smpi/colls/allgather-rdb.cpp
src/smpi/colls/allgather-rhv.cpp
src/smpi/colls/allgather-ring.cpp
src/smpi/colls/allgather-smp-simple.cpp
src/smpi/colls/allgather-spreading-simple.cpp
src/smpi/colls/allgatherv-mpich-rdb.cpp
src/smpi/colls/allgatherv-mpich-ring.cpp
src/smpi/colls/allgatherv-ompi-bruck.cpp
src/smpi/colls/allgatherv-ompi-neighborexchange.cpp
src/smpi/colls/allgatherv-pair.cpp
src/smpi/colls/allgatherv-ring.cpp
src/smpi/colls/allreduce-lr.cpp
src/smpi/colls/allreduce-mvapich-rs.cpp
src/smpi/colls/allreduce-mvapich-two-level.cpp
src/smpi/colls/allreduce-ompi-ring-segmented.cpp
src/smpi/colls/allreduce-rab-rdb.cpp
src/smpi/colls/allreduce-rab1.cpp
src/smpi/colls/allreduce-rab2.cpp
src/smpi/colls/allreduce-rdb.cpp
src/smpi/colls/allreduce-smp-binomial-pipeline.cpp
src/smpi/colls/allreduce-smp-binomial.cpp
src/smpi/colls/allreduce-smp-rdb.cpp
src/smpi/colls/allreduce-smp-rsag-lr.cpp
src/smpi/colls/allreduce-smp-rsag-rab.cpp
src/smpi/colls/allreduce-smp-rsag.cpp
src/smpi/colls/alltoall-2dmesh.cpp
src/smpi/colls/alltoall-3dmesh.cpp
src/smpi/colls/alltoall-bruck.cpp
src/smpi/colls/alltoall-mvapich-scatter-dest.cpp
src/smpi/colls/alltoall-pair-light-barrier.cpp
src/smpi/colls/alltoall-pair-mpi-barrier.cpp
src/smpi/colls/alltoall-pair-one-barrier.cpp
src/smpi/colls/alltoall-pair.cpp
src/smpi/colls/alltoall-rdb.cpp
src/smpi/colls/alltoall-ring-light-barrier.cpp
src/smpi/colls/alltoall-ring-mpi-barrier.cpp
src/smpi/colls/alltoall-ring-one-barrier.cpp
src/smpi/colls/alltoall-ring.cpp
src/smpi/colls/alltoallv-bruck.cpp
src/smpi/colls/alltoallv-ompi-basic-linear.cpp
src/smpi/colls/alltoallv-pair-light-barrier.cpp
src/smpi/colls/alltoallv-pair-mpi-barrier.cpp
src/smpi/colls/alltoallv-pair-one-barrier.cpp
src/smpi/colls/alltoallv-pair.cpp
src/smpi/colls/alltoallv-ring-light-barrier.cpp
src/smpi/colls/alltoallv-ring-mpi-barrier.cpp
src/smpi/colls/alltoallv-ring-one-barrier.cpp
src/smpi/colls/alltoallv-ring.cpp
src/smpi/colls/bcast-NTSB.cpp
src/smpi/colls/bcast-NTSL-Isend.cpp
src/smpi/colls/bcast-NTSL.cpp
src/smpi/colls/bcast-SMP-binary.cpp
src/smpi/colls/bcast-SMP-linear.cpp
src/smpi/colls/bcast-arrival-pattern-aware-wait.cpp
src/smpi/colls/bcast-arrival-pattern-aware.cpp
src/smpi/colls/bcast-arrival-scatter.cpp
src/smpi/colls/bcast-flattree-pipeline.cpp
src/smpi/colls/bcast-mvapich-smp.cpp
src/smpi/colls/bcast-ompi-pipeline.cpp
src/smpi/colls/bcast-ompi-split-bintree.cpp
src/smpi/colls/bcast-scatter-LR-allgather.cpp
src/smpi/colls/bcast-scatter-rdb-allgather.cpp
src/smpi/colls/gather-mvapich.cpp
src/smpi/colls/gather-ompi.cpp
src/smpi/colls/reduce-NTSL.cpp
src/smpi/colls/reduce-arrival-pattern-aware.cpp
src/smpi/colls/reduce-binomial.cpp
src/smpi/colls/reduce-flat-tree.cpp
src/smpi/colls/reduce-mvapich-knomial.cpp
src/smpi/colls/reduce-mvapich-two-level.cpp
src/smpi/colls/reduce-ompi.cpp
src/smpi/colls/reduce-scatter-gather.cpp
src/smpi/colls/reduce_scatter-mpich.cpp
src/smpi/colls/reduce_scatter-ompi.cpp
src/smpi/colls/scatter-mvapich-two-level.cpp
src/smpi/colls/scatter-ompi.cpp
src/smpi/colls/smpi_intel_mpi_selector.cpp
src/smpi/colls/smpi_mpich_selector.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp
src/smpi/colls/smpi_openmpi_selector.cpp
src/smpi/private.h
src/smpi/smpi_base.cpp
src/smpi/smpi_coll.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_datatype.cpp
src/smpi/smpi_datatype.hpp
src/smpi/smpi_f77.cpp
src/smpi/smpi_global.cpp
src/smpi/smpi_mpi_dt.cpp [deleted file]
src/smpi/smpi_mpi_dt_private.h [deleted file]
src/smpi/smpi_op.cpp
src/smpi/smpi_pmpi.cpp
src/smpi/smpi_replay.cpp
src/smpi/smpi_request.cpp
src/smpi/smpi_win.cpp
tools/cmake/DefinePackages.cmake

index 1435748..a42bf91 100644 (file)
@@ -22,10 +22,14 @@ class Topo;
 class Topo_Cart;
 class Topo_Graph;
 class Topo_Dist_Graph;
+class Type_Contiguous;
+class Type_Hindexed;
+class Type_Hvector;
+class Type_Indexed;
+class Type_Struct;
+class Type_Vector;
 class Win;
 
-
-
 }
 }
 
@@ -39,6 +43,12 @@ typedef simgrid::smpi::Topo_Cart SMPI_Cart_topology;
 typedef simgrid::smpi::Topo_Dist_Graph SMPI_Dist_Graph_topology;
 typedef simgrid::smpi::Topo_Graph SMPI_Graph_topology;
 typedef simgrid::smpi::Win SMPI_Win;
+typedef simgrid::smpi::Type_Contiguous SMPI_Type_Contiguous;
+typedef simgrid::smpi::Type_Hindexed SMPI_Type_Hindexed;
+typedef simgrid::smpi::Type_Hvector SMPI_Type_Hvector;
+typedef simgrid::smpi::Type_Indexed SMPI_Type_Indexed;
+typedef simgrid::smpi::Type_Struct SMPI_Type_Struct;
+typedef simgrid::smpi::Type_Vector SMPI_Type_Vector;
 
 #else
 
@@ -52,6 +62,12 @@ typedef struct SMPI_Win SMPI_Win;
 typedef struct SMPI_Graph_topology SMPI_Graph_topology;
 typedef struct SMPI_Cart_topology SMPI_Cart_topology;
 typedef struct SMPI_Dist_Graph_topology SMPI_Dist_Graph_topology;
+typedef struct SMPI_Type_Contiguous SMPI_Type_Contiguous;
+typedef struct SMPI_Type_Hindexed SMPI_Type_Hindexed;
+typedef struct SMPI_Type_Hvector SMPI_Type_Hvector;
+typedef struct SMPI_Type_Indexed SMPI_Type_Indexed;
+typedef struct SMPI_Type_Struct SMPI_Type_Struct;
+typedef struct SMPI_Type_Vector SMPI_Type_Vector;
 
 #endif
 
index df64293..9217ab3 100644 (file)
@@ -121,7 +121,7 @@ smpi_coll_tuned_allgather_2dmesh(void *send_buff, int send_count, MPI_Datatype
   rank = comm->rank();
   num_procs = comm->size();
 
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   block_size = extent * send_count;
 
@@ -141,7 +141,7 @@ smpi_coll_tuned_allgather_2dmesh(void *send_buff, int send_count, MPI_Datatype
 
   // do local allgather/local copy 
   recv_offset = rank * block_size;
-  smpi_datatype_copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
+  Datatype::copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
                  recv_count, recv_type);
 
   // do row-wise comm
index 8ec64ca..911c432 100644 (file)
@@ -107,7 +107,7 @@ int smpi_coll_tuned_allgather_3dmesh(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   if (!is_3dmesh(num_procs, &X, &Y, &Z))
     THROWF(arg_error,0, "allgather_3dmesh algorithm can't be used with this number of processes! ");
@@ -135,7 +135,7 @@ int smpi_coll_tuned_allgather_3dmesh(void *send_buff, int send_count,
 
   // do local allgather/local copy 
   recv_offset = rank * block_size;
-  smpi_datatype_copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
+  Datatype::copy(send_buff, send_count, send_type, (char *)recv_buff + recv_offset,
                  recv_count, recv_type);
 
   // do rowwise comm 
index 7ae8569..9b55717 100644 (file)
@@ -20,8 +20,8 @@ smpi_coll_tuned_allgather_NTSLR_NB(void *sbuf, int scount, MPI_Datatype stype,
 
   rank = comm->rank();
   size = comm->size();
-  rextent = smpi_datatype_get_extent(rtype);
-  sextent = smpi_datatype_get_extent(stype);
+  rextent = rtype->get_extent();
+  sextent = stype->get_extent();
   MPI_Request *rrequest_array;
   MPI_Request *srequest_array;
   rrequest_array = (MPI_Request *) xbt_malloc(size * sizeof(MPI_Request));
index 2c16c93..8900708 100644 (file)
@@ -20,8 +20,8 @@ smpi_coll_tuned_allgather_NTSLR(void *sbuf, int scount, MPI_Datatype stype,
 
   rank = comm->rank();
   size = comm->size();
-  rextent = smpi_datatype_get_extent(rtype);
-  sextent = smpi_datatype_get_extent(stype);
+  rextent = rtype->get_extent();
+  sextent = stype->get_extent();
 
   // irregular case use default MPI fucntions
   if (scount * sextent != rcount * rextent) {
index 91f6491..634eb21 100644 (file)
@@ -15,8 +15,8 @@ int smpi_coll_tuned_allgather_SMP_NTS(void *sbuf, int scount,
   comm_size = comm->size();
   rank = comm->rank();
   MPI_Aint rextent, sextent;
-  rextent = smpi_datatype_get_extent(rtype);
-  sextent = smpi_datatype_get_extent(stype);
+  rextent = rtype->get_extent();
+  sextent = stype->get_extent();
   int tag = COLL_TAG_ALLGATHER;
 
   int i, send_offset, recv_offset;
index 60a6c2c..c674f17 100644 (file)
@@ -91,14 +91,14 @@ int smpi_coll_tuned_allgather_bruck(void *send_buff, int send_count,
   rank = comm->rank();
 
   // get size of single element's type for recv buffer
-  recv_extent = smpi_datatype_get_extent(recv_type);
+  recv_extent = recv_type->get_extent();
 
   count = recv_count;
 
   tmp_buff = (char *) smpi_get_tmp_sendbuffer(num_procs * recv_count * recv_extent);
 
   // perform a local copy
-  smpi_datatype_copy(send_ptr, send_count, send_type,
+  Datatype::copy(send_ptr, send_count, send_type,
                     tmp_buff, recv_count, recv_type);
   while (pof2 <= (num_procs / 2)) {
     src = (rank + pof2) % num_procs;
index 832d65b..5bc889e 100644 (file)
@@ -32,8 +32,8 @@ if(comm->get_leaders_comm()==MPI_COMM_NULL){
 
   rank = comm->rank();
   MPI_Aint rextent, sextent;
-  rextent = smpi_datatype_get_extent(rtype);
-  sextent = smpi_datatype_get_extent(stype);
+  rextent = rtype->get_extent();
+  sextent = stype->get_extent();
   MPI_Request inter_rrequest;
   MPI_Request rrequest_array[128];
   MPI_Request srequest_array[128];
index 5e79dea..e69b3c8 100644 (file)
@@ -64,7 +64,7 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty
     size = comm->size();
 
     /* extract the rank,size information for the intra-node communicator */
-    recvtype_extent=smpi_datatype_get_extent(recvtype);
+    recvtype_extent=recvtype->get_extent();
     
     shmem_comm = comm->get_intra_comm();
     local_rank = shmem_comm->rank();
@@ -126,7 +126,7 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty
             }
 
 
-            void* sendbuf=((char*)recvbuf)+smpi_datatype_get_extent(recvtype)*displs[leader_comm->rank()];
+            void* sendbuf=((char*)recvbuf)+recvtype->get_extent()*displs[leader_comm->rank()];
 
             mpi_errno = mpi_coll_allgatherv_fun(sendbuf,
                                        (recvcnt*local_size),
@@ -137,7 +137,7 @@ int smpi_coll_tuned_allgather_mvapich2_smp(void *sendbuf,int sendcnt, MPI_Dataty
             xbt_free(displs);
             xbt_free(recvcnts);
         } else {
-        void* sendtmpbuf=((char*)recvbuf)+smpi_datatype_get_extent(recvtype)*(recvcnt*local_size)*leader_comm->rank();
+        void* sendtmpbuf=((char*)recvbuf)+recvtype->get_extent()*(recvcnt*local_size)*leader_comm->rank();
         
           
 
index 248651e..4a2fa1c 100644 (file)
@@ -94,10 +94,10 @@ smpi_coll_tuned_allgather_ompi_neighborexchange(void *sbuf, int scount,
    XBT_DEBUG(
                 "coll:tuned:allgather_intra_neighborexchange rank %d", rank);
 
-   err = smpi_datatype_extent (sdtype, &slb, &sext);
+   err = sdtype->extent(&slb, &sext);
    if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
-   err = smpi_datatype_extent (rdtype, &rlb, &rext);
+   err = rdtype->extent(&rlb, &rext);
    if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
    /* Initialization step:
@@ -107,7 +107,7 @@ smpi_coll_tuned_allgather_ompi_neighborexchange(void *sbuf, int scount,
    tmprecv = (char*) rbuf + rank * rcount * rext;
    if (MPI_IN_PLACE != sbuf) {
       tmpsend = (char*) sbuf;
-      smpi_datatype_copy (tmpsend, scount, sdtype, tmprecv, rcount, rdtype);
+      Datatype::copy (tmpsend, scount, sdtype, tmprecv, rcount, rdtype);
    } 
 
    /* Determine neighbors, order in which blocks will arrive, etc. */
index 74f801b..5dd17f7 100644 (file)
@@ -85,7 +85,7 @@ smpi_coll_tuned_allgather_pair(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "allgather pair algorithm can't be used with non power of two number of processes ! ");
 
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   // local send/recv
   Request::sendrecv(send_ptr, send_count, send_type, rank, tag,
index 2490663..93b0e77 100644 (file)
@@ -34,8 +34,8 @@ smpi_coll_tuned_allgather_rdb(void *sbuf, int send_count,
   unsigned int rank = comm->rank();
 
   // get size of single element's type for send buffer and recv buffer
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   // multiply size of each element by number of elements to send or recv
   send_chunk *= send_count;
index 7adc09b..4b9db92 100644 (file)
@@ -33,8 +33,8 @@ smpi_coll_tuned_allgather_rhv(void *sbuf, int send_count,
   unsigned int rank = comm->rank();
 
   // get size of single element's type for send buffer and recv buffer
-  s_extent = smpi_datatype_get_extent(send_type);
-  r_extent = smpi_datatype_get_extent(recv_type);
+  s_extent = send_type->get_extent();
+  r_extent = recv_type->get_extent();
 
   // multiply size of each element by number of elements to send or recv
   send_chunk = s_extent * send_count;
index f728fef..01c5b13 100644 (file)
@@ -80,7 +80,7 @@ smpi_coll_tuned_allgather_ring(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   // local send/recv
   Request::sendrecv(sendptr, send_count, send_type, rank, tag,
index 4dd59a0..1796752 100644 (file)
@@ -27,8 +27,8 @@ int smpi_coll_tuned_allgather_smp_simple(void *send_buf, int scount,
 
   rank = comm->rank();
   MPI_Aint rextent, sextent;
-  rextent = smpi_datatype_get_extent(rtype);
-  sextent = smpi_datatype_get_extent(stype);
+  rextent = rtype->get_extent();
+  sextent = stype->get_extent();
   int tag = COLL_TAG_ALLGATHER;
   MPI_Status status;
   int i, send_offset, recv_offset;
index 053c0cb..3f7a551 100644 (file)
@@ -82,7 +82,7 @@ smpi_coll_tuned_allgather_spreading_simple(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   num_reqs = (2 * num_procs) - 2;
   reqs = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
index 651dbd7..384dbc2 100644 (file)
@@ -36,12 +36,12 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
   if (total_count == 0)
     return MPI_ERR_COUNT;
 
-  recvtype_extent=smpi_datatype_get_extent( recvtype);
+  recvtype_extent=recvtype->get_extent();
 
   /* need to receive contiguously into tmp_buf because
      displs could make the recvbuf noncontiguous */
 
-  smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent);
+  recvtype->extent(&recvtype_true_lb, &recvtype_true_extent);
 
   tmp_buf_rl= (void*)smpi_get_tmp_sendbuffer(total_count*(MAX(recvtype_true_extent,recvtype_extent)));
 
@@ -54,7 +54,7 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
     position += recvcounts[i];
   if (sendbuf != MPI_IN_PLACE)
   {
-    smpi_datatype_copy(sendbuf, sendcount, sendtype,
+    Datatype::copy(sendbuf, sendcount, sendtype,
                        ((char *)tmp_buf + position*
                         recvtype_extent),
                        recvcounts[rank], recvtype);
@@ -62,7 +62,7 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
   else
   {
     /* if in_place specified, local data is found in recvbuf */
-    smpi_datatype_copy(((char *)recvbuf +
+    Datatype::copy(((char *)recvbuf +
                         displs[rank]*recvtype_extent),
                        recvcounts[rank], recvtype,
                        ((char *)tmp_buf + position*
@@ -203,7 +203,7 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
     if ((sendbuf != MPI_IN_PLACE) || (j != rank)) {
       /* not necessary to copy if in_place and
          j==rank. otherwise copy. */
-      smpi_datatype_copy(((char *)tmp_buf + position*recvtype_extent),
+      Datatype::copy(((char *)tmp_buf + position*recvtype_extent),
                          recvcounts[j], recvtype,
                          ((char *)recvbuf + displs[j]*recvtype_extent),
                          recvcounts[j], recvtype);
index 202c337..4dcca0a 100644 (file)
@@ -42,14 +42,14 @@ smpi_coll_tuned_allgatherv_mpich_ring(void *sendbuf, int sendcount,
   rank= comm->rank();
   comm_size=comm->size();
 
-  recvtype_extent= smpi_datatype_get_extent( recvtype);
+  recvtype_extent= recvtype->get_extent();
   total_count = 0;
   for (i=0; i<comm_size; i++)
     total_count += recvcounts[i];
 
   if (sendbuf != MPI_IN_PLACE) {
       /* First, load the "local" version in the recvbuf. */
-      smpi_datatype_copy(sendbuf, sendcount, send_type,
+      Datatype::copy(sendbuf, sendcount, send_type,
           ((char *)recvbuf + displs[rank]*recvtype_extent),
           recvcounts[rank], recvtype);
   }
index 64abe50..2f12eba 100644 (file)
@@ -97,9 +97,9 @@ int smpi_coll_tuned_allgatherv_ompi_bruck(void *sbuf, int scount,
    XBT_DEBUG(
                 "coll:tuned:allgather_ompi_bruck rank %d", rank);
    
-   smpi_datatype_extent (sdtype, &slb, &sext);
+   sdtype->extent(&slb, &sext);
 
-   smpi_datatype_extent (rdtype, &rlb, &rext);
+   rdtype->extent(&rlb, &rext);
 
    /* Initialization step:
       - if send buffer is not MPI_IN_PLACE, copy send buffer to block rank of 
@@ -108,7 +108,7 @@ int smpi_coll_tuned_allgatherv_ompi_bruck(void *sbuf, int scount,
    tmprecv = (char*) rbuf + rdispls[rank] * rext;
    if (MPI_IN_PLACE != sbuf) {
       tmpsend = (char*) sbuf;
-      smpi_datatype_copy(tmpsend, scount, sdtype, 
+      Datatype::copy(tmpsend, scount, sdtype, 
                             tmprecv, rcounts[rank], rdtype);
    }
    
@@ -148,13 +148,13 @@ int smpi_coll_tuned_allgatherv_ompi_bruck(void *sbuf, int scount,
           new_rcounts[i] = rcounts[tmp_rrank];
           new_rdispls[i] = rdispls[tmp_rrank];
       }
-      smpi_datatype_indexed(blockcount, new_scounts, new_sdispls, 
+      Datatype::create_indexed(blockcount, new_scounts, new_sdispls, 
                                     rdtype, &new_sdtype);
-      smpi_datatype_indexed(blockcount, new_rcounts, new_rdispls,
+      Datatype::create_indexed(blockcount, new_rcounts, new_rdispls,
                                     rdtype, &new_rdtype);
 
-      smpi_datatype_commit(&new_sdtype);
-      smpi_datatype_commit(&new_rdtype);
+      new_sdtype->commit();
+      new_rdtype->commit();
 
       /* Sendreceive */
       Request::sendrecv(rbuf, 1, new_sdtype, sendto,
@@ -162,8 +162,8 @@ int smpi_coll_tuned_allgatherv_ompi_bruck(void *sbuf, int scount,
                                      rbuf, 1, new_rdtype, recvfrom,
                                      COLL_TAG_ALLGATHERV,
                                      comm, MPI_STATUS_IGNORE);
-      smpi_datatype_unuse(new_sdtype);
-      smpi_datatype_unuse(new_rdtype);
+      new_sdtype->unuse();
+      new_rdtype->unuse();
 
    }
 
index 832ef9b..16c515a 100644 (file)
@@ -98,10 +98,10 @@ smpi_coll_tuned_allgatherv_ompi_neighborexchange(void *sbuf, int scount,
     XBT_DEBUG(
                  "coll:tuned:allgatherv_ompi_neighborexchange rank %d", rank);
 
-    err = smpi_datatype_extent (sdtype, &slb, &sext);
+    err = sdtype->extent(&slb, &sext);
     if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
-    err = smpi_datatype_extent (rdtype, &rlb, &rext);
+    err = rdtype->extent(&rlb, &rext);
     if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
     /* Initialization step:
@@ -111,7 +111,7 @@ smpi_coll_tuned_allgatherv_ompi_neighborexchange(void *sbuf, int scount,
     tmprecv = (char*) rbuf + rdispls[rank] * rext;
     if (MPI_IN_PLACE != sbuf) {
         tmpsend = (char*) sbuf;
-        err = smpi_datatype_copy(tmpsend, scount, sdtype, 
+        err = Datatype::copy(tmpsend, scount, sdtype, 
                               tmprecv, rcounts[rank], rdtype);
         if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl;  }
     } 
@@ -179,19 +179,19 @@ smpi_coll_tuned_allgatherv_ompi_neighborexchange(void *sbuf, int scount,
         new_scounts[1] = rcounts[(send_data_from + 1)];
         new_sdispls[0] = rdispls[send_data_from];
         new_sdispls[1] = rdispls[(send_data_from + 1)];
-        err = smpi_datatype_indexed(2, new_scounts, new_sdispls, rdtype, 
+        err = Datatype::create_indexed(2, new_scounts, new_sdispls, rdtype, 
                                       &new_sdtype);
         if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
-        smpi_datatype_commit(&new_sdtype);
+        new_sdtype->commit();
 
         new_rcounts[0] = rcounts[recv_data_from[i_parity]];
         new_rcounts[1] = rcounts[(recv_data_from[i_parity] + 1)];
         new_rdispls[0] = rdispls[recv_data_from[i_parity]];
         new_rdispls[1] = rdispls[(recv_data_from[i_parity] + 1)];
-        err = smpi_datatype_indexed(2, new_rcounts, new_rdispls, rdtype, 
+        err = Datatype::create_indexed(2, new_rcounts, new_rdispls, rdtype, 
                                       &new_rdtype);
         if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
-        smpi_datatype_commit(&new_rdtype);
+        new_rdtype->commit();
       
         tmprecv = (char*)rbuf;
         tmpsend = (char*)rbuf;
@@ -205,8 +205,8 @@ smpi_coll_tuned_allgatherv_ompi_neighborexchange(void *sbuf, int scount,
 
         send_data_from = recv_data_from[i_parity];
       
-        smpi_datatype_unuse(new_sdtype);
-        smpi_datatype_unuse(new_rdtype);
+        new_sdtype->unuse();
+        new_rdtype->unuse();
     }
 
     return MPI_SUCCESS;
index 97489cc..4a618c7 100644 (file)
@@ -85,7 +85,7 @@ smpi_coll_tuned_allgatherv_pair(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "allgatherv pair algorithm can't be used with non power of two number of processes ! ");
 
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   // local send/recv
   Request::sendrecv(send_ptr, send_count, send_type, rank, tag,
index 120f0ce..3b0c6cc 100644 (file)
@@ -80,7 +80,7 @@ smpi_coll_tuned_allgatherv_ring(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   // local send/recv
   Request::sendrecv(sendptr, send_count, send_type, rank, tag,
index 52a3e7e..1a56a3b 100644 (file)
@@ -34,7 +34,7 @@ smpi_coll_tuned_allreduce_lr(void *sbuf, void *rbuf, int rcount,
 
   /* make it compatible with all data type */
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
 
   /* when communication size is smaller than number of process (not support) */
   if (rcount < size) {
index 2bd21ce..e887175 100644 (file)
@@ -49,8 +49,8 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
     is_commutative = (op==MPI_OP_NULL || op->is_commutative());
 
     /* need to allocate temporary buffer to store incoming data */
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
-    extent = smpi_datatype_get_extent(datatype);
+    datatype->extent(&true_lb, &true_extent);
+    extent = datatype->get_extent();
 
     tmp_buf_free= smpi_get_tmp_recvbuffer(count * (MAX(extent, true_extent)));
 
@@ -60,7 +60,7 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
     /* copy local data into recvbuf */
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno =
-            smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count,
+            Datatype::copy(sendbuf, count, datatype, recvbuf, count,
                            datatype);
     }
 
@@ -137,7 +137,7 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
                     /* op is noncommutative and the order is not right */
                     if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
                     /* copy result back into recvbuf */
-                    mpi_errno = smpi_datatype_copy(tmp_buf, count, datatype,
+                    mpi_errno = Datatype::copy(tmp_buf, count, datatype,
                                                recvbuf, count, datatype);
                 }
                 mask <<= 1;
index def7b4f..b09b50d 100644 (file)
@@ -100,7 +100,7 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf,
     if (count == 0) {
         return MPI_SUCCESS;
     }
-    smpi_datatype_extent(datatype, &true_lb,
+    datatype->extent(&true_lb,
                                        &true_extent);
 
     total_size = comm->size();
@@ -112,7 +112,7 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf,
 
     if (local_rank == 0) {
         if (sendbuf != MPI_IN_PLACE) {
-            smpi_datatype_copy(sendbuf, count, datatype, recvbuf,
+            Datatype::copy(sendbuf, count, datatype, recvbuf,
                                        count, datatype);
         }
     }
@@ -132,8 +132,8 @@ int smpi_coll_tuned_allreduce_mvapich2_two_level(void *sendbuf,
         }
 
         if (local_size != total_size) {
-          void* sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
-          smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
+          void* sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*datatype->get_extent());
+          Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
             /* inter-node allreduce */
             if(MV2_Allreduce_function == &MPIR_Allreduce_pt2pt_rd_MV2){
                 mpi_errno =
index a7ae57b..8ed4e69 100644 (file)
@@ -183,18 +183,18 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count,
    /* Special case for size == 1 */
    if (1 == size) {
       if (MPI_IN_PLACE != sbuf) {
-      ret= smpi_datatype_copy(sbuf, count, dtype,rbuf, count, dtype);
+      ret= Datatype::copy(sbuf, count, dtype,rbuf, count, dtype);
          if (ret < 0) { line = __LINE__; goto error_hndl; }
       }
       return MPI_SUCCESS;
    }
    
    /* Determine segment count based on the suggested segment size */
-   extent = smpi_datatype_get_extent(dtype);
+   extent = dtype->get_extent();
    if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; }
-   true_extent = smpi_datatype_get_extent(dtype);
+   true_extent = dtype->get_extent();
    if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; }
-   typelng = smpi_datatype_size(dtype);
+   typelng = dtype->size();
    if (MPI_SUCCESS != ret) { line = __LINE__; goto error_hndl; }
    segcount = count;
    COLL_TUNED_COMPUTED_SEGCOUNT(segsize, typelng, segcount)
@@ -238,7 +238,7 @@ smpi_coll_tuned_allreduce_ompi_ring_segmented(void *sbuf, void *rbuf, int count,
 
    /* Handle MPI_IN_PLACE */
    if (MPI_IN_PLACE != sbuf) {
-      ret= smpi_datatype_copy(sbuf, count, dtype,rbuf, count, dtype);
+      ret= Datatype::copy(sbuf, count, dtype,rbuf, count, dtype);
       if (ret < 0) { line = __LINE__; goto error_hndl; }
    }
 
index 34c0875..29d727f 100644 (file)
@@ -21,10 +21,10 @@ int smpi_coll_tuned_allreduce_rab_rdb(void *sbuff, void *rbuff, int count,
   unsigned int nprocs = comm->size();
   int rank = comm->rank();
 
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
-  smpi_datatype_copy(sbuff, count, dtype, rbuff, count, dtype);
+  Datatype::copy(sbuff, count, dtype, rbuff, count, dtype);
 
   // find nearest power-of-two less than or equal to comm_size
   pof2 = 1;
index 5741ab6..687aa7d 100644 (file)
@@ -26,7 +26,7 @@ int smpi_coll_tuned_allreduce_rab1(void *sbuff, void *rbuff,
   if((nprocs&(nprocs-1)))
     THROWF(arg_error,0, "allreduce rab1 algorithm can't be used with non power of two number of processes ! ");
 
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
 
   pof2 = 1;
   while (pof2 <= nprocs)
index 04d10d8..d11b9f2 100644 (file)
@@ -30,7 +30,7 @@ int smpi_coll_tuned_allreduce_rab2(void *sbuff, void *rbuff,
   nprocs = comm->size();
 
 
-  s_extent = smpi_datatype_get_extent(dtype);
+  s_extent = dtype->get_extent();
 
   // uneven count
   if (count % nprocs) {
index 8d52fc6..5fc1f2b 100644 (file)
@@ -28,7 +28,7 @@ int smpi_coll_tuned_allreduce_rdb(void *sbuff, void *rbuff, int count,
   nprocs=comm->size();
   rank=comm->rank();
 
-  smpi_datatype_extent(dtype, &lb, &extent);
+  dtype->extent(&lb, &extent);
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   Request::sendrecv(sbuff, count, dtype, rank, 500,
index 701dd0e..d0255a5 100644 (file)
@@ -59,7 +59,7 @@ int smpi_coll_tuned_allreduce_smp_binomial_pipeline(void *send_buf,
   comm_size = comm->size();
   rank = comm->rank();
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   int intra_rank, inter_rank;
index 865b276..a813a45 100644 (file)
@@ -48,7 +48,7 @@ int smpi_coll_tuned_allreduce_smp_binomial(void *send_buf, void *recv_buf,
   comm_size=comm->size();
   rank=comm->rank();
   MPI_Aint extent, lb;
-  smpi_datatype_extent(dtype, &lb, &extent);
+  dtype->extent(&lb, &extent);
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   /* compute intra and inter ranking */
index b303642..c82a3ea 100644 (file)
@@ -55,7 +55,7 @@ int smpi_coll_tuned_allreduce_smp_rdb(void *send_buf, void *recv_buf, int count,
   comm_size = comm->size();
   rank = comm->rank();
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   /* compute intra and inter ranking */
index 5ef7a76..e005025 100644 (file)
@@ -43,7 +43,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_lr(void *send_buf, void *recv_buf,
   comm_size = comm->size();
   rank = comm->rank();
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   int intra_rank, inter_rank;
index 29eb8cc..5b54dc1 100644 (file)
@@ -42,7 +42,7 @@ int smpi_coll_tuned_allreduce_smp_rsag_rab(void *sbuf, void *rbuf, int count,
 
   rank = comm->rank();
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   int intra_rank, inter_rank;
index 379d865..1af6949 100644 (file)
@@ -42,7 +42,7 @@ int smpi_coll_tuned_allreduce_smp_rsag(void *send_buf, void *recv_buf,
   comm_size = comm->size();
   rank = comm->rank();
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
 
   int intra_rank, inter_rank;
index 3451012..28a3c77 100644 (file)
@@ -70,7 +70,7 @@ int smpi_coll_tuned_alltoall_2dmesh(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   if (!alltoall_check_is_2dmesh(num_procs, &X, &Y))
     return MPI_ERR_OTHER;
index 695f6d7..10735e0 100644 (file)
@@ -62,7 +62,7 @@ int smpi_coll_tuned_alltoall_3dmesh(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(send_type);
+  extent = send_type->get_extent();
 
   if (!alltoall_check_is_3dmesh(num_procs, &X, &Y, &Z))
     return MPI_ERR_OTHER;
index b4922c8..026d9bb 100644 (file)
@@ -46,7 +46,7 @@ smpi_coll_tuned_alltoall_bruck(void *send_buff, int send_count,
   num_procs = comm->size();
   rank = comm->rank();
 
-  extent = smpi_datatype_get_extent(recv_type);
+  extent = recv_type->get_extent();
 
   tmp_buff = (char *) smpi_get_tmp_sendbuffer(num_procs * recv_count * extent);
   disps = (int *) xbt_malloc(sizeof(int) * num_procs);
index 3cc984f..348f069 100644 (file)
@@ -65,8 +65,8 @@ int smpi_coll_tuned_alltoall_mvapich2_scatter_dest(
     rank = comm->rank();
     
     /* Get extent of send and recv types */
-    recvtype_extent = smpi_datatype_get_extent(recvtype);
-    sendtype_extent = smpi_datatype_get_extent(sendtype);
+    recvtype_extent = recvtype->get_extent();
+    sendtype_extent = sendtype->get_extent();
     
     /* Medium-size message. Use isend/irecv with scattered
      destinations. Use Tony Ladd's modification to post only
index 1fc0893..82d80de 100644 (file)
@@ -49,8 +49,8 @@ smpi_coll_tuned_alltoall_pair_light_barrier(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoall pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index 280d94f..3382341 100644 (file)
@@ -46,8 +46,8 @@ smpi_coll_tuned_alltoall_pair_mpi_barrier(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoall pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index 0e145d8..75ac17b 100644 (file)
@@ -47,8 +47,8 @@ smpi_coll_tuned_alltoall_pair_one_barrier(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoall pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index f0e127b..3e5c4f4 100644 (file)
@@ -42,8 +42,8 @@ int smpi_coll_tuned_alltoall_pair_rma(void *send_buff, int send_count, MPI_Datat
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   win=new  Win(recv_buff, num_procs * recv_chunk * send_count, recv_chunk, 0,
                  comm);
@@ -81,8 +81,8 @@ int smpi_coll_tuned_alltoall_pair(void *send_buff, int send_count,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoall pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index 41f78ca..709e454 100644 (file)
@@ -47,9 +47,9 @@ int smpi_coll_tuned_alltoall_rdb(void *send_buff, int send_count,
 
   num_procs = comm->size();
   rank = comm->rank();
-  send_increment = smpi_datatype_get_extent(send_type);
-  recv_increment = smpi_datatype_get_extent(recv_type);
-  extent = smpi_datatype_get_extent(recv_type);
+  send_increment = send_type->get_extent();
+  recv_increment = recv_type->get_extent();
+  extent = recv_type->get_extent();
 
   send_increment *= (send_count * num_procs);
   recv_increment *= (recv_count * num_procs);
index 04749d1..8bd4dcf 100644 (file)
@@ -45,8 +45,8 @@ smpi_coll_tuned_alltoall_ring_light_barrier(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index b94671d..20a1a43 100644 (file)
@@ -42,8 +42,8 @@ smpi_coll_tuned_alltoall_ring_mpi_barrier(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index 83f0237..577496d 100644 (file)
@@ -41,8 +41,8 @@ smpi_coll_tuned_alltoall_ring_one_barrier(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index b023001..34138e8 100644 (file)
@@ -41,8 +41,8 @@ smpi_coll_tuned_alltoall_ring(void *send_buff, int send_count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   send_chunk *= send_count;
   recv_chunk *= recv_count;
index 5cef5c7..3be1b0b 100644 (file)
@@ -30,11 +30,11 @@ int smpi_coll_tuned_alltoallv_bruck(void *sendbuf, int *sendcounts, int *senddis
   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 */
   err =
-      smpi_datatype_copy((char *)sendbuf + senddisps[rank] * sendext,
+      Datatype::copy((char *)sendbuf + senddisps[rank] * sendext,
                          sendcounts[rank], sendtype,
                          (char *)recvbuf + recvdisps[rank] * recvext,
                          recvcounts[rank], recvtype);
index e7d7da7..6d970cd 100644 (file)
@@ -32,14 +32,14 @@ smpi_coll_tuned_alltoallv_ompi_basic_linear(void *sbuf, int *scounts, int *sdisp
     XBT_DEBUG(
                  "coll:tuned:alltoallv_intra_basic_linear rank %d", rank);
 
-    sext=smpi_datatype_get_extent(sdtype);
-    rext=smpi_datatype_get_extent(rdtype);
+    sext=sdtype->get_extent();
+    rext=rdtype->get_extent();
 
     /* Simple optimization - handle send to self first */
     psnd = ((char *) sbuf) + (sdisps[rank] * sext);
     prcv = ((char *) rbuf) + (rdisps[rank] * rext);
     if (0 != scounts[rank]) {
-        smpi_datatype_copy(psnd, scounts[rank], sdtype,
+        Datatype::copy(psnd, scounts[rank], sdtype,
                               prcv, rcounts[rank], rdtype);
     }
 
index 6637187..d5ad392 100644 (file)
@@ -49,8 +49,8 @@ smpi_coll_tuned_alltoallv_pair_light_barrier(void *send_buff, int *send_counts,
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoallv pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   Request::sendrecv(send_ptr + send_disps[rank] * send_chunk, send_counts[rank], send_type, rank, tag,
                recv_ptr + recv_disps[rank] * recv_chunk, recv_counts[rank], recv_type, rank, tag,
index 8d4dfb5..454a110 100644 (file)
@@ -46,8 +46,8 @@ smpi_coll_tuned_alltoallv_pair_mpi_barrier(void *send_buff, int *send_counts, in
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoallv pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   for (i = 0; i < num_procs; i++) {
     src = dst = rank ^ i;
index 0ab3b28..66b04e2 100644 (file)
@@ -46,8 +46,8 @@ smpi_coll_tuned_alltoallv_pair_one_barrier(void *send_buff, int *send_counts, in
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoallv pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   smpi_mpi_barrier(comm);
   for (i = 0; i < num_procs; i++) {
index d127c04..f816e7a 100644 (file)
@@ -46,8 +46,8 @@ int smpi_coll_tuned_alltoallv_pair(void *send_buff, int *send_counts, int *send_
   if((num_procs&(num_procs-1)))
     THROWF(arg_error,0, "alltoallv pair algorithm can't be used with non power of two number of processes ! ");
 
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   for (i = 0; i < num_procs; i++) {
     src = dst = rank ^ i;
index 48cc255..d363abc 100644 (file)
@@ -45,8 +45,8 @@ smpi_coll_tuned_alltoallv_ring_light_barrier(void *send_buff, int *send_counts,
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   Request::sendrecv(send_ptr + send_disps[rank] * send_chunk, send_counts[rank], send_type, rank, tag,
                recv_ptr + recv_disps[rank] * recv_chunk, recv_counts[rank], recv_type, rank, tag,
index 69204c3..988d63c 100644 (file)
@@ -42,8 +42,8 @@ smpi_coll_tuned_alltoallv_ring_mpi_barrier(void *send_buff, int *send_counts, in
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   for (i = 0; i < num_procs; i++) {
     src = (rank - i + num_procs) % num_procs;
index 46e4dfc..e972a37 100644 (file)
@@ -41,8 +41,8 @@ smpi_coll_tuned_alltoallv_ring_one_barrier(void *send_buff, int *send_counts, in
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
 
   smpi_mpi_barrier(comm);
   for (i = 0; i < num_procs; i++) {
index c8937a2..e64fe12 100644 (file)
@@ -42,8 +42,8 @@ smpi_coll_tuned_alltoallv_ring(void *send_buff, int *send_counts, int *send_disp
 
   rank = comm->rank();
   num_procs = comm->size();
-  send_chunk = smpi_datatype_get_extent(send_type);
-  recv_chunk = smpi_datatype_get_extent(recv_type);
+  send_chunk = send_type->get_extent();
+  recv_chunk = recv_type->get_extent();
   int pof2 = ((num_procs != 0) && ((num_procs & (~num_procs + 1)) == num_procs));
   for (i = 0; i < num_procs; i++) {
   
index c5ec8cd..6d32644 100644 (file)
@@ -22,7 +22,7 @@ int smpi_coll_tuned_bcast_NTSB(void *buf, int count, MPI_Datatype datatype,
   MPI_Status *recv_status_array;
 
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 31d0e0a..e259cba 100644 (file)
@@ -24,7 +24,7 @@ int smpi_coll_tuned_bcast_NTSL_Isend(void *buf, int count, MPI_Datatype datatype
   int rank, size;
   int i;
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 773f097..80a1167 100644 (file)
@@ -24,7 +24,7 @@ int smpi_coll_tuned_bcast_NTSL(void *buf, int count, MPI_Datatype datatype,
   int rank, size;
   int i;
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 05cacd5..5cdf4d5 100644 (file)
@@ -21,7 +21,7 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
   int rank, size;
   int i;
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 70390f6..c440a11 100644 (file)
@@ -20,7 +20,7 @@ int smpi_coll_tuned_bcast_SMP_linear(void *buf, int count,
   int rank, size;
   int i;
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 2d3449e..b6cb247 100644 (file)
@@ -48,7 +48,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware_wait(void *buf, int count,
   int header_size = BCAST_ARRIVAL_PATTERN_AWARE_HEADER_SIZE;
 
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   /* source and destination */
   int to, from;
index 93dc6a3..ff1a1c6 100644 (file)
@@ -38,7 +38,7 @@ int smpi_coll_tuned_bcast_arrival_pattern_aware(void *buf, int count,
   char temp_buf[MAX_NODE];
 
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   /* destination */
   int to;
index 6fba7eb..7ca4fd6 100644 (file)
@@ -47,7 +47,7 @@ int smpi_coll_tuned_bcast_arrival_scatter(void *buf, int count,
   int header_size = BCAST_ARRIVAL_PATTERN_AWARE_HEADER_SIZE;
 
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
 
   /* source and destination */
index 29701ba..21e247e 100644 (file)
@@ -17,7 +17,7 @@ smpi_coll_tuned_bcast_flattree_pipeline(void *buff, int count,
   int tag = COLL_TAG_BCAST;
 
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(data_type);
+  extent = data_type->get_extent();
 
   int segment = flattree_segment_in_byte / extent;
   segment =  segment == 0 ? 1 :segment; 
index 886f48e..084bc40 100644 (file)
@@ -296,7 +296,7 @@ int smpi_coll_tuned_bcast_mvapich2_intra_node(void *buffer,
      * possible, and MPI_Pack_size() in other places.
      */
     //if (is_homogeneous) {
-        type_size=smpi_datatype_size(datatype);
+        type_size=datatype->size();
     //}
 /*    else {*/
 /*        MPIR_Pack_size_impl(1, datatype, &type_size);*/
index 802389d..7701fce 100644 (file)
@@ -40,7 +40,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
     /**
      * Determine number of elements sent per operation.
      */
-    type_size = smpi_datatype_size(datatype);
+    type_size = datatype->size();
 
     size = comm->size();
     rank = comm->rank();
@@ -76,7 +76,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
 
 
 
-    extent = smpi_datatype_get_extent (datatype);
+    extent = datatype->get_extent();
     num_segments = (original_count + count_by_segment - 1) / count_by_segment;
     realsegsize = count_by_segment * extent;
     
index 044d3a7..c2de44c 100644 (file)
@@ -90,7 +90,7 @@ smpi_coll_tuned_bcast_ompi_split_bintree ( void* buffer,
 
     //compute again segsize
     const size_t intermediate_message_size = 370728;
-    size_t message_size = smpi_datatype_size(datatype) * (unsigned long)count;
+    size_t message_size = datatype->size() * (unsigned long)count;
     if(message_size < intermediate_message_size) 
       segsize = 1024 ;
     else
@@ -105,7 +105,7 @@ smpi_coll_tuned_bcast_ompi_split_bintree ( void* buffer,
     /* setup the binary tree topology. */
     tree = ompi_coll_tuned_topo_build_tree(2,comm,root);
 
-    type_size = smpi_datatype_size( datatype );
+    type_size = datatype->size();
 
     /* Determine number of segments and number of elements per segment */
     counts[0] = count/2;
@@ -137,7 +137,7 @@ smpi_coll_tuned_bcast_ompi_split_bintree ( void* buffer,
         return (smpi_coll_tuned_bcast_SMP_linear ( buffer, count, datatype, 
                                                     root, comm));
     }
-    type_extent = smpi_datatype_get_extent(datatype);
+    type_extent = datatype->get_extent();
 
     
     /* Determine real segment size */
index 96ed610..9dae6f1 100644 (file)
@@ -81,7 +81,7 @@ smpi_coll_tuned_bcast_scatter_LR_allgather(void *buff, int count,
 
   rank = comm->rank();
   num_procs = comm->size();
-  extent = smpi_datatype_get_extent(data_type);
+  extent = data_type->get_extent();
 
 
   nbytes = extent * count;
index 4328434..e5e0bef 100644 (file)
@@ -1,5 +1,4 @@
 #include "colls_private.h"
-#include "src/smpi/smpi_mpi_dt_private.h"
 
 static int scatter_for_bcast(
     int root,
@@ -138,7 +137,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
      * possible, and MPI_Pack_size() in other places.
      */
     if (is_homogeneous)
-        type_size=smpi_datatype_size(datatype);
+        type_size=datatype->size();
 
     nbytes = type_size * count;
     if (nbytes == 0)
@@ -147,7 +146,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
     if (is_contig && is_homogeneous)
     {
         /* contiguous and homogeneous. no need to pack. */
-        smpi_datatype_extent(datatype, &true_lb, &true_extent);
+        datatype->extent(&true_lb, &true_extent);
 
         tmp_buf = (char *) buffer + true_lb;
     }
@@ -158,7 +157,7 @@ smpi_coll_tuned_bcast_scatter_rdb_allgather (
         /* TODO: Pipeline the packing and communication */
         position = 0;
         if (rank == root) {
-            mpi_errno = smpi_mpi_pack(buffer, count, datatype, tmp_buf, nbytes,
+            mpi_errno = datatype->pack(buffer, count, tmp_buf, nbytes,
                                        &position, comm);
             if (mpi_errno) xbt_die("crash while packing %d", mpi_errno);
         }
index a2ea22d..b7574c1 100644 (file)
@@ -89,12 +89,12 @@ static int MPIR_pt_pt_intra_gather( void *sendbuf, int sendcnt, MPI_Datatype sen
 
 
     if (sendtype != MPI_DATATYPE_NULL) {
-        smpi_datatype_extent(sendtype, &true_lb,
+        sendtype->extent(&true_lb,
                                        &sendtype_true_extent);
     }
     if (recvtype != MPI_DATATYPE_NULL) {
-        recvtype_extent=smpi_datatype_get_extent(recvtype);
-        smpi_datatype_extent(recvtype, &true_lb,
+        recvtype_extent=recvtype->get_extent();
+        recvtype->extent(&true_lb,
                                        &recvtype_true_extent);
     }
     
@@ -160,15 +160,15 @@ int smpi_coll_tuned_gather_mvapich2_two_level(void *sendbuf,
     }
 
     if (sendtype != MPI_DATATYPE_NULL) {
-        sendtype_extent=smpi_datatype_get_extent(sendtype);
-        sendtype_size=smpi_datatype_size(sendtype);
-        smpi_datatype_extent(sendtype, &true_lb,
+        sendtype_extent=sendtype->get_extent();
+        sendtype_size=sendtype->size();
+        sendtype->extent(&true_lb,
                                        &sendtype_true_extent);
     }
     if (recvtype != MPI_DATATYPE_NULL) {
-        recvtype_extent=smpi_datatype_get_extent(recvtype);
-        recvtype_size=smpi_datatype_size(recvtype);
-        smpi_datatype_extent(recvtype, &true_lb,
+        recvtype_extent=recvtype->get_extent();
+        recvtype_size=recvtype->size();
+        recvtype->extent(&true_lb,
                                        &recvtype_true_extent);
     }
 
index 0e1ea4a..c6c8f5e 100644 (file)
@@ -58,19 +58,19 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
     bmtree = ompi_coll_tuned_topo_build_in_order_bmtree(comm, root);
     // data->cached_in_order_bmtree;
 
-    smpi_datatype_extent(sdtype, &slb, &sextent);
-    smpi_datatype_extent(sdtype, &strue_lb, &strue_extent);
+    sdtype->extent(&slb, &sextent);
+    sdtype->extent(&strue_lb, &strue_extent);
 
     vrank = (rank - root + size) % size;
 
     if (rank == root) {
-        smpi_datatype_extent(rdtype, &rlb, &rextent);
-        smpi_datatype_extent(rdtype, &rtrue_lb, &rtrue_extent);
+        rdtype->extent(&rlb, &rextent);
+        rdtype->extent(&rtrue_lb, &rtrue_extent);
        if (0 == root){
            /* root on 0, just use the recv buffer */
            ptmp = (char *) rbuf;
            if (sbuf != MPI_IN_PLACE) {
-               err = smpi_datatype_copy(sbuf, scount, sdtype,
+               err = Datatype::copy(sbuf, scount, sdtype,
                                      ptmp, rcount, rdtype);
                if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
            }
@@ -85,12 +85,12 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
            ptmp = tempbuf - rlb;
            if (sbuf != MPI_IN_PLACE) {
                /* copy from sbuf to temp buffer */
-               err = smpi_datatype_copy(sbuf, scount, sdtype,
+               err = Datatype::copy(sbuf, scount, sdtype,
                                      ptmp, rcount, rdtype);
                if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
            } else {
                /* copy from rbuf to temp buffer  */
-               err = smpi_datatype_copy((char *) rbuf + rank*rextent*rcount, rcount, rdtype, ptmp, rcount, rdtype );
+               err = Datatype::copy((char *) rbuf + rank*rextent*rcount, rcount, rdtype, ptmp, rcount, rdtype );
                if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
            }
        }
@@ -106,7 +106,7 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
 
        ptmp = tempbuf - slb;
        /* local copy to tempbuf */
-       err = smpi_datatype_copy(sbuf, scount, sdtype,
+       err = Datatype::copy(sbuf, scount, sdtype,
                                    ptmp, scount, sdtype);
        if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
@@ -160,12 +160,12 @@ smpi_coll_tuned_gather_ompi_binomial(void *sbuf, int scount,
     if (rank == root) {
        if (root != 0) {
            /* rotate received data on root if root != 0 */
-           err = smpi_datatype_copy(ptmp, rcount*(size - root), rdtype,
+           err = Datatype::copy(ptmp, rcount*(size - root), rdtype,
                                                 (char *) rbuf + rextent*root*rcount, rcount*(size - root), rdtype );
            if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
 
-           err = smpi_datatype_copy( ptmp + rextent*rcount*(size-root), rcount*root,rdtype, 
+           err = Datatype::copy( ptmp + rextent*rcount*(size-root), rcount*root,rdtype, 
                                                 (char *) rbuf,rcount*root,rdtype);
            if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
@@ -216,10 +216,10 @@ smpi_coll_tuned_gather_ompi_linear_sync(void *sbuf, int scount,
     
     size_t dsize, block_size;
     if (rank == root) {
-        dsize= smpi_datatype_size(rdtype);
+        dsize= rdtype->size();
         block_size = dsize * rcount;
     } else {
-        dsize=smpi_datatype_size(sdtype);
+        dsize=sdtype->size();
         block_size = dsize * scount;
     }
     
@@ -239,8 +239,8 @@ smpi_coll_tuned_gather_ompi_linear_sync(void *sbuf, int scount,
            - send the second segment of the data.
         */
 
-        typelng= smpi_datatype_size(sdtype);
-        smpi_datatype_extent(sdtype, &lb, &extent);
+        typelng= sdtype->size();
+        sdtype->extent(&lb, &extent);
         first_segment_count = scount;
         COLL_TUNED_COMPUTED_SEGCOUNT( (size_t) first_segment_size, typelng, 
                                       first_segment_count );
@@ -274,8 +274,8 @@ smpi_coll_tuned_gather_ompi_linear_sync(void *sbuf, int scount,
         reqs = (MPI_Request *) calloc(size, sizeof(MPI_Request ));
         if (NULL == reqs) { ret = -1; line = __LINE__; goto error_hndl; }
         
-        typelng=smpi_datatype_size(rdtype);
-        smpi_datatype_extent(rdtype, &lb, &extent);
+        typelng=rdtype->size();
+        rdtype->extent(&lb, &extent);
         first_segment_count = rcount;
         COLL_TUNED_COMPUTED_SEGCOUNT( (size_t)first_segment_size, typelng, 
                                       first_segment_count );
@@ -310,7 +310,7 @@ smpi_coll_tuned_gather_ompi_linear_sync(void *sbuf, int scount,
 
         /* copy local data if necessary */
         if (MPI_IN_PLACE != sbuf) {
-            ret = smpi_datatype_copy(sbuf, scount, sdtype,
+            ret = Datatype::copy(sbuf, scount, sdtype,
                                   (char*)rbuf + rank * rcount * extent, 
                                   rcount, rdtype);
             if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
@@ -386,12 +386,12 @@ smpi_coll_tuned_gather_ompi_basic_linear(void *sbuf, int scount,
 
     /* I am the root, loop receiving the data. */
 
-    smpi_datatype_extent(rdtype, &lb, &extent);
+    rdtype->extent(&lb, &extent);
     incr = extent * rcount;
     for (i = 0, ptmp = (char *) rbuf; i < size; ++i, ptmp += incr) {
         if (i == rank) {
             if (MPI_IN_PLACE != sbuf) {
-                err = smpi_datatype_copy(sbuf, scount, sdtype,
+                err = Datatype::copy(sbuf, scount, sdtype,
                                       ptmp, rcount, rdtype);
             } else {
                 err = MPI_SUCCESS;
index f0af751..1de7678 100644 (file)
@@ -25,7 +25,7 @@ int smpi_coll_tuned_reduce_NTSL(void *buf, void *rbuf, int count,
   int rank, size;
   int i;
   MPI_Aint extent;
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   rank = comm->rank();
   size = comm->size();
index 3486dfb..8edaf64 100644 (file)
@@ -47,7 +47,7 @@ int smpi_coll_tuned_reduce_arrival_pattern_aware(void *buf, void *rbuf,
   char temp_buf[MAX_NODE];
 
   MPI_Aint extent, lb;
-  smpi_datatype_extent(datatype, &lb, &extent);
+  datatype->extent(&lb, &extent);
 
   /* source and destination */
   int to, from;
index 53a802d..ebf0c1e 100644 (file)
@@ -25,7 +25,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
   rank = comm->rank();
   comm_size = comm->size();
 
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
   int is_commutative =  (op==MPI_OP_NULL || op->is_commutative());
@@ -38,7 +38,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
         lroot   = 0;
   relrank = (rank - lroot + comm_size) % comm_size;
 
-  smpi_datatype_extent(datatype, &true_lb, &true_extent);
+  datatype->extent(&true_lb, &true_extent);
 
   /* adjust for potential negative lower bound in datatype */
   tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -50,7 +50,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
       recvbuf = (void *)((char*)recvbuf - true_lb);
   }
    if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
-      smpi_datatype_copy(sendbuf, count, datatype, recvbuf,count, datatype);
+      Datatype::copy(sendbuf, count, datatype, recvbuf,count, datatype);
   }
 
   while (mask < comm_size) {
@@ -65,7 +65,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
           if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
         } else {
           if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
-          smpi_datatype_copy(tmp_buf, count, datatype,recvbuf, count, datatype);
+          Datatype::copy(tmp_buf, count, datatype,recvbuf, count, datatype);
         }
       }
     } else {
index b4c3635..c556f9b 100644 (file)
@@ -24,7 +24,7 @@ smpi_coll_tuned_reduce_flat_tree(void *sbuf, void *rbuf, int count,
   size = comm->size();
 
   /* If not root, send data to the root. */
-  extent = smpi_datatype_get_extent(dtype);
+  extent = dtype->get_extent();
 
   if (rank != root) {
     Request::send(sbuf, count, dtype, root, tag, comm);
index f0183fe..3af0007 100644 (file)
@@ -142,8 +142,8 @@ int smpi_coll_tuned_reduce_mvapich2_knomial (
 
     /* Create a temporary buffer */
 
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
-    extent = smpi_datatype_get_extent(datatype);
+    datatype->extent(&true_lb, &true_extent);
+    extent = datatype->get_extent();
 
     is_commutative =  (op==MPI_OP_NULL || op->is_commutative());
 
@@ -153,7 +153,7 @@ int smpi_coll_tuned_reduce_mvapich2_knomial (
     }
 
     if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
-        mpi_errno = smpi_datatype_copy(sendbuf, count, datatype, recvbuf,
+        mpi_errno = Datatype::copy(sendbuf, count, datatype, recvbuf,
                 count, datatype);
     }
 
index 8a2a44d..c7e0c6c 100644 (file)
@@ -113,9 +113,9 @@ int smpi_coll_tuned_reduce_mvapich2_two_level( void *sendbuf,
 
     is_commutative= (op==MPI_OP_NULL || op->is_commutative());
 
-    smpi_datatype_extent(datatype, &true_lb,
+    datatype->extent(&true_lb,
                                        &true_extent);
-    extent =smpi_datatype_get_extent(datatype);
+    extent =datatype->get_extent();
     stride = count * MAX(extent, true_extent);
 
     if (local_size == total_size) {
@@ -255,16 +255,16 @@ int smpi_coll_tuned_reduce_mvapich2_two_level( void *sendbuf,
                 } else { 
 
                      in_buf = (char *)smpi_get_tmp_sendbuffer(count*
-                                       smpi_datatype_get_extent(datatype));
-                     smpi_datatype_copy(tmp_buf, count, datatype,
+                                       datatype->get_extent());
+                     Datatype::copy(tmp_buf, count, datatype,
                                         in_buf, count, datatype);
                     //in_buf = MPI_IN_PLACE; 
                     out_buf = recvbuf; 
                 } 
             } else {
                 in_buf = (char *)smpi_get_tmp_sendbuffer(count*
-                                       smpi_datatype_get_extent(datatype));
-                smpi_datatype_copy(tmp_buf, count, datatype,
+                                       datatype->get_extent());
+                Datatype::copy(tmp_buf, count, datatype,
                                         in_buf, count, datatype);
                 //in_buf = MPI_IN_PLACE;
                 out_buf = tmp_buf;
index d71947c..32bd615 100644 (file)
@@ -58,7 +58,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi
      * Determine number of segments and number of elements
      * sent per operation
      */
-    smpi_datatype_extent( datatype, &lower_bound, &extent);
+    datatype->extent(&lower_bound, &extent);
     num_segments = (original_count + count_by_segment - 1) / count_by_segment;
     segment_increment = count_by_segment * extent;
 
@@ -75,7 +75,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi
        (if needed) */
     if( tree->tree_nextsize > 0 ) {
         ptrdiff_t true_extent, real_segment_size;
-        true_extent=smpi_datatype_get_extent( datatype);
+        true_extent=datatype->get_extent();
 
         /* handle non existant recv buffer (i.e. its NULL) and 
            protect the recv buffer on non-root nodes */
@@ -93,7 +93,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi
         /* If this is a non-commutative operation we must copy
            sendbuf to the accumbuf, in order to simplfy the loops */
         if ( (op!=MPI_OP_NULL && !op->is_commutative())) {
-            smpi_datatype_copy(
+            Datatype::copy(
                                                 (char*)sendtmpbuf, original_count, datatype,
                                                 (char*)accumbuf, original_count, datatype);
         }
@@ -341,7 +341,7 @@ int smpi_coll_tuned_reduce_ompi_chain( void *sendbuf, void *recvbuf, int count,
      * Determine number of segments and number of elements
      * sent per operation
      */
-    typelng = smpi_datatype_size( datatype);
+    typelng = datatype->size();
     
     COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount );
 
@@ -371,7 +371,7 @@ int smpi_coll_tuned_reduce_ompi_pipeline( void *sendbuf, void *recvbuf,
     const double b2 =  9.7128;
     const double a4 =  0.0033 / 1024.0; /* [1/B] */
     const double b4 =  1.6761;
-    typelng= smpi_datatype_size( datatype);
+    typelng= datatype->size();
     int communicator_size = comm->size();
     size_t message_size = typelng * count; 
 
@@ -412,7 +412,7 @@ int smpi_coll_tuned_reduce_ompi_binary( void *sendbuf, void *recvbuf,
      * Determine number of segments and number of elements
      * sent per operation
      */
-    typelng=smpi_datatype_size( datatype );
+    typelng=datatype->size();
 
         // Binary_32K 
     segsize = 32*1024;
@@ -447,7 +447,7 @@ int smpi_coll_tuned_reduce_ompi_binomial( void *sendbuf, void *recvbuf,
      * Determine number of segments and number of elements
      * sent per operation
      */
-    typelng= smpi_datatype_size( datatype);
+    typelng= datatype->size();
     int communicator_size = comm->size();
     size_t message_size = typelng * count; 
     if (((communicator_size < 8) && (message_size < 20480)) ||
@@ -498,7 +498,7 @@ int smpi_coll_tuned_reduce_ompi_in_order_binary( void *sendbuf, void *recvbuf,
      * Determine number of segments and number of elements
      * sent per operation
      */
-    typelng=smpi_datatype_size( datatype);
+    typelng=datatype->size();
     COLL_TUNED_COMPUTED_SEGCOUNT( segsize, typelng, segcount );
 
     /* An in-order binary tree must use root (size-1) to preserve the order of
@@ -515,15 +515,15 @@ int smpi_coll_tuned_reduce_ompi_in_order_binary( void *sendbuf, void *recvbuf,
         ptrdiff_t text, ext;
         char *tmpbuf = NULL;
     
-        ext=smpi_datatype_get_extent(datatype);
-        text=smpi_datatype_get_extent(datatype);
+        ext=datatype->get_extent();
+        text=datatype->get_extent();
 
         if ((root == rank) && (MPI_IN_PLACE == sendbuf)) {
             tmpbuf = (char *) smpi_get_tmp_sendbuffer(text + (count - 1) * ext);
             if (NULL == tmpbuf) {
                 return MPI_ERR_INTERN;
             }
-            smpi_datatype_copy (
+            Datatype::copy (
                                                 (char*)recvbuf, count, datatype,
                                                 (char*)tmpbuf, count, datatype);
             use_this_sendbuf = tmpbuf;
@@ -622,8 +622,8 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count,
        extent and true extent */
     /* for reducing buffer allocation lengths.... */
 
-    smpi_datatype_extent(dtype, &lb, &extent);
-    true_extent = smpi_datatype_get_extent(dtype);
+    dtype->extent(&lb, &extent);
+    true_extent = dtype->get_extent();
 
     if (MPI_IN_PLACE == sbuf) {
         sbuf = rbuf;
@@ -642,7 +642,7 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count,
     /* Initialize the receive buffer. */
 
     if (rank == (size - 1)) {
-        smpi_datatype_copy((char*)sbuf, count, dtype,(char*)rbuf, count, dtype);
+        Datatype::copy((char*)sbuf, count, dtype,(char*)rbuf, count, dtype);
     } else {
         Request::recv(rbuf, count, dtype, size - 1,
                                 COLL_TAG_REDUCE, comm,
@@ -666,7 +666,7 @@ smpi_coll_tuned_reduce_ompi_basic_linear(void *sbuf, void *rbuf, int count,
     }
 
     if (NULL != inplace_temp) {
-        smpi_datatype_copy(inplace_temp, count, dtype,(char*)sbuf
+        Datatype::copy(inplace_temp, count, dtype,(char*)sbuf
                                                   ,count , dtype);
         smpi_free_tmp_buffer(inplace_temp);
     }
index 3f8709d..ab769b8 100644 (file)
@@ -36,7 +36,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
   
 
 
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
   /* If I'm not the root, then my recvbuf may not be valid, therefore
   I have to allocate a temporary one */
   if (rank != root && !recvbuf) {
index 4906203..1e64860 100644 (file)
@@ -35,8 +35,8 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
     comm_size = comm->size();
     rank = comm->rank();
 
-    extent =smpi_datatype_get_extent(datatype);
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
+    extent =datatype->get_extent();
+    datatype->extent(&true_lb, &true_extent);
     
     if (op->is_commutative()) {
         is_commutative = 1;
@@ -57,7 +57,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
 
         if (sendbuf != MPI_IN_PLACE) {
             /* copy local data into recvbuf */
-            smpi_datatype_copy(((char *)sendbuf+disps[rank]*extent),
+            Datatype::copy(((char *)sendbuf+disps[rank]*extent),
                                        recvcounts[rank], datatype, recvbuf,
                                        recvcounts[rank], datatype);
         }
@@ -110,7 +110,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
                    if(op!=MPI_OP_NULL) op->apply( 
                       recvbuf, tmp_recvbuf, &recvcounts[rank], datatype);
                     /* copy result back into recvbuf */
-                    mpi_errno = smpi_datatype_copy(tmp_recvbuf, recvcounts[rank],
+                    mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank],
                                                datatype, recvbuf,
                                                recvcounts[rank], datatype);
                     if (mpi_errno) return(mpi_errno);
@@ -120,7 +120,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
                         ((char *)recvbuf+disps[rank]*extent),
                        tmp_recvbuf, &recvcounts[rank], datatype);
                     /* copy result back into recvbuf */
-                    mpi_errno = smpi_datatype_copy(tmp_recvbuf, recvcounts[rank],
+                    mpi_errno = Datatype::copy(tmp_recvbuf, recvcounts[rank],
                                                datatype, 
                                                ((char *)recvbuf +
                                                 disps[rank]*extent), 
@@ -133,7 +133,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_pair(void *sendbuf, void *recvbuf, int
         /* if MPI_IN_PLACE, move output data to the beginning of
            recvbuf. already done for rank 0. */
         if ((sendbuf == MPI_IN_PLACE) && (rank != 0)) {
-            mpi_errno = smpi_datatype_copy(((char *)recvbuf +
+            mpi_errno = Datatype::copy(((char *)recvbuf +
                                         disps[rank]*extent),  
                                        recvcounts[rank], datatype,
                                        recvbuf, 
@@ -165,7 +165,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, i
     void *tmp_buf1;
     void *result_ptr;
 
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
+    datatype->extent(&true_lb, &true_extent);
 
     pof2 = 1;
     log2_comm_size = 0;
@@ -198,7 +198,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, i
     /* Copy our send data to tmp_buf0.  We do this one block at a time and
        permute the blocks as we go according to the mirror permutation. */
     for (i = 0; i < comm_size; ++i) {
-        mpi_errno = smpi_datatype_copy((char *)(sendbuf == MPI_IN_PLACE ? recvbuf : sendbuf) + (i * true_extent * block_size), block_size, datatype,
+        mpi_errno = Datatype::copy((char *)(sendbuf == MPI_IN_PLACE ? recvbuf : sendbuf) + (i * true_extent * block_size), block_size, datatype,
                                    (char *)tmp_buf0 + (MPIU_Mirror_permutation(i, log2_comm_size) * true_extent * block_size), block_size, datatype);
         if (mpi_errno) return(mpi_errno);
     }
@@ -256,7 +256,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, i
 
     /* copy the reduced data to the recvbuf */
     result_ptr = (char *)(buf0_was_inout ? tmp_buf0 : tmp_buf1) + recv_offset * true_extent;
-    mpi_errno = smpi_datatype_copy(result_ptr, size, datatype,
+    mpi_errno = Datatype::copy(result_ptr, size, datatype,
                                recvbuf, size, datatype);
     smpi_free_tmp_buffer(tmp_buf0_save);
     smpi_free_tmp_buffer(tmp_buf1_save);
@@ -282,8 +282,8 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
     comm_size = comm->size();
     rank = comm->rank();
 
-    extent =smpi_datatype_get_extent(datatype);
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
+    extent =datatype->get_extent();
+    datatype->extent(&true_lb, &true_extent);
     
     if ((op==MPI_OP_NULL) || op->is_commutative()) {
         is_commutative = 1;
@@ -312,10 +312,10 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
 
             /* copy sendbuf into tmp_results */
             if (sendbuf != MPI_IN_PLACE)
-                mpi_errno = smpi_datatype_copy(sendbuf, total_count, datatype,
+                mpi_errno = Datatype::copy(sendbuf, total_count, datatype,
                                            tmp_results, total_count, datatype);
             else
-                mpi_errno = smpi_datatype_copy(recvbuf, total_count, datatype,
+                mpi_errno = Datatype::copy(recvbuf, total_count, datatype,
                                            tmp_results, total_count, datatype);
 
             if (mpi_errno) return(mpi_errno);
@@ -352,10 +352,10 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                 for (j=my_tree_root; (j<my_tree_root+mask) && (j<comm_size); j++)
                     dis[1] += recvcounts[j];
 
-                mpi_errno = smpi_datatype_indexed(2, blklens, dis, datatype, &sendtype);
+                mpi_errno = Datatype::create_indexed(2, blklens, dis, datatype, &sendtype);
                 if (mpi_errno) return(mpi_errno);
                 
-                smpi_datatype_commit(&sendtype);
+                sendtype->commit();
 
                 /* calculate recvtype */
                 blklens[0] = blklens[1] = 0;
@@ -369,10 +369,10 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                 for (j=dst_tree_root; (j<dst_tree_root+mask) && (j<comm_size); j++)
                     dis[1] += recvcounts[j];
 
-                mpi_errno = smpi_datatype_indexed(2, blklens, dis, datatype, &recvtype);
+                mpi_errno = Datatype::create_indexed(2, blklens, dis, datatype, &recvtype);
                 if (mpi_errno) return(mpi_errno);
                 
-                smpi_datatype_commit(&recvtype);
+                recvtype->commit();
 
                 received = 0;
                 if (dst < comm_size) {
@@ -474,21 +474,21 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                                    &blklens[1], datatype); 
                         }
                         /* copy result back into tmp_results */
-                        mpi_errno = smpi_datatype_copy(tmp_recvbuf, 1, recvtype, 
+                        mpi_errno = Datatype::copy(tmp_recvbuf, 1, recvtype, 
                                                    tmp_results, 1, recvtype);
                         if (mpi_errno) return(mpi_errno);
                     }
                 }
 
-                smpi_datatype_unuse(sendtype);
-                smpi_datatype_unuse(recvtype);
+                sendtype->unuse();
+                recvtype->unuse();
 
                 mask <<= 1;
                 i++;
             }
 
             /* now copy final results from tmp_results to recvbuf */
-            mpi_errno = smpi_datatype_copy(((char *)tmp_results+disps[rank]*extent),
+            mpi_errno = Datatype::copy(((char *)tmp_results+disps[rank]*extent),
                                        recvcounts[rank], datatype, recvbuf,
                                        recvcounts[rank], datatype);
             if (mpi_errno) return(mpi_errno);
index 30c2720..ca49ba0 100644 (file)
@@ -82,8 +82,8 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
     }
 
     /* get datatype information */
-    smpi_datatype_extent(dtype, &lb, &extent);
-    smpi_datatype_extent(dtype, &true_lb, &true_extent);
+    dtype->extent(&lb, &extent);
+    dtype->extent(&true_lb, &true_extent);
     buf_size = true_extent + (ptrdiff_t)(count - 1) * extent;
 
     /* Handle MPI_IN_PLACE */
@@ -106,7 +106,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
     result_buf = result_buf_free - lb;
    
     /* copy local buffer into the temporary results */
-    err =smpi_datatype_copy(sbuf, count, dtype, result_buf, count, dtype);
+    err =Datatype::copy(sbuf, count, dtype, result_buf, count, dtype);
     if (MPI_SUCCESS != err) goto cleanup;
    
     /* figure out power of two mapping: grow until larger than
@@ -257,7 +257,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
 
         /* copy local results from results buffer into real receive buffer */
         if (0 != rcounts[rank]) {
-            err = smpi_datatype_copy(result_buf + disps[rank] * extent,
+            err = Datatype::copy(result_buf + disps[rank] * extent,
                                        rcounts[rank], dtype, 
                                        rbuf, rcounts[rank], dtype);
             if (MPI_SUCCESS != err) {
@@ -397,7 +397,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
     /* Special case for size == 1 */
     if (1 == size) {
         if (MPI_IN_PLACE != sbuf) {
-            ret = smpi_datatype_copy((char*)sbuf, total_count, dtype, (char*)rbuf, total_count, dtype);
+            ret = Datatype::copy((char*)sbuf, total_count, dtype, (char*)rbuf, total_count, dtype);
             if (ret < 0) { line = __LINE__; goto error_hndl; }
         }
         xbt_free(displs);
@@ -409,8 +409,8 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
        rbuf can be of rcounts[rank] size.
        - up to two temporary buffers used for communication/computation overlap.
     */
-    smpi_datatype_extent(dtype, &lb, &extent);
-    smpi_datatype_extent(dtype, &true_lb, &true_extent);
+    dtype->extent(&lb, &extent);
+    dtype->extent(&true_lb, &true_extent);
 
     max_real_segsize = true_extent + (ptrdiff_t)(max_block_count - 1) * extent;
 
@@ -432,7 +432,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
         sbuf = rbuf;
     }
 
-    ret = smpi_datatype_copy((char*)sbuf, total_count, dtype, accumbuf, total_count, dtype);
+    ret = Datatype::copy((char*)sbuf, total_count, dtype, accumbuf, total_count, dtype);
     if (ret < 0) { line = __LINE__; goto error_hndl; }
 
     /* Computation loop */
@@ -499,7 +499,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
     if(op!=MPI_OP_NULL) op->apply( inbuf[inbi], tmprecv, &(rcounts[rank]), dtype);
    
     /* Copy result from tmprecv to rbuf */
-    ret = smpi_datatype_copy(tmprecv, rcounts[rank], dtype, (char*)rbuf, rcounts[rank], dtype);
+    ret = Datatype::copy(tmprecv, rcounts[rank], dtype, (char*)rbuf, rcounts[rank], dtype);
     if (ret < 0) { line = __LINE__; goto error_hndl; }
 
     if (NULL != displs) xbt_free(displs);
index aeeae23..8badc56 100644 (file)
@@ -97,8 +97,8 @@ int smpi_coll_tuned_scatter_mvapich2_two_level_direct(void *sendbuf,
                                             root, comm);
 
     } else {
-        recvtype_size=smpi_datatype_size(recvtype);
-        sendtype_size=smpi_datatype_size(sendtype);
+        recvtype_size=recvtype->size();
+        sendtype_size=sendtype->size();
 
         if (rank == root) {
             nbytes = sendcnt * sendtype_size;
@@ -281,8 +281,8 @@ int smpi_coll_tuned_scatter_mvapich2_two_level_binomial(void *sendbuf,
                                             root, comm);
 
     } else {
-        recvtype_size=smpi_datatype_size(recvtype);
-        sendtype_size=smpi_datatype_size(sendtype);
+        recvtype_size=recvtype->size();
+        sendtype_size=sendtype->size();
 
         if (rank == root) {
             nbytes = sendcnt * sendtype_size;
index ed6b580..e8391e0 100644 (file)
@@ -58,10 +58,10 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
 //    COLL_TUNED_UPDATE_IN_ORDER_BMTREE( comm, tuned_module, root );
     bmtree =  ompi_coll_tuned_topo_build_in_order_bmtree( comm, root);//ompi_ data->cached_in_order_bmtree;
 
-    smpi_datatype_extent(sdtype, &slb, &sextent);
-    smpi_datatype_extent(sdtype, &strue_lb, &strue_extent);
-    smpi_datatype_extent(rdtype, &rlb, &rextent);
-    smpi_datatype_extent(rdtype, &rtrue_lb, &rtrue_extent);
+    sdtype->extent(&slb, &sextent);
+    sdtype->extent(&strue_lb, &strue_extent);
+    rdtype->extent(&rlb, &rextent);
+    rdtype->extent(&rtrue_lb, &rtrue_extent);
 
     vrank = (rank - root + size) % size;
 
@@ -71,7 +71,7 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
            ptmp = (char *) sbuf;
            if (rbuf != MPI_IN_PLACE) {
                /* local copy to rbuf */
-               err = smpi_datatype_copy(sbuf, scount, sdtype,
+               err = Datatype::copy(sbuf, scount, sdtype,
                                      rbuf, rcount, rdtype);
                if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
            }
@@ -85,18 +85,18 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
            ptmp = tempbuf - slb;
 
            /* and rotate data so they will eventually in the right place */
-           err = smpi_datatype_copy((char *) sbuf + sextent*root*scount, scount*(size-root), sdtype,
+           err = Datatype::copy((char *) sbuf + sextent*root*scount, scount*(size-root), sdtype,
             ptmp, scount*(size-root), sdtype);
            if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
 
-           err = smpi_datatype_copy((char*)sbuf, scount*root, sdtype,
+           err = Datatype::copy((char*)sbuf, scount*root, sdtype,
                                                 ptmp + sextent*scount*(size - root), scount*root, sdtype);
            if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
 
            if (rbuf != MPI_IN_PLACE) {
                /* local copy to rbuf */
-               err = smpi_datatype_copy(ptmp, scount, sdtype,
+               err = Datatype::copy(ptmp, scount, sdtype,
                                      rbuf, rcount, rdtype);
                if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
            }
@@ -127,7 +127,7 @@ smpi_coll_tuned_scatter_ompi_binomial(void *sbuf, int scount,
            Request::recv(ptmp, rcount*size, rdtype, bmtree->tree_prev,
                                    COLL_TAG_SCATTER, comm, &status);
            /* local copy to rbuf */
-           smpi_datatype_copy(ptmp, scount, sdtype, rbuf, rcount, rdtype);
+           Datatype::copy(ptmp, scount, sdtype, rbuf, rcount, rdtype);
        }
        /* send to children on all non-leaf */
        for (i = 0; i < bmtree->tree_nextsize; i++) {
@@ -219,7 +219,7 @@ smpi_coll_tuned_scatter_ompi_basic_linear(void *sbuf, int scount,
 
     /* I am the root, loop sending data. */
 
-    err = smpi_datatype_extent(sdtype, &lb, &incr);
+    err = sdtype->extent(&lb, &incr);
     if (MPI_SUCCESS != err) {
         return MPI_ERR_OTHER;
     }
@@ -232,7 +232,7 @@ smpi_coll_tuned_scatter_ompi_basic_linear(void *sbuf, int scount,
         if (i == rank) {
             if (MPI_IN_PLACE != rbuf) {
                 err =
-                    smpi_datatype_copy(ptmp, scount, sdtype, rbuf, rcount,
+                    Datatype::copy(ptmp, scount, sdtype, rbuf, rcount,
                                     rdtype);
             }
         } else {
index ee2dfe0..574aeaa 100644 (file)
@@ -2218,44 +2218,44 @@ intel_tuning_table_element intel_alltoallv_table[] =
     for (i = 0; i < comm_size; i++) { \
         total_message_size += rcounts[i];\
     }\
-    size_t block_dsize = total_message_size*smpi_datatype_size(dtype);\
+    size_t block_dsize = total_message_size*dtype->size();\
     
 #define SIZECOMP_allreduce\
-  size_t block_dsize =rcount * smpi_datatype_size(dtype);
+  size_t block_dsize =rcount * dtype->size();
   
 #define SIZECOMP_alltoall\
-  size_t block_dsize =send_count * smpi_datatype_size(send_type);
+  size_t block_dsize =send_count * send_type->size();
 
 #define SIZECOMP_bcast\
-  size_t block_dsize =count * smpi_datatype_size(datatype);
+  size_t block_dsize =count * datatype->size();
 
 #define SIZECOMP_reduce\
-  size_t block_dsize =count * smpi_datatype_size(datatype);
+  size_t block_dsize =count * datatype->size();
 
 #define SIZECOMP_barrier\
   size_t block_dsize = 1;
 
 #define SIZECOMP_allgather\
-  size_t block_dsize =recv_count * smpi_datatype_size(recv_type);
+  size_t block_dsize =recv_count * recv_type->size();
 
 #define SIZECOMP_allgatherv\
     int total_message_size = 0;\
     for (i = 0; i < comm_size; i++) { \
         total_message_size += recv_count[i];\
     }\
-    size_t block_dsize = total_message_size*smpi_datatype_size(recv_type);
+    size_t block_dsize = total_message_size*recv_type->size();
     
 #define SIZECOMP_gather\
   int rank = comm->rank();\
   size_t block_dsize = (send_buff == MPI_IN_PLACE || rank ==root) ?\
-                recv_count * smpi_datatype_size(recv_type) :\
-                send_count * smpi_datatype_size(send_type);
+                recv_count * recv_type->size() :\
+                send_count * send_type->size();
 
 #define SIZECOMP_scatter\
   int rank = comm->rank();\
   size_t block_dsize = (sendbuf == MPI_IN_PLACE || rank !=root ) ?\
-                recvcount * smpi_datatype_size(recvtype) :\
-                sendcount * smpi_datatype_size(sendtype);
+                recvcount * recvtype->size() :\
+                sendcount * sendtype->size();
 
 #define SIZECOMP_alltoallv\
   size_t block_dsize = 1;
index 99c147f..f29b79c 100644 (file)
@@ -63,7 +63,7 @@ int smpi_coll_tuned_allreduce_mpich(void *sbuf, void *rbuf, int count,
     int comm_size = comm->size();
     const size_t large_message = 2048; //MPIR_PARAM_ALLREDUCE_SHORT_MSG_SIZE
 
-    dsize = smpi_datatype_size(dtype);
+    dsize = dtype->size();
     block_dsize = dsize * count;
 
 
@@ -158,7 +158,7 @@ int smpi_coll_tuned_alltoall_mpich( void *sbuf, int scount,
 //   and sends to (rank+i). 
 
 
-    dsize = smpi_datatype_size(sdtype);
+    dsize = sdtype->size();
     block_dsize = dsize * scount;
 
     if ((block_dsize < short_size) && (communicator_size >= 8)) {
@@ -260,7 +260,7 @@ int smpi_coll_tuned_bcast_mpich(void *buff, int count,
     communicator_size = comm->size();
 
     /* else we need data size for decision function */
-    dsize = smpi_datatype_size(datatype);
+    dsize = datatype->size();
     message_size = dsize * (unsigned long)count;   /* needed for decision */
 
     /* Handle messages of small and intermediate size, and 
@@ -351,7 +351,7 @@ int smpi_coll_tuned_reduce_mpich( void *sendbuf, void *recvbuf,
     communicator_size = comm->size();
 
     /* need data size for decision function */
-    dsize=smpi_datatype_size(datatype);
+    dsize=datatype->size();
     message_size = dsize * count;   /* needed for decision */
 
     int pof2 = 1;
@@ -524,7 +524,7 @@ int smpi_coll_tuned_allgather_mpich(void *sbuf, int scount,
     communicator_size = comm->size();
 
     /* Determine complete data size */
-    dsize=smpi_datatype_size(sdtype);
+    dsize=sdtype->size();
     total_dsize = dsize * scount * communicator_size;   
    
     for (pow2_size  = 1; pow2_size < communicator_size; pow2_size <<=1); 
@@ -690,7 +690,7 @@ int smpi_coll_tuned_scatter_mpich(void *sbuf, int scount,
                                             )
 {
   if(comm->rank()!=root){
-      sbuf=xbt_malloc(rcount*smpi_datatype_get_extent(rdtype));
+      sbuf=xbt_malloc(rcount*rdtype->get_extent());
       scount=rcount;
       sdtype=rdtype;
   }
index f3800b6..1d6f4c4 100644 (file)
@@ -30,8 +30,8 @@ int smpi_coll_tuned_alltoall_mvapich2( void *sendbuf, int sendcount,
   int conf_index = 0;
   comm_size =  comm->size();
 
-  sendtype_size=smpi_datatype_size(sendtype);
-  recvtype_size=smpi_datatype_size(recvtype);
+  sendtype_size=sendtype->size();
+  recvtype_size=recvtype->size();
   long nbytes = sendtype_size * sendcount;
 
   /* check if safe to use partial subscription mode */
@@ -62,7 +62,7 @@ int smpi_coll_tuned_alltoall_mvapich2( void *sendbuf, int sendcount,
           ||nbytes > mv2_alltoall_thresholds_table[conf_index][range].in_place_algo_table[range_threshold].max
       ) {
           tmp_buf = (char *)smpi_get_tmp_sendbuffer( comm_size * recvcount * recvtype_size );
-          mpi_errno = smpi_datatype_copy((char *)recvbuf,
+          mpi_errno = Datatype::copy((char *)recvbuf,
               comm_size*recvcount, recvtype,
               (char *)tmp_buf,
               comm_size*recvcount, recvtype);
@@ -99,7 +99,7 @@ int smpi_coll_tuned_allgather_mvapich2(void *sendbuf, int sendcount, MPI_Datatyp
   //MPI_Comm *shmem_commptr=NULL;
   /* Get the size of the communicator */
   comm_size = comm->size();
-  recvtype_size=smpi_datatype_size(recvtype);
+  recvtype_size=recvtype->size();
   nbytes = recvtype_size * recvcount;
 
   if(mv2_allgather_table_ppn_conf==NULL)
@@ -209,10 +209,10 @@ int smpi_coll_tuned_gather_mvapich2(void *sendbuf,
   rank = comm->rank();
 
   if (rank == root) {
-      recvtype_size=smpi_datatype_size(recvtype);
+      recvtype_size=recvtype->size();
       nbytes = recvcnt * recvtype_size;
   } else {
-      sendtype_size=smpi_datatype_size(sendtype);
+      sendtype_size=sendtype->size();
       nbytes = sendcnt * sendtype_size;
   }
 
@@ -281,7 +281,7 @@ int smpi_coll_tuned_allgatherv_mvapich2(void *sendbuf, int sendcount, MPI_Dataty
   for (i = 0; i < comm_size; i++)
     total_count += recvcounts[i];
 
-  recvtype_size=smpi_datatype_size(recvtype);
+  recvtype_size=recvtype->size();
   nbytes = total_count * recvtype_size;
 
   /* Search for the corresponding system size inside the tuning table */
@@ -360,10 +360,10 @@ int smpi_coll_tuned_allreduce_mvapich2(void *sendbuf,
   int is_commutative = 0;
   MPI_Aint true_lb, true_extent;
 
-  sendtype_size=smpi_datatype_size(datatype);
+  sendtype_size=datatype->size();
   nbytes = count * sendtype_size;
 
-  smpi_datatype_extent(datatype, &true_lb, &true_extent);
+  datatype->extent(&true_lb, &true_extent);
   //MPI_Op *op_ptr;
   //is_commutative = op->is_commutative();
 
@@ -523,7 +523,7 @@ int smpi_coll_tuned_bcast_mvapich2(void *buffer,
      * possible, and MPI_Pack_size() in other places.
      */
     //if (is_homogeneous) {
-        type_size=smpi_datatype_size(datatype);
+        type_size=datatype->size();
 
    /* } else {
         MPIR_Pack_size_impl(1, datatype, &type_size);
@@ -698,7 +698,7 @@ int smpi_coll_tuned_reduce_mvapich2( void *sendbuf,
   int is_two_level = 0;
 
   comm_size = comm->size();
-  sendtype_size=smpi_datatype_size(datatype);
+  sendtype_size=datatype->size();
   nbytes = count * sendtype_size;
 
   if (count == 0)
@@ -817,7 +817,7 @@ int smpi_coll_tuned_reduce_scatter_mvapich2(void *sendbuf, void *recvbuf, int *r
       total_count += recvcnts[i];
   }
 
-  type_size=smpi_datatype_size(datatype);
+  type_size=datatype->size();
   nbytes = total_count * type_size;
 
   if (is_commutative) {
@@ -902,10 +902,10 @@ int smpi_coll_tuned_scatter_mvapich2(void *sendbuf,
   rank = comm->rank();
 
   if (rank == root) {
-      sendtype_size=smpi_datatype_size(sendtype);
+      sendtype_size=sendtype->size();
       nbytes = sendcnt * sendtype_size;
   } else {
-      recvtype_size=smpi_datatype_size(recvtype);
+      recvtype_size=recvtype->size();
       nbytes = recvcnt * recvtype_size;
   }
   
index fb9b9cb..67c7a39 100644 (file)
@@ -23,7 +23,7 @@ int smpi_coll_tuned_allreduce_ompi(void *sbuf, void *rbuf, int count,
      * can handle both commutative and non-commutative operations.
      * Ring algorithm does not support non-commutative operations.
      */
-    dsize = smpi_datatype_size(dtype);
+    dsize = dtype->size();
     block_dsize = dsize * count;
 
     if (block_dsize < intermediate_message) {
@@ -67,7 +67,7 @@ int smpi_coll_tuned_alltoall_ompi( void *sbuf, int scount,
        the University of Tennessee (2GB MX) up to 64 nodes.
        Has better performance for messages of intermediate sizes than the old one */
     /* determine block size */
-    dsize = smpi_datatype_size(sdtype);
+    dsize = sdtype->size();
     block_dsize = dsize * scount;
 
     if ((block_dsize < 200) && (communicator_size > 12)) {
@@ -144,7 +144,7 @@ int smpi_coll_tuned_bcast_ompi(void *buff, int count,
     communicator_size = comm->size();
 
     /* else we need data size for decision function */
-    dsize = smpi_datatype_size(datatype);
+    dsize = datatype->size();
     message_size = dsize * (unsigned long)count;   /* needed for decision */
 
     /* Handle messages of small and intermediate size, and 
@@ -246,7 +246,7 @@ int smpi_coll_tuned_reduce_ompi( void *sendbuf, void *recvbuf,
     communicator_size = comm->size();
 
     /* need data size for decision function */
-    dsize=smpi_datatype_size(datatype);
+    dsize=datatype->size();
     message_size = dsize * count;   /* needed for decision */
 
     /**
@@ -344,7 +344,7 @@ int smpi_coll_tuned_reduce_scatter_ompi( void *sbuf, void *rbuf,
     
     comm_size = comm->size();
     // We need data size for decision function 
-    dsize=smpi_datatype_size(dtype);
+    dsize=dtype->size();
     total_message_size = 0;
     for (i = 0; i < comm_size; i++) { 
         total_message_size += rcounts[i];
@@ -401,7 +401,7 @@ int smpi_coll_tuned_allgather_ompi(void *sbuf, int scount,
     }
 
     /* Determine complete data size */
-    dsize=smpi_datatype_size(sdtype);
+    dsize=sdtype->size();
     total_dsize = dsize * scount * communicator_size;   
    
     for (pow2_size  = 1; pow2_size < communicator_size; pow2_size <<=1); 
@@ -483,7 +483,7 @@ int smpi_coll_tuned_allgatherv_ompi(void *sbuf, int scount,
     }
     
     /* Determine complete data size */
-    dsize=smpi_datatype_size(sdtype);
+    dsize=sdtype->size();
     total_dsize = 0;
     for (i = 0; i < communicator_size; i++) {
         total_dsize += dsize * rcounts[i];
@@ -539,10 +539,10 @@ int smpi_coll_tuned_gather_ompi(void *sbuf, int scount,
 
     // Determine block size 
     if (rank == root) {
-        dsize = smpi_datatype_size(rdtype);
+        dsize = rdtype->size();
         block_size = dsize * rcount;
     } else {
-        dsize = smpi_datatype_size(sdtype);
+        dsize = sdtype->size();
         block_size = dsize * scount;
     }
 
@@ -588,17 +588,17 @@ int smpi_coll_tuned_scatter_ompi(void *sbuf, int scount,
     rank = comm->rank();
     // Determine block size 
     if (root == rank) {
-        dsize=smpi_datatype_size(sdtype);
+        dsize=sdtype->size();
         block_size = dsize * scount;
     } else {
-        dsize=smpi_datatype_size(rdtype);
+        dsize=rdtype->size();
         block_size = dsize * rcount;
     } 
 
     if ((communicator_size > small_comm_size) &&
         (block_size < small_block_size)) {
         if(rank!=root){
-            sbuf=xbt_malloc(rcount*smpi_datatype_get_extent(rdtype));
+            sbuf=xbt_malloc(rcount*rdtype->get_extent());
             scount=rcount;
             sdtype=rdtype;
         }
index 81180ed..6bfa017 100644 (file)
@@ -157,45 +157,6 @@ XBT_PRIVATE void smpi_global_destroy();
 XBT_PRIVATE double smpi_mpi_wtime();
 XBT_PRIVATE void smpi_mpi_init();
 
-XBT_PRIVATE bool is_datatype_valid(MPI_Datatype datatype);
-
-XBT_PRIVATE size_t smpi_datatype_size(MPI_Datatype datatype);
-XBT_PRIVATE MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
-XBT_PRIVATE MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
-XBT_PRIVATE int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t);
-XBT_PRIVATE int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent);
-XBT_PRIVATE MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype);
-XBT_PRIVATE void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length);
-XBT_PRIVATE void smpi_datatype_set_name(MPI_Datatype datatype, char* name);
-XBT_PRIVATE int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount,
-                       MPI_Datatype recvtype);
-XBT_PRIVATE void smpi_datatype_use(MPI_Datatype type);
-XBT_PRIVATE void smpi_datatype_unuse(MPI_Datatype type);
-
-XBT_PRIVATE int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb);
-XBT_PRIVATE int smpi_datatype_vector(int count, int blocklen, int stride, MPI_Datatype old_type,
-                       MPI_Datatype* new_type);
-
-XBT_PRIVATE int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,MPI_Datatype old_type,
-                       MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type,
-                       MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
-                       MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
-                       MPI_Datatype* new_type);
-
-XBT_PRIVATE void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int sizeof_substruct,
-                       void *struct_type, int flags);
-
-XBT_PRIVATE void smpi_datatype_free(MPI_Datatype* type);
-XBT_PRIVATE void smpi_datatype_commit(MPI_Datatype* datatype);
-
-XBT_PRIVATE int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,
-                       MPI_Comm comm);
-XBT_PRIVATE int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,
-                       MPI_Comm comm);
-
 XBT_PRIVATE void smpi_empty_status(MPI_Status * status);
 XBT_PRIVATE int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
 
index eb2f462..d363f8d 100644 (file)
@@ -79,9 +79,9 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     // Send buffer to root
     Request::send(sendbuf, sendcount, sendtype, root, system_tag, comm);
   } else {
-    smpi_datatype_extent(recvtype, &lb, &recvext);
+    recvtype->extent(&lb, &recvext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + root * recvcount * recvext,
+    Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + root * recvcount * recvext,
                        recvcount, recvtype);
     // Receive buffers from senders
     MPI_Request *requests = xbt_new(MPI_Request, size - 1);
@@ -116,7 +116,7 @@ void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_
     displs[i] = count;
     count += recvcounts[i];
   }
-  void *tmpbuf = static_cast<void*>(smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype)));
+  void *tmpbuf = static_cast<void*>(smpi_get_tmp_sendbuffer(count*datatype->get_extent()));
 
   mpi_coll_reduce_fun(sendbuf, tmpbuf, count, datatype, op, 0, comm);
   smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf, recvcounts[rank], datatype, 0, comm);
@@ -137,9 +137,9 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     // Send buffer to root
     Request::send(sendbuf, sendcount, sendtype, root, system_tag, comm);
   } else {
-    smpi_datatype_extent(recvtype, &lb, &recvext);
+    recvtype->extent(&lb, &recvext);
     // Local copy from root
-    smpi_datatype_copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + displs[root] * recvext,
+    Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char*>(recvbuf) + displs[root] * recvext,
                        recvcounts[root], recvtype);
     // Receive buffers from senders
     MPI_Request *requests = xbt_new(MPI_Request, size - 1);
@@ -172,9 +172,9 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   int rank = comm->rank();
   int size = comm->size();
   // FIXME: check for errors
-  smpi_datatype_extent(recvtype, &lb, &recvext);
+  recvtype->extent(&lb, &recvext);
   // Local copy from self
-  smpi_datatype_copy(sendbuf, sendcount, sendtype, static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount,
+  Datatype::copy(sendbuf, sendcount, sendtype, static_cast<char *>(recvbuf) + rank * recvcount * recvext, recvcount,
                      recvtype);
   // Send/Recv buffers to/from others;
   requests = xbt_new(MPI_Request, 2 * (size - 1));
@@ -206,9 +206,9 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, vo
 
   int rank = comm->rank();
   int size = comm->size();
-  smpi_datatype_extent(recvtype, &lb, &recvext);
+  recvtype->extent(&lb, &recvext);
   // Local copy from self
-  smpi_datatype_copy(sendbuf, sendcount, sendtype,
+  Datatype::copy(sendbuf, sendcount, sendtype,
                      static_cast<char *>(recvbuf) + displs[rank] * recvext,recvcounts[rank], recvtype);
   // Send buffers to others;
   MPI_Request *requests = xbt_new(MPI_Request, 2 * (size - 1));
@@ -246,10 +246,10 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     // Recv buffer from root
     Request::recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
   } else {
-    smpi_datatype_extent(sendtype, &lb, &sendext);
+    sendtype->extent(&lb, &sendext);
     // Local copy from root
     if(recvbuf!=MPI_IN_PLACE){
-        smpi_datatype_copy(static_cast<char *>(sendbuf) + root * sendcount * sendext,
+        Datatype::copy(static_cast<char *>(sendbuf) + root * sendcount * sendext,
                            sendcount, sendtype, recvbuf, recvcount, recvtype);
     }
     // Send buffers to receivers
@@ -285,10 +285,10 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype
     // Recv buffer from root
     Request::recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
   } else {
-    smpi_datatype_extent(sendtype, &lb, &sendext);
+    sendtype->extent(&lb, &sendext);
     // Local copy from root
     if(recvbuf!=MPI_IN_PLACE){
-      smpi_datatype_copy(static_cast<char *>(sendbuf) + displs[root] * sendext, sendcounts[root],
+      Datatype::copy(static_cast<char *>(sendbuf) + displs[root] * sendext, sendcounts[root],
                        sendtype, recvbuf, recvcount, recvtype);
     }
     // Send buffers to receivers
@@ -329,18 +329,18 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
   }
 
   if( sendbuf == MPI_IN_PLACE ) {
-    sendtmpbuf = static_cast<char *>(smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype)));
-    smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
+    sendtmpbuf = static_cast<char *>(smpi_get_tmp_sendbuffer(count*datatype->get_extent()));
+    Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
   }
   
   if(rank != root) {
     // Send buffer to root
     Request::send(sendtmpbuf, count, datatype, root, system_tag, comm);
   } else {
-    smpi_datatype_extent(datatype, &lb, &dataext);
+    datatype->extent(&lb, &dataext);
     // Local copy from root
     if (sendtmpbuf != nullptr && recvbuf != nullptr)
-      smpi_datatype_copy(sendtmpbuf, count, datatype, recvbuf, count, datatype);
+      Datatype::copy(sendtmpbuf, count, datatype, recvbuf, count, datatype);
     // Receive buffers from senders
     MPI_Request *requests = xbt_new(MPI_Request, size - 1);
     void **tmpbufs = xbt_new(void *, size - 1);
@@ -396,10 +396,10 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
   int rank = comm->rank();
   int size = comm->size();
 
-  smpi_datatype_extent(datatype, &lb, &dataext);
+  datatype->extent(&lb, &dataext);
 
   // Local copy from self
-  smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count, datatype);
+  Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype);
 
   // Send/Recv buffers to/from others;
   MPI_Request *requests = xbt_new(MPI_Request, size - 1);
@@ -456,7 +456,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
   int rank = comm->rank();
   int size = comm->size();
 
-  smpi_datatype_extent(datatype, &lb, &dataext);
+  datatype->extent(&lb, &dataext);
 
   // Send/Recv buffers to/from others;
   MPI_Request *requests = xbt_new(MPI_Request, size - 1);
@@ -482,7 +482,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
       }
       if(index < rank) {
         if(recvbuf_is_empty){
-          smpi_datatype_copy(tmpbufs[index], count, datatype, recvbuf, count, datatype);
+          Datatype::copy(tmpbufs[index], count, datatype, recvbuf, count, datatype);
           recvbuf_is_empty=0;
         } else
           // #Request is below rank: it's a irecv
@@ -495,7 +495,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
      Request::wait(&(requests[other]), MPI_STATUS_IGNORE);
       if(index < rank) {
         if (recvbuf_is_empty) {
-          smpi_datatype_copy(tmpbufs[other], count, datatype, recvbuf, count, datatype);
+          Datatype::copy(tmpbufs[other], count, datatype, recvbuf, count, datatype);
           recvbuf_is_empty = 0;
         } else
           if(op!=MPI_OP_NULL) op->apply( tmpbufs[other], recvbuf, &count, datatype);
@@ -524,7 +524,7 @@ void smpi_empty_status(MPI_Status * status)
 
 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype)
 {
-  return status->count / smpi_datatype_size(datatype);
+  return status->count / datatype->size();
 }
 
 
index 960af87..8c9aaea 100644 (file)
@@ -126,7 +126,7 @@ int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount, MPI_Datatype se
                                    int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int size = comm->size();
-  int sendsize = smpi_datatype_size(sendtype) * sendcount;
+  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) {
@@ -157,10 +157,10 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount, MPI_Datatype se
   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. */
@@ -215,10 +215,10 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount, MPI_Data
   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. */
@@ -268,10 +268,10 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MP
   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. */
index e043747..54934b9 100644 (file)
@@ -14,7 +14,6 @@
 #include <simgrid/s4u/host.hpp>
 
 #include "private.h"
-#include "smpi_mpi_dt_private.h"
 #include "src/simix/smx_private.h"
 #include "colls/colls.h"
 
index 3ff3f33..8accf8d 100644 (file)
@@ -8,7 +8,6 @@
 #include "mc/mc.h"
 #include "private.h"
 #include "simgrid/modelchecker.h"
-#include "smpi_mpi_dt_private.h"
 #include "xbt/replay.h"
 #include <limits.h>
 #include <stdio.h>
@@ -125,23 +124,23 @@ Datatype::Datatype(char* name, int size,int lb, int ub, int flags) : name_(name)
 
 
 //TODO : subtypes ?
-Datatype::Datatype(Datatype &datatype) : lb_(datatype.lb_), ub_(datatype.ub_), flags_(datatype.flags_), in_use_(1)
+Datatype::Datatype(Datatype *datatype) : lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), in_use_(1)
 {
   flags_ &= ~DT_FLAG_PREDEFINED;
-  if(datatype.name_)
-    name_ = xbt_strdup(datatype.name_);
-  if(datatype.attributes_ !=nullptr){
+  if(datatype->name_)
+    name_ = xbt_strdup(datatype->name_);
+  if(datatype->attributes_ !=nullptr){
     attributes_ = xbt_dict_new_homogeneous(nullptr);
     xbt_dict_cursor_t cursor = nullptr;
     char* key;
     int flag;
     void* value_in;
     void* value_out;
-    xbt_dict_foreach (datatype.attributes_, cursor, key, value_in) {
+    xbt_dict_foreach (datatype->attributes_, cursor, key, value_in) {
       smpi_type_key_elem elem =
           static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, key, sizeof(int)));
       if (elem != nullptr && elem->copy_fn != MPI_NULL_COPY_FN) {
-        int ret = elem->copy_fn(&datatype, atoi(key), nullptr, value_in, &value_out, &flag);
+        int ret = elem->copy_fn(datatype, atoi(key), nullptr, value_in, &value_out, &flag);
         if (ret != MPI_SUCCESS) {
 //          smpi_datatype_unuse(*new_t);
 //          *new_t = MPI_DATATYPE_NULL;
@@ -272,7 +271,7 @@ int Datatype::attr_delete(int keyval){
   if(elem->delete_fn!=MPI_NULL_DELETE_FN){
     void * value = nullptr;
     int flag;
-    if(smpi_type_attr_get(this, keyval, &value, &flag)==MPI_SUCCESS){
+    if(this->attr_get(keyval, &value, &flag)==MPI_SUCCESS){
       int ret = elem->delete_fn(this, keyval, value, &flag);
       if(ret!=MPI_SUCCESS) 
         return ret;
@@ -314,7 +313,7 @@ int Datatype::attr_put(int keyval, void* attr_value){
     return MPI_ERR_ARG;
   int flag;
   void* value = nullptr;
-  smpi_type_attr_get(this, keyval, &value, &flag);
+  this->attr_get(keyval, &value, &flag);
   if(flag!=0 && elem->delete_fn!=MPI_NULL_DELETE_FN){
     int ret = elem->delete_fn(this, keyval, value, &flag);
     if(ret!=MPI_SUCCESS) 
@@ -390,21 +389,21 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 //    }
 //    else if (sendtype->sizeof_substruct == 0)
 //    {
-//      s_smpi_subtype_t *subtype =  static_cast<s_smpi_subtype_t*>(recvtype->substruct);
-//      subtype->unserialize( sendbuf, recvbuf, recvcount/smpi_datatype_size(recvtype), subtype, MPI_REPLACE);
+//      s_smpi_subtype_t *subtype =  recvtype->substruct);
+//      subtype->unserialize( sendbuf, recvbuf, recvcount/recvtype->size(), subtype, MPI_REPLACE);
 //    }
 //    else if (recvtype->sizeof_substruct == 0)
 //    {
-//      s_smpi_subtype_t *subtype =  static_cast<s_smpi_subtype_t*>(sendtype->substruct);
-//      subtype->serialize(sendbuf, recvbuf, sendcount/smpi_datatype_size(sendtype), subtype);
+//      s_smpi_subtype_t *subtype =  sendtype->substruct);
+//      subtype->serialize(sendbuf, recvbuf, sendcount/sendtype->size(), subtype);
 //    }else{
-//      s_smpi_subtype_t *subtype =  static_cast<s_smpi_subtype_t*>(sendtype->substruct);
+//      s_smpi_subtype_t *subtype =  sendtype->substruct);
 
 //      void * buf_tmp = xbt_malloc(count);
 
-//      subtype->serialize( sendbuf, buf_tmp,count/smpi_datatype_size(sendtype), subtype);
-//      subtype =  static_cast<s_smpi_subtype_t*>(recvtype->substruct);
-//      subtype->unserialize( buf_tmp, recvbuf,count/smpi_datatype_size(recvtype), subtype, MPI_REPLACE);
+//      subtype->serialize( sendbuf, buf_tmp,count/sendtype->size(), subtype);
+//      subtype =  recvtype->substruct);
+//      subtype->unserialize( buf_tmp, recvbuf,count/recvtype->size(), subtype, MPI_REPLACE);
 
 //      xbt_free(buf_tmp);
 //    }
@@ -414,22 +413,526 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 }
 
 //Default serialization method : memcpy.
-void Datatype::serialize( void* noncontiguous, void *contiguous, int count, void *type){
-  char* contiguous_char = static_cast<char*>(contiguous);
-  char* noncontiguous_char = static_cast<char*>(noncontiguous)+lb_;
-  memcpy(contiguous_char, noncontiguous_char, count*size_);
+void Datatype::serialize( void* noncontiguous_buf, void *contiguous_buf, int count){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb_;
+  memcpy(contiguous_buf_char, noncontiguous_buf_char, count*size_);
 
 }
 
-void Datatype::unserialize( void* contiguous, void *noncontiguous, int count, void *type, MPI_Op op){
-  char* contiguous_char = static_cast<char*>(contiguous);
-  char* noncontiguous_char = static_cast<char*>(noncontiguous)+lb_;
+void Datatype::unserialize( void* contiguous_buf, void *noncontiguous_buf, int count, MPI_Op op){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb_;
   int n=count;
   if(op!=MPI_OP_NULL)
-    op->apply( contiguous_char, noncontiguous_char, &n, this);
+    op->apply( contiguous_buf_char, noncontiguous_buf_char, &n, this);
 }
 
+int Datatype::create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type){
+  if(old_type->flags_ & DT_FLAG_DERIVED){
+    //handle this case as a hvector with stride equals to the extent of the datatype
+    return create_hvector(count, 1, old_type->get_extent(), old_type, new_type);
+  }
+  if(count>0)
+    *new_type = new Type_Contiguous(count * old_type->size(), lb, lb + count * old_type->size(),
+                                   DT_FLAG_DERIVED, count, old_type);
+  else
+    *new_type = new Datatype(count * old_type->size(), lb, lb + count * old_type->size(),0);
+  return MPI_SUCCESS;
+}
+
+int Datatype::create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type)
+{
+  int retval;
+  if (blocklen<0) 
+    return MPI_ERR_ARG;
+  MPI_Aint lb = 0;
+  MPI_Aint ub = 0;
+  if(count>0){
+    lb=old_type->lb();
+    ub=((count-1)*stride+blocklen-1)*old_type->get_extent()+old_type->ub();
+  }
+  if(old_type->flags() & DT_FLAG_DERIVED || stride != blocklen){
+    *new_type = new Type_Vector(count * (blocklen) * old_type->size(), lb, ub,
+                                   DT_FLAG_DERIVED, count, blocklen, stride, old_type);
+    retval=MPI_SUCCESS;
+  }else{
+    /* in this situation the data are contiguous thus it's not required to serialize and unserialize it*/
+    *new_type = new Datatype(count * blocklen * old_type->size(), 0, ((count -1) * stride + blocklen)*
+                         old_type->size(), DT_FLAG_CONTIGUOUS);
+    retval=MPI_SUCCESS;
+  }
+  return retval;
+}
+
+
+int Datatype::create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type)
+{
+  int retval;
+  if (blocklen<0) 
+    return MPI_ERR_ARG;
+  MPI_Aint lb = 0;
+  MPI_Aint ub = 0;
+  if(count>0){
+    lb=old_type->lb();
+    ub=((count-1)*stride+blocklen-1)*old_type->get_extent()+old_type->ub();
+  }
+  if(old_type->flags() & DT_FLAG_DERIVED || stride != blocklen*old_type->get_extent()){
+    *new_type = new Type_Hvector(count * (blocklen) * old_type->size(), lb, ub,
+                                   DT_FLAG_DERIVED, count, blocklen, stride, old_type);
+    retval=MPI_SUCCESS;
+  }else{
+    /* in this situation the data are contiguous thus it's not required to serialize and unserialize it*/
+    *new_type = new Datatype(count * blocklen * old_type->size(), 0, count * blocklen * old_type->size(), DT_FLAG_CONTIGUOUS);
+    retval=MPI_SUCCESS;
+  }
+  return retval;
+}
+
+int Datatype::create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
+  int size = 0;
+  bool contiguous=true;
+  MPI_Aint lb = 0;
+  MPI_Aint ub = 0;
+  if(count>0){
+    lb=indices[0]*old_type->get_extent();
+    ub=indices[0]*old_type->get_extent() + blocklens[0]*old_type->ub();
+  }
+
+  for (int i = 0; i < count; i++) {
+    if (blocklens[i] < 0)
+      return MPI_ERR_ARG;
+    size += blocklens[i];
+
+    if(indices[i]*old_type->get_extent()+old_type->lb()<lb)
+      lb = indices[i]*old_type->get_extent()+old_type->lb();
+    if(indices[i]*old_type->get_extent()+blocklens[i]*old_type->ub()>ub)
+      ub = indices[i]*old_type->get_extent()+blocklens[i]*old_type->ub();
+
+    if ( (i< count -1) && (indices[i]+blocklens[i] != indices[i+1]) )
+      contiguous=false;
+  }
+  if(old_type->flags_ & DT_FLAG_DERIVED)
+    contiguous=false;
+
+  if(!contiguous){
+    *new_type = new Type_Indexed(size * old_type->size(),lb,ub,
+                                 DT_FLAG_DERIVED|DT_FLAG_DATA, count, blocklens, indices, old_type);
+  }else{
+    *new_type = new Type_Contiguous(size * old_type->size(), lb, ub,
+                                    DT_FLAG_DERIVED|DT_FLAG_CONTIGUOUS, size, old_type);
+  }
+  return MPI_SUCCESS;
+}
+
+int Datatype::create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
+  int size = 0;
+  bool contiguous=true;
+  MPI_Aint lb = 0;
+  MPI_Aint ub = 0;
+  if(count>0){
+    lb=indices[0] + old_type->lb();
+    ub=indices[0] + blocklens[0]*old_type->ub();
+  }
+  for (int i = 0; i < count; i++) {
+    if (blocklens[i] < 0)
+      return MPI_ERR_ARG;
+    size += blocklens[i];
+
+    if(indices[i]+old_type->lb()<lb) 
+      lb = indices[i]+old_type->lb();
+    if(indices[i]+blocklens[i]*old_type->ub()>ub) 
+      ub = indices[i]+blocklens[i]*old_type->ub();
+
+    if ( (i< count -1) && (indices[i]+blocklens[i]*(static_cast<int>(old_type->size())) != indices[i+1]) )
+      contiguous=false;
+  }
+  if (old_type->flags_ & DT_FLAG_DERIVED || lb!=0)
+    contiguous=false;
+
+  if(!contiguous){
+    *new_type = new Type_Hindexed(size * old_type->size(),lb,ub,
+                                   DT_FLAG_DERIVED|DT_FLAG_DATA, count, blocklens, indices, old_type);
+  }else{
+    *new_type = new Type_Contiguous(size * old_type->size(), lb, ub,
+                                   DT_FLAG_DERIVED|DT_FLAG_CONTIGUOUS, size, old_type);
+  }
+  return MPI_SUCCESS;
+}
+
+int Datatype::create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type){
+  size_t size = 0;
+  bool contiguous=true;
+  size = 0;
+  MPI_Aint lb = 0;
+  MPI_Aint ub = 0;
+  if(count>0){
+    lb=indices[0] + old_types[0]->lb();
+    ub=indices[0] + blocklens[0]*old_types[0]->ub();
+  }
+  bool forced_lb=false;
+  bool forced_ub=false;
+  for (int i = 0; i < count; i++) {
+    if (blocklens[i]<0)
+      return MPI_ERR_ARG;
+    if (old_types[i]->flags_ & DT_FLAG_DERIVED)
+      contiguous=false;
+
+    size += blocklens[i]*old_types[i]->size();
+    if (old_types[i]==MPI_LB){
+      lb=indices[i];
+      forced_lb=true;
+    }
+    if (old_types[i]==MPI_UB){
+      ub=indices[i];
+      forced_ub=true;
+    }
+
+    if(!forced_lb && indices[i]+old_types[i]->lb()<lb) 
+      lb = indices[i];
+    if(!forced_ub &&  indices[i]+blocklens[i]*old_types[i]->ub()>ub)
+      ub = indices[i]+blocklens[i]*old_types[i]->ub();
+
+    if ( (i< count -1) && (indices[i]+blocklens[i]*static_cast<int>(old_types[i]->size()) != indices[i+1]) )
+      contiguous=false;
+  }
+  if(!contiguous){
+    *new_type = new Type_Struct(size, lb,ub, DT_FLAG_DERIVED|DT_FLAG_DATA, 
+                                count, blocklens, indices, old_types);
+  }else{
+    *new_type = new Type_Contiguous(size, lb, ub,
+                                   DT_FLAG_DERIVED|DT_FLAG_CONTIGUOUS, size, MPI_CHAR);
+  }
+  return MPI_SUCCESS;
+}
+
+
+
+Type_Contiguous::Type_Contiguous(int size, int lb, int ub, int flags, int block_count, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type){
+  old_type_->use();
+}
+
+Type_Contiguous::~Type_Contiguous(){
+  old_type_->unuse();
+}
+
+void Type_Contiguous::use(){
+  old_type_->use();
+};
+
+void Type_Contiguous::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                            int count){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb_;
+  memcpy(contiguous_buf_char, noncontiguous_buf_char, count * block_count_ * old_type_->size());
+}
+void Type_Contiguous::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                              int count, MPI_Op op){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb_;
+  int n= count*block_count_;
+  if(op!=MPI_OP_NULL)
+    op->apply( contiguous_buf_char, noncontiguous_buf_char, &n, old_type_);
+}
+
+
+
+
+Type_Vector::Type_Vector(int size,int lb, int ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(blocklen),block_stride_(stride),  old_type_(old_type){
+old_type_->use();
+}
+
+Type_Vector::~Type_Vector(){
+  old_type_->unuse();
+}
+
+void Type_Vector::use(){
+  old_type_->use();
+}
+
+
+void Type_Vector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                            int count){
+  int i;
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
+
+  for (i = 0; i < block_count_ * count; i++) {
+      if (!(old_type_->flags() & DT_FLAG_DERIVED))
+        memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size());
+      else        
+        old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char, block_length_);
 
+    contiguous_buf_char += block_length_*old_type_->size();
+    if((i+1)%block_count_ ==0)
+      noncontiguous_buf_char += block_length_*old_type_->get_extent();
+    else
+      noncontiguous_buf_char += block_stride_*old_type_->get_extent();
+  }
+}
+
+void Type_Vector::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                              int count, MPI_Op op){
+  int i;
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
+
+  for (i = 0; i < block_count_ * count; i++) {
+    if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+      if(op != MPI_OP_NULL)
+        op->apply(contiguous_buf_char, noncontiguous_buf_char, &block_length_,
+          old_type_);
+    }else
+      old_type_->unserialize(contiguous_buf_char, noncontiguous_buf_char, block_length_, op);
+
+    contiguous_buf_char += block_length_*old_type_->size();
+    if((i+1)%block_count_ ==0)
+      noncontiguous_buf_char += block_length_*old_type_->get_extent();
+    else
+      noncontiguous_buf_char += block_stride_*old_type_->get_extent();
+  }
+}
+
+Type_Hvector::Type_Hvector(int size,int lb, int ub, int flags, int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(blocklen), block_stride_(stride), old_type_(old_type){
+  old_type->use();
+}
+Type_Hvector::~Type_Hvector(){
+  old_type_->unuse();
+}
+void Type_Hvector::use(){
+  old_type_->use();
+}
+
+void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                    int count){
+  int i;
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
+
+  for (i = 0; i < block_count_ * count; i++) {
+    if (!(old_type_->flags() & DT_FLAG_DERIVED))
+      memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size());
+    else
+      old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_length_);
+
+    contiguous_buf_char += block_length_*old_type_->size();
+    if((i+1)%block_count_ ==0)
+      noncontiguous_buf_char += block_length_*old_type_->size();
+    else
+      noncontiguous_buf_char += block_stride_;
+  }
+}
+
+
+void Type_Hvector::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                              int count, MPI_Op op){
+  int i;
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
+
+  for (i = 0; i < block_count_ * count; i++) {
+    if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+      if(op!=MPI_OP_NULL) 
+        op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_length_, old_type_);
+    }else
+      old_type_->unserialize( contiguous_buf_char, noncontiguous_buf_char, block_length_, op);
+    contiguous_buf_char += block_length_*old_type_->size();
+    if((i+1)%block_count_ ==0)
+      noncontiguous_buf_char += block_length_*old_type_->size();
+    else
+      noncontiguous_buf_char += block_stride_;
+  }
+}
+
+Type_Indexed::Type_Indexed(int size,int lb, int ub, int flags, int count, int* blocklens, int* indices, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_lengths_(blocklens), block_indices_(indices), old_type_(old_type){
+  old_type->use();
+}
+
+Type_Indexed::~Type_Indexed(){
+  old_type_->unuse();
+  if(in_use_==0){
+    xbt_free(block_lengths_);
+    xbt_free(block_indices_);
+  }
+}
+
+void Type_Indexed::use(){
+  old_type_->use();
+}
+
+void Type_Indexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                        int count){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+block_indices_[0] * old_type_->size();
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_type_->flags() & DT_FLAG_DERIVED))
+        memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size());
+      else
+        old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_lengths_[i]);
+
+      contiguous_buf_char += block_lengths_[i]*old_type_->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char =
+          static_cast<char*>(noncontiguous_buf) + block_indices_[i+1]*old_type_->get_extent();
+      else
+        noncontiguous_buf_char += block_lengths_[i]*old_type_->get_extent();
+    }
+    noncontiguous_buf=static_cast< void*>(noncontiguous_buf_char);
+  }
+}
+
+
+void Type_Indexed::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                      int count, MPI_Op op){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char =
+    static_cast<char*>(noncontiguous_buf)+block_indices_[0]*old_type_->get_extent();
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+        if(op!=MPI_OP_NULL) 
+          op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i],
+                    old_type_);
+      }else
+        old_type_->unserialize( contiguous_buf_char,noncontiguous_buf_char,block_lengths_[i], op);
+
+      contiguous_buf_char += block_lengths_[i]*old_type_->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char =
+          static_cast<char*>(noncontiguous_buf) + block_indices_[i+1]*old_type_->get_extent();
+      else
+        noncontiguous_buf_char += block_lengths_[i]*old_type_->get_extent();
+    }
+    noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+  }
+}
+
+Type_Hindexed::Type_Hindexed(int size,int lb, int ub, int flags, int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_lengths_(blocklens), block_indices_(indices), old_type_(old_type){
+  old_type_->use();
+}
+
+    Type_Hindexed::~Type_Hindexed(){
+  old_type_->unuse();
+  if(in_use_==0){
+    xbt_free(block_lengths_);
+    xbt_free(block_indices_);
+  }
+}
+
+void Type_Hindexed::use(){
+  old_type_->use();
+}
+void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                int count){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_type_->flags() & DT_FLAG_DERIVED))
+        memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size());
+      else
+        old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char,block_lengths_[i]);
+
+      contiguous_buf_char += block_lengths_[i]*old_type_->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+      else
+        noncontiguous_buf_char += block_lengths_[i]*old_type_->get_extent();
+    }
+    noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+  }
+}
+
+void Type_Hindexed::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                          int count, MPI_Op op){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_type_->flags() & DT_FLAG_DERIVED)){
+        if(op!=MPI_OP_NULL) 
+          op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i],
+                            old_type_);
+      }else
+        old_type_->unserialize( contiguous_buf_char,noncontiguous_buf_char,block_lengths_[i], op);
+
+      contiguous_buf_char += block_lengths_[i]*old_type_->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+      else
+        noncontiguous_buf_char += block_lengths_[i]*old_type_->get_extent();
+    }
+    noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+  }
+}
+
+Type_Struct::Type_Struct(int size,int lb, int ub, int flags, int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count), block_lengths_(blocklens), block_indices_(indices), old_types_(old_types){
+  for (int i = 0; i < count; i++) {
+    old_types_[i]->use();
+  }
+}
+
+Type_Struct::~Type_Struct(){
+  for (int i = 0; i < block_count_; i++) {
+    old_types_[i]->unuse();
+  }
+  if(in_use_==0){
+    xbt_free(block_lengths_);
+    xbt_free(block_indices_);
+    xbt_free(old_types_);
+  }
+}
+
+void Type_Struct::use(){
+  for (int i = 0; i < block_count_; i++) {
+    old_types_[i]->use();
+  }
+}
+
+void Type_Struct::serialize( void* noncontiguous_buf, void *contiguous_buf, 
+                        int count){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_types_[i]->flags() & DT_FLAG_DERIVED))
+        memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_types_[i]->size());
+      else
+        old_types_[i]->serialize( noncontiguous_buf_char,contiguous_buf_char,block_lengths_[i]);
+
+
+      contiguous_buf_char += block_lengths_[i]*old_types_[i]->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+      else //let's hope this is MPI_UB ?
+        noncontiguous_buf_char += block_lengths_[i]*old_types_[i]->get_extent();
+    }
+    noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+  }
+}
+
+void Type_Struct::unserialize( void* contiguous_buf, void *noncontiguous_buf, 
+                              int count, MPI_Op op){
+  char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+  char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
+  for (int j = 0; j < count; j++) {
+    for (int i = 0; i < block_count_; i++) {
+      if (!(old_types_[i]->flags() & DT_FLAG_DERIVED)){
+        if(op!=MPI_OP_NULL) 
+          op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i], old_types_[i]);
+      }else
+        old_types_[i]->unserialize( contiguous_buf_char, noncontiguous_buf_char,block_lengths_[i], op);
+
+      contiguous_buf_char += block_lengths_[i]*old_types_[i]->size();
+      if (i<block_count_-1)
+        noncontiguous_buf_char =  static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+      else
+        noncontiguous_buf_char += block_lengths_[i]*old_types_[i]->get_extent();
+    }
+    noncontiguous_buf=reinterpret_cast<void*>(noncontiguous_buf_char);
+  }
+}
 
 }
 }
index 65eb838..57983e1 100644 (file)
 #define DT_FLAG_DATA          0x0100  /**< data or control structure */
 #define DT_FLAG_ONE_SIDED     0x0200  /**< datatype can be used for one sided operations */
 #define DT_FLAG_UNAVAILABLE   0x0400  /**< datatypes unavailable on the build (OS or compiler dependant) */
-#define DT_FLAG_VECTOR        0x0800  /**< valid only for loops. The loop contain only one element
-                                       **< without extent. It correspond to the vector type. */
+#define DT_FLAG_DERIVED       0x0800  /**< is the datatype derived ? */
 /*
  * We should make the difference here between the predefined contiguous and non contiguous
  * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
  */
 #define DT_FLAG_BASIC      (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
 
+extern const MPI_Datatype MPI_PTR;
+
+//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
+typedef struct {
+  float value;
+  int index;
+} float_int;
+typedef struct {
+  float value;
+  float index;
+} float_float;
+typedef struct {
+  long value;
+  long index;
+} long_long;
+typedef struct {
+  double value;
+  double index;
+} double_double;
+typedef struct {
+  long value;
+  int index;
+} long_int;
+typedef struct {
+  double value;
+  int index;
+} double_int;
+typedef struct {
+  short value;
+  int index;
+} short_int;
+typedef struct {
+  int value;
+  int index;
+} int_int;
+typedef struct {
+  long double value;
+  int index;
+} long_double_int;
+typedef struct {
+  int64_t value;
+  int64_t index;
+} integer128_t;
+
+
 namespace simgrid{
 namespace smpi{
 
@@ -47,8 +91,8 @@ class Datatype{
   public:
     Datatype(int size,int lb, int ub, int flags);
     Datatype(char* name, int size,int lb, int ub, int flags);
-    Datatype(Datatype &datatype);
-    ~Datatype();
+    Datatype(Datatype *datatype);
+    virtual ~Datatype();
     void use();
     void unuse();
     void commit();
@@ -65,10 +109,10 @@ class Datatype{
     void set_name(char* name);
     static int copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
                     void *recvbuf, int recvcount, MPI_Datatype recvtype);
-    virtual void serialize( void* noncontiguous_vector, void *contiguous_vector
-                            int count, void *type);
-    virtual void unserialize( void* contiguous_vector, void *noncontiguous_vector
-                              int count, void *type, MPI_Op op);
+    virtual void serialize( void* noncontiguous, void *contiguous
+                            int count);
+    virtual void unserialize( void* contiguous, void *noncontiguous
+                              int count, MPI_Op op);
     int attr_delete(int keyval);
     int attr_get(int keyval, void* attr_value, int* flag);
     int attr_put(int keyval, void* attr_value);
@@ -76,24 +120,108 @@ class Datatype{
     static int keyval_free(int* keyval);
     int pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
     int unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
+
+
+    static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
+    static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+    static int create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+    static int create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
+    static int create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
+    static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type);
 };
 
-class Type_Contiguous:Datatype{
+class Type_Contiguous: public Datatype{
+  private:
+    int block_count_;
+    MPI_Datatype old_type_;
+  public:
+    Type_Contiguous(int size, int lb, int ub, int flags, int block_count, MPI_Datatype old_type);
+    ~Type_Contiguous();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
-class Type_Vector:Datatype{
+class Type_Vector: public Datatype{
+  private:
+    int block_count_;
+    int block_length_;
+    int block_stride_;
+    MPI_Datatype old_type_;
+  public:
+    Type_Vector(int size,int lb, int ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type);
+    ~Type_Vector();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
-class Type_Hvector:Datatype{
+class Type_Hvector: public Datatype{
+  private:
+    int block_count_;
+    int block_length_;
+    MPI_Aint block_stride_;
+    MPI_Datatype old_type_;
+  public:
+    Type_Hvector(int size,int lb, int ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type);
+    ~Type_Hvector();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
-class Type_Indexed:Datatype{
+class Type_Indexed: public Datatype{
+  private:
+    int block_count_;
+    int* block_lengths_;
+    int* block_indices_;
+    MPI_Datatype old_type_;
+  public:
+    Type_Indexed(int size,int lb, int ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type);
+    ~Type_Indexed();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
-class Type_Hindexed:Datatype{
+class Type_Hindexed: public Datatype{
+  private:
+    int block_count_;
+    int* block_lengths_;
+    MPI_Aint* block_indices_;
+    MPI_Datatype old_type_;
+  public:
+    Type_Hindexed(int size,int lb, int ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type);
+    ~Type_Hindexed();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
-class Type_Struct:Datatype{
+class Type_Struct: public Datatype{
+  private:
+    int block_count_;
+    int* block_lengths_;
+    MPI_Aint* block_indices_;
+    MPI_Datatype* old_types_;
+  public:
+    Type_Struct(int size,int lb, int ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types);
+    ~Type_Struct();
+    void use();
+    void serialize( void* noncontiguous, void *contiguous, 
+                            int count);
+    void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
+                              int count, MPI_Op op);
 };
 
 
index 183e3a7..e86d3c5 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <limits.h>
 #include <stdio.h>
-#include "smpi_mpi_dt_private.h"
 #include "private.h"
 #include "xbt.h"
 
index 58201cb..f89ff76 100644 (file)
@@ -9,7 +9,6 @@
 #include "private.hpp"
 #include "simgrid/s4u/Mailbox.hpp"
 #include "simgrid/sg_config.h"
-#include "smpi_mpi_dt_private.h"
 #include "src/kernel/activity/SynchroComm.hpp"
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_replay.h"
diff --git a/src/smpi/smpi_mpi_dt.cpp b/src/smpi/smpi_mpi_dt.cpp
deleted file mode 100644 (file)
index 717bb1f..0000000
+++ /dev/null
@@ -1,1049 +0,0 @@
-/* smpi_mpi_dt.c -- MPI primitives to handle datatypes                      */
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "mc/mc.h"
-#include "private.h"
-#include "simgrid/modelchecker.h"
-#include "smpi_mpi_dt_private.h"
-#include "xbt/replay.h"
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <string>
-#include <xbt/ex.hpp>
-
-//XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)");
-
-//xbt_dict_t smpi_type_keyvals = nullptr;
-//int type_keyval_id=0;//avoid collisions
-
-
-/** Check if the datatype is usable for communications */
-bool is_datatype_valid(MPI_Datatype datatype) {
-    return datatype != MPI_DATATYPE_NULL && ((datatype->flags_ & DT_FLAG_COMMITED) != 0);
-}
-
-size_t smpi_datatype_size(MPI_Datatype datatype)
-{
-  return datatype->size_;
-}
-
-MPI_Aint smpi_datatype_lb(MPI_Datatype datatype)
-{
-  return datatype->lb_;
-}
-
-MPI_Aint smpi_datatype_ub(MPI_Datatype datatype)
-{
-  return datatype->ub_;
-}
-
-int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t)
-{
-  int ret=MPI_SUCCESS;
-  return ret;
-}
-
-int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
-{
-  return MPI_SUCCESS;
-}
-
-MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype){
-  if(datatype == MPI_DATATYPE_NULL){
-    return 0;
-  }
-  return datatype->ub_ - datatype->lb_;
-}
-
-void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length){
-  *length = strlen(datatype->name_);
-  strncpy(name, datatype->name_, *length+1);
-}
-
-void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
-  if(datatype->name_!=nullptr &&  (datatype->flags_ & DT_FLAG_PREDEFINED) == 0)
-    xbt_free(datatype->name_);
-  datatype->name_ = xbt_strdup(name);
-}
-
-int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                       void *recvbuf, int recvcount, MPI_Datatype recvtype)
-{
-  return sendcount > recvcount ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
-}
-
-/*
- *  Copies noncontiguous data into contiguous memory.
- *  @param contiguous_vector - output vector
- *  @param noncontiguous_vector - input vector
- *  @param type - pointer containing :
- *      - stride - stride of between noncontiguous data
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void serialize_vector( void* noncontiguous_vector, void *contiguous_vector, int count, void *type)
-{
-//  s_smpi_mpi_vector_t* type_c = reinterpret_cast<s_smpi_mpi_vector_t*>(type);
-//  int i;
-//  char* contiguous_vector_char = static_cast<char*>(contiguous_vector);
-//  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_vector);
-
-//  for (i = 0; i < type_c->block_count * count; i++) {
-//      if (type_c->old_type->sizeof_substruct == 0)
-//        memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
-//      else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
-//                                                                     contiguous_vector_char,
-//                                                                     type_c->block_length, type_c->old_type->substruct);
-
-//    contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    if((i+1)%type_c->block_count ==0)
-//      noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
-//    else
-//      noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
-//  }
-}
-
-/*
- *  Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_vector - output vector
- *  @param contiguous_vector - input vector
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void unserialize_vector( void* contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
-{
-//  s_smpi_mpi_vector_t* type_c = reinterpret_cast<s_smpi_mpi_vector_t*>(type);
-//  int i;
-
-//  char* contiguous_vector_char = static_cast<char*>(contiguous_vector);
-//  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_vector);
-
-//  for (i = 0; i < type_c->block_count * count; i++) {
-//    if (type_c->old_type->sizeof_substruct == 0){
-//      if(op!=MPI_OP_NULL)
-//        op->apply( contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length,
-//          &type_c->old_type);
-//    }else
-//      static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->unserialize(contiguous_vector_char, noncontiguous_vector_char,
-//                                                                    type_c->block_length,type_c->old_type->substruct,
-//                                                                    op);
-//    contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    if((i+1)%type_c->block_count ==0)
-//      noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
-//    else
-//      noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
-//  }
-}
-
-/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
- * from s_smpi_subtype which required the functions unserialize and serialize */
-s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype){
-  s_smpi_mpi_vector_t *new_t= xbt_new(s_smpi_mpi_vector_t,1);
-  new_t->base.serialize = &serialize_vector;
-  new_t->base.unserialize = &unserialize_vector;
-  new_t->base.subtype_free = &free_vector;
-  new_t->base.subtype_use = &use_vector;
-  new_t->block_stride = block_stride;
-  new_t->block_length = block_length;
-  new_t->block_count = block_count;
-  smpi_datatype_use(old_type);
-  new_t->old_type = old_type;
-  new_t->size_oldtype = size_oldtype;
-  return new_t;
-}
-
-void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int sizeof_substruct, void *struct_type,
-                          int flags){
-//  MPI_Datatype new_t= xbt_new(s_smpi_mpi_datatype_t,1);
-//  new_t->name = nullptr;
-//  new_t->size = size;
-//  new_t->sizeof_substruct = size>0? sizeof_substruct:0;
-//  new_t->lb = lb;
-//  new_t->ub = ub;
-//  new_t->flags = flags;
-//  new_t->substruct = struct_type;
-//  new_t->in_use=1;
-//  new_t->attributes=nullptr;
-//  *new_type = new_t;
-
-//#if HAVE_MC
-//  if(MC_is_active())
-//    MC_ignore(&(new_t->in_use), sizeof(new_t->in_use));
-//#endif
-}
-
-void smpi_datatype_free(MPI_Datatype* type){
-//  xbt_assert((*type)->in_use_ >= 0);
-
-//  if((*type)->flags & DT_FLAG_PREDEFINED)
-//    return;
-
-//  //if still used, mark for deletion
-//  if((*type)->in_use_!=0){
-//      (*type)->flags_ |=DT_FLAG_DESTROYED;
-//      return;
-//  }
-
-//  if((*type)->attributes_ !=nullptr){
-//    xbt_dict_cursor_t cursor = nullptr;
-//    char* key;
-//    void * value;
-//    int flag;
-//    xbt_dict_foreach((*type)->attributes, cursor, key, value){
-//      smpi_type_key_elem elem =
-//          static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, key, sizeof(int)));
-//      if(elem!=nullptr && elem->delete_fn!=nullptr)
-//        elem->delete_fn(*type,*key, value, &flag);
-//    }
-//    xbt_dict_free(&(*type)->attributes);
-//  }
-
-//  if ((*type)->sizeof_substruct != 0){
-//    //((s_smpi_subtype_t *)(*type)->substruct)->subtype_free(type);  
-//    xbt_free((*type)->substruct);
-//  }
-//  xbt_free((*type)->name);
-//  xbt_free(*type);
-//  *type = MPI_DATATYPE_NULL;
-}
-
-void smpi_datatype_use(MPI_Datatype type){
-
-//  if(type == MPI_DATATYPE_NULL)
-//    return;
-//  type->in_use++;
-
-//  if(type->sizeof_substruct!=0){
-//    static_cast<s_smpi_subtype_t *>((type)->substruct)->subtype_use(&type);  
-//  }
-//#if HAVE_MC
-//  if(MC_is_active())
-//    MC_ignore(&(type->in_use), sizeof(type->in_use));
-//#endif
-}
-
-void smpi_datatype_unuse(MPI_Datatype type)
-{
-//  if (type == MPI_DATATYPE_NULL)
-//    return;
-
-//  if (type->in_use > 0)
-//    type->in_use--;
-
-//  if(type->sizeof_substruct!=0){
-//    static_cast<s_smpi_subtype_t *>((type)->substruct)->subtype_free(&type);  
-//  }
-
-//  if (type->in_use == 0)
-//    smpi_datatype_free(&type);
-
-//#if HAVE_MC
-//  if(MC_is_active())
-//    MC_ignore(&(type->in_use), sizeof(type->in_use));
-//#endif
-}
-
-/*Contiguous Implementation*/
-
-/* Copies noncontiguous data into contiguous memory.
- *  @param contiguous_hvector - output hvector
- *  @param noncontiguous_hvector - input hvector
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data, in bytes
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void serialize_contiguous( void* noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
-{
-  s_smpi_mpi_contiguous_t* type_c = reinterpret_cast<s_smpi_mpi_contiguous_t*>(type);
-  char* contiguous_vector_char = static_cast<char*>(contiguous_hvector);
-  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_hvector)+type_c->lb;
-  memcpy(contiguous_vector_char, noncontiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);
-}
-/* Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_vector - output hvector
- *  @param contiguous_vector - input hvector
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data, in bytes
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void unserialize_contiguous(void* contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
-{
-//  s_smpi_mpi_contiguous_t* type_c = reinterpret_cast<s_smpi_mpi_contiguous_t*>(type);
-//  char* contiguous_vector_char = static_cast<char*>(contiguous_vector);
-//  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_vector)+type_c->lb;
-//  int n= count* type_c->block_count;
-//  if(op!=MPI_OP_NULL)
-//    op->apply( contiguous_vector_char, noncontiguous_vector_char, &n, &type_c->old_type);
-}
-
-void free_contiguous(MPI_Datatype* d){
-//  smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_contiguous_t*>((*d)->substruct)->old_type);
-}
-
-void use_contiguous(MPI_Datatype* d){
-//  smpi_datatype_use(reinterpret_cast<s_smpi_mpi_contiguous_t*>((*d)->substruct)->old_type);
-}
-
-/* Create a Sub type contiguous to be able to serialize and unserialize it the structure s_smpi_mpi_contiguous_t is
- * derived from s_smpi_subtype which required the functions unserialize and serialize */
-s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
-                                                  int size_oldtype){
-  if(block_count==0)
-    return nullptr;
-  s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
-  new_t->base.serialize = &serialize_contiguous;
-  new_t->base.unserialize = &unserialize_contiguous;
-  new_t->base.subtype_free = &free_contiguous;
-  new_t->base.subtype_use = &use_contiguous;
-  new_t->lb = lb;
-  new_t->block_count = block_count;
-  new_t->old_type = old_type;
-  smpi_datatype_use(old_type);
-  new_t->size_oldtype = size_oldtype;
-  smpi_datatype_use(old_type);
-  return new_t;
-}
-
-int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb)
-{
-  int retval;
-//  if(old_type->sizeof_substruct){
-//    //handle this case as a hvector with stride equals to the extent of the datatype
-//    return smpi_datatype_hvector(count, 1, smpi_datatype_get_extent(old_type), old_type, new_type);
-//  }
-//  
-//  s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, count, old_type,smpi_datatype_size(old_type));
-
-//  smpi_datatype_create(new_type, count * smpi_datatype_size(old_type),lb,lb + count * smpi_datatype_size(old_type),
-//            sizeof(s_smpi_mpi_contiguous_t),subtype, DT_FLAG_CONTIGUOUS);
-  retval=MPI_SUCCESS;
-  return retval;
-}
-
-int smpi_datatype_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type)
-{
-  int retval;
-//  if (blocklen<0) 
-//    return MPI_ERR_ARG;
-//  MPI_Aint lb = 0;
-//  MPI_Aint ub = 0;
-//  if(count>0){
-//    lb=smpi_datatype_lb(old_type);
-//    ub=((count-1)*stride+blocklen-1)*smpi_datatype_get_extent(old_type)+smpi_datatype_ub(old_type);
-//  }
-//  if(old_type->sizeof_substruct != 0 || stride != blocklen){
-
-//    s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create(stride, blocklen, count, old_type,
-//                                                                smpi_datatype_size(old_type));
-//    smpi_datatype_create(new_type, count * (blocklen) * smpi_datatype_size(old_type), lb, ub, sizeof(s_smpi_mpi_vector_t), subtype,
-//                         DT_FLAG_VECTOR);
-//    retval=MPI_SUCCESS;
-//  }else{
-//    /* in this situation the data are contiguous thus it's not required to serialize and unserialize it*/
-//    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
-//                         smpi_datatype_size(old_type), 0, nullptr, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
-    retval=MPI_SUCCESS;
-//  }
-  return retval;
-}
-
-void free_vector(MPI_Datatype* d){
-//  smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_indexed_t*>((*d)->substruct)->old_type);
-}
-
-void use_vector(MPI_Datatype* d){
-//  smpi_datatype_use(reinterpret_cast<s_smpi_mpi_indexed_t*>((*d)->substruct)->old_type);
-}
-
-/* Hvector Implementation - Vector with stride in bytes */
-
-/* Copies noncontiguous data into contiguous memory.
- *  @param contiguous_hvector - output hvector
- *  @param noncontiguous_hvector - input hvector
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data, in bytes
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void serialize_hvector( void* noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
-{
-//  s_smpi_mpi_hvector_t* type_c = reinterpret_cast<s_smpi_mpi_hvector_t*>(type);
-//  int i;
-//  char* contiguous_vector_char = static_cast<char*>(contiguous_hvector);
-//  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_hvector);
-
-//  for (i = 0; i < type_c->block_count * count; i++) {
-//    if (type_c->old_type->sizeof_substruct == 0)
-//      memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
-//    else
-//      static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
-//                                                                   contiguous_vector_char,
-//                                                                   type_c->block_length, type_c->old_type->substruct);
-
-//    contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    if((i+1)%type_c->block_count ==0)
-//      noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    else
-//      noncontiguous_vector_char += type_c->block_stride;
-//  }
-}
-/* Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_vector - output hvector
- *  @param contiguous_vector - input hvector
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data, in bytes
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void unserialize_hvector( void* contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
-{
-//  s_smpi_mpi_hvector_t* type_c = reinterpret_cast<s_smpi_mpi_hvector_t*>(type);
-//  int i;
-
-//  char* contiguous_vector_char = static_cast<char*>(contiguous_vector);
-//  char* noncontiguous_vector_char = static_cast<char*>(noncontiguous_vector);
-
-//  for (i = 0; i < type_c->block_count * count; i++) {
-//    if (type_c->old_type->sizeof_substruct == 0){
-//      if(op!=MPI_OP_NULL) 
-//        op->apply( contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length, &type_c->old_type);
-//    }else
-//      static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->unserialize( contiguous_vector_char, noncontiguous_vector_char,
-//                                                                     type_c->block_length, type_c->old_type->substruct,
-//                                                                     op);
-//    contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    if((i+1)%type_c->block_count ==0)
-//      noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
-//    else
-//      noncontiguous_vector_char += type_c->block_stride;
-//  }
-}
-
-/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
- * from s_smpi_subtype which required the functions unserialize and serialize
- *
- */
-s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype){
-  s_smpi_mpi_hvector_t *new_t= xbt_new(s_smpi_mpi_hvector_t,1);
-  new_t->base.serialize = &serialize_hvector;
-  new_t->base.unserialize = &unserialize_hvector;
-  new_t->base.subtype_free = &free_hvector;
-  new_t->base.subtype_use = &use_hvector;
-  new_t->block_stride = block_stride;
-  new_t->block_length = block_length;
-  new_t->block_count = block_count;
-  new_t->old_type = old_type;
-  new_t->size_oldtype = size_oldtype;
-  smpi_datatype_use(old_type);
-  return new_t;
-}
-
-//do nothing for vector types
-void free_hvector(MPI_Datatype* d){
-//  smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_hvector_t*>((*d)->substruct)->old_type);
-}
-
-void use_hvector(MPI_Datatype* d){
-//  smpi_datatype_use(reinterpret_cast<s_smpi_mpi_hvector_t*>((*d)->substruct)->old_type);
-}
-
-int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type)
-{
-  int retval;
-//  if (blocklen<0) 
-//    return MPI_ERR_ARG;
-//  MPI_Aint lb = 0;
-//  MPI_Aint ub = 0;
-//  if(count>0){
-//    lb=smpi_datatype_lb(old_type);
-//    ub=((count-1)*stride)+(blocklen-1)*smpi_datatype_get_extent(old_type)+smpi_datatype_ub(old_type);
-//  }
-//  if(old_type->sizeof_substruct != 0 || stride != blocklen*smpi_datatype_get_extent(old_type)){
-//    s_smpi_mpi_hvector_t* subtype = smpi_datatype_hvector_create( stride, blocklen, count, old_type,
-//                                                                  smpi_datatype_size(old_type));
-
-//    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), lb,ub, sizeof(s_smpi_mpi_hvector_t), subtype, DT_FLAG_VECTOR);
-//    retval=MPI_SUCCESS;
-//  }else{
-//    smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),0,count * blocklen *
-//                                             smpi_datatype_size(old_type), 0, nullptr, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
-  retval=MPI_SUCCESS;
-//  }
-  return retval;
-}
-
-/* Indexed Implementation */
-
-/* Copies noncontiguous data into contiguous memory.
- *  @param contiguous_indexed - output indexed
- *  @param noncontiguous_indexed - input indexed
- *  @param type - pointer contening :
- *      - block_lengths - the width or height of blocked matrix
- *      - block_indices - indices of each data, in element
- *      - count - the number of rows of matrix
- */
-void serialize_indexed( void* noncontiguous_indexed, void *contiguous_indexed, int count, void *type)
-{
-//  s_smpi_mpi_indexed_t* type_c = reinterpret_cast<s_smpi_mpi_indexed_t*>(type);
-//  char* contiguous_indexed_char = static_cast<char*>(contiguous_indexed);
-//  char* noncontiguous_indexed_char = static_cast<char*>(noncontiguous_indexed)+type_c->block_indices[0] * type_c->size_oldtype;
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_type->sizeof_substruct == 0)
-//        memcpy(contiguous_indexed_char, noncontiguous_indexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
-//      else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->serialize( noncontiguous_indexed_char,
-//                                                                     contiguous_indexed_char,
-//                                                                     type_c->block_lengths[i],
-//                                                                     type_c->old_type->substruct);
-
-//      contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-//      if (i<type_c->block_count-1)
-//        noncontiguous_indexed_char =
-//          static_cast<char*>(noncontiguous_indexed) + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
-//      else
-//        noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
-//    }
-//    noncontiguous_indexed=static_cast< void*>(noncontiguous_indexed_char);
-//  }
-}
-/* Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_indexed - output indexed
- *  @param contiguous_indexed - input indexed
- *  @param type - pointer contening :
- *      - block_lengths - the width or height of blocked matrix
- *      - block_indices - indices of each data, in element
- *      - count - the number of rows of matrix
- */
-void unserialize_indexed( void* contiguous_indexed, void *noncontiguous_indexed, int count, void *type, MPI_Op op)
-{
-//  s_smpi_mpi_indexed_t* type_c = reinterpret_cast<s_smpi_mpi_indexed_t*>(type);
-//  char* contiguous_indexed_char = static_cast<char*>(contiguous_indexed);
-//  char* noncontiguous_indexed_char =
-//    static_cast<char*>(noncontiguous_indexed)+type_c->block_indices[0]*smpi_datatype_get_extent(type_c->old_type);
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_type->sizeof_substruct == 0){
-//        if(op!=MPI_OP_NULL) 
-//          op->apply( contiguous_indexed_char, noncontiguous_indexed_char, &type_c->block_lengths[i],
-//                    &type_c->old_type);
-//      }else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->unserialize( contiguous_indexed_char,
-//                                                                       noncontiguous_indexed_char,
-//                                                                       type_c->block_lengths[i],
-//                                                                       type_c->old_type->substruct, op);
-
-//      contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-//      if (i<type_c->block_count-1)
-//        noncontiguous_indexed_char =
-//          static_cast<char*>(noncontiguous_indexed) + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
-//      else
-//        noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
-//    }
-//    noncontiguous_indexed=static_cast<void*>(noncontiguous_indexed_char);
-//  }
-}
-
-void free_indexed(MPI_Datatype* type){
-//  if((*type)->in_use==0){
-//    xbt_free(reinterpret_cast<s_smpi_mpi_indexed_t*>((*type)->substruct)->block_lengths);
-//    xbt_free(reinterpret_cast<s_smpi_mpi_indexed_t*>((*type)->substruct)->block_indices);
-//  }
-//  smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_indexed_t*>((*type)->substruct)->old_type);
-}
-
-void use_indexed(MPI_Datatype* type){
-//  smpi_datatype_use(reinterpret_cast<s_smpi_mpi_indexed_t*>((*type)->substruct)->old_type);
-}
-
-
-/* Create a Sub type indexed to be able to serialize and unserialize it the structure s_smpi_mpi_indexed_t is derived
- * from s_smpi_subtype which required the functions unserialize and serialize */
-s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths, int* block_indices, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype){
-  s_smpi_mpi_indexed_t *new_t= xbt_new(s_smpi_mpi_indexed_t,1);
-  new_t->base.serialize = &serialize_indexed;
-  new_t->base.unserialize = &unserialize_indexed;
-  new_t->base.subtype_free = &free_indexed;
-  new_t->base.subtype_use = &use_indexed;
-  new_t->block_lengths= xbt_new(int, block_count);
-  new_t->block_indices= xbt_new(int, block_count);
-  for (int i = 0; i < block_count; i++) {
-    new_t->block_lengths[i]=block_lengths[i];
-    new_t->block_indices[i]=block_indices[i];
-  }
-  new_t->block_count = block_count;
-  smpi_datatype_use(old_type);
-  new_t->old_type = old_type;
-  new_t->size_oldtype = size_oldtype;
-  return new_t;
-}
-
-int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
-{
-//  int size = 0;
-//  bool contiguous=true;
-//  MPI_Aint lb = 0;
-//  MPI_Aint ub = 0;
-//  if(count>0){
-//    lb=indices[0]*smpi_datatype_get_extent(old_type);
-//    ub=indices[0]*smpi_datatype_get_extent(old_type) + blocklens[0]*smpi_datatype_ub(old_type);
-//  }
-
-//  for (int i = 0; i < count; i++) {
-//    if (blocklens[i] < 0)
-//      return MPI_ERR_ARG;
-//    size += blocklens[i];
-
-//    if(indices[i]*smpi_datatype_get_extent(old_type)+smpi_datatype_lb(old_type)<lb)
-//      lb = indices[i]*smpi_datatype_get_extent(old_type)+smpi_datatype_lb(old_type);
-//    if(indices[i]*smpi_datatype_get_extent(old_type)+blocklens[i]*smpi_datatype_ub(old_type)>ub)
-//      ub = indices[i]*smpi_datatype_get_extent(old_type)+blocklens[i]*smpi_datatype_ub(old_type);
-
-//    if ( (i< count -1) && (indices[i]+blocklens[i] != indices[i+1]) )
-//      contiguous=false;
-//  }
-//  if (old_type->sizeof_substruct != 0)
-//    contiguous=false;
-
-//  if(!contiguous){
-//    s_smpi_mpi_indexed_t* subtype = smpi_datatype_indexed_create( blocklens, indices, count, old_type,
-//                                                                  smpi_datatype_size(old_type));
-//     smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type),lb,ub,sizeof(s_smpi_mpi_indexed_t), subtype, DT_FLAG_DATA);
-//  }else{
-//    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, old_type,
-//                                                                  smpi_datatype_size(old_type));
-//    smpi_datatype_create(new_type, size * smpi_datatype_size(old_type), lb, ub, sizeof(s_smpi_mpi_contiguous_t), subtype,
-//                         DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
-//  }
-  return MPI_SUCCESS;
-}
-/* Hindexed Implementation - Indexed with indices in bytes */
-
-/* Copies noncontiguous data into contiguous memory.
- *  @param contiguous_hindexed - output hindexed
- *  @param noncontiguous_hindexed - input hindexed
- *  @param type - pointer contening :
- *      - block_lengths - the width or height of blocked matrix
- *      - block_indices - indices of each data, in bytes
- *      - count - the number of rows of matrix
- */
-void serialize_hindexed( void* noncontiguous_hindexed, void *contiguous_hindexed, int count, void *type)
-{
-//  s_smpi_mpi_hindexed_t* type_c = reinterpret_cast<s_smpi_mpi_hindexed_t*>(type);
-//  char* contiguous_hindexed_char = static_cast<char*>(contiguous_hindexed);
-//  char* noncontiguous_hindexed_char = static_cast<char*>(noncontiguous_hindexed)+ type_c->block_indices[0];
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_type->sizeof_substruct == 0)
-//        memcpy(contiguous_hindexed_char, noncontiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
-//      else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->serialize( noncontiguous_hindexed_char,
-//                                                                     contiguous_hindexed_char,
-//                                                                     type_c->block_lengths[i],
-//                                                                     type_c->old_type->substruct);
-
-//      contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-//      if (i<type_c->block_count-1)
-//        noncontiguous_hindexed_char = static_cast<char*>(noncontiguous_hindexed) + type_c->block_indices[i+1];
-//      else
-//        noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
-//    }
-//    noncontiguous_hindexed=static_cast<void*>(noncontiguous_hindexed_char);
-//  }
-}
-/* Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_hindexed - output hindexed
- *  @param contiguous_hindexed - input hindexed
- *  @param type - pointer contening :
- *      - block_lengths - the width or height of blocked matrix
- *      - block_indices - indices of each data, in bytes
- *      - count - the number of rows of matrix
- */
-void unserialize_hindexed( void* contiguous_hindexed, void *noncontiguous_hindexed, int count, void *type,
-                         MPI_Op op)
-{
-//  s_smpi_mpi_hindexed_t* type_c = reinterpret_cast<s_smpi_mpi_hindexed_t*>(type);
-
-//  char* contiguous_hindexed_char = static_cast<char*>(contiguous_hindexed);
-//  char* noncontiguous_hindexed_char = static_cast<char*>(noncontiguous_hindexed)+ type_c->block_indices[0];
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_type->sizeof_substruct == 0){
-//        if(op!=MPI_OP_NULL) 
-//          op->apply( contiguous_hindexed_char, noncontiguous_hindexed_char, &type_c->block_lengths[i],
-//                            &type_c->old_type);
-//      }else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_type->substruct)->unserialize( contiguous_hindexed_char,
-//                                                                       noncontiguous_hindexed_char,
-//                                                                       type_c->block_lengths[i],
-//                                                                       type_c->old_type->substruct, op);
-
-//      contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
-//      if (i<type_c->block_count-1)
-//        noncontiguous_hindexed_char = static_cast<char*>(noncontiguous_hindexed) + type_c->block_indices[i+1];
-//      else
-//        noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
-//    }
-//    noncontiguous_hindexed=static_cast<void*>(noncontiguous_hindexed_char);
-//  }
-}
-
-void free_hindexed(MPI_Datatype* type){
-//  if((*type)->in_use==0){
-//    xbt_free(reinterpret_cast<s_smpi_mpi_hindexed_t*>((*type)->substruct)->block_lengths);
-//    xbt_free(reinterpret_cast<s_smpi_mpi_hindexed_t*>((*type)->substruct)->block_indices);
-//  }
-//  smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_hindexed_t*>((*type)->substruct)->old_type);
-}
-
-void use_hindexed(MPI_Datatype* type){
-//  smpi_datatype_use(reinterpret_cast<s_smpi_mpi_hindexed_t*>((*type)->substruct)->old_type);
-}
-
-/* Create a Sub type hindexed to be able to serialize and unserialize it the structure s_smpi_mpi_hindexed_t is derived
- * from s_smpi_subtype which required the functions unserialize and serialize
- */
-s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype){
-  s_smpi_mpi_hindexed_t *new_t= xbt_new(s_smpi_mpi_hindexed_t,1);
-  new_t->base.serialize = &serialize_hindexed;
-  new_t->base.unserialize = &unserialize_hindexed;
-  new_t->base.subtype_free = &free_hindexed;
-  new_t->base.subtype_use = &use_hindexed;
-  new_t->block_lengths= xbt_new(int, block_count);
-  new_t->block_indices= xbt_new(MPI_Aint, block_count);
-  for(int i=0;i<block_count;i++){
-    new_t->block_lengths[i]=block_lengths[i];
-    new_t->block_indices[i]=block_indices[i];
-  }
-  new_t->block_count = block_count;
-  new_t->old_type = old_type;
-  smpi_datatype_use(old_type);
-  new_t->size_oldtype = size_oldtype;
-  return new_t;
-}
-
-int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
-{
-//  int size = 0;
-//  bool contiguous=true;
-//  MPI_Aint lb = 0;
-//  MPI_Aint ub = 0;
-//  if(count>0){
-//    lb=indices[0] + smpi_datatype_lb(old_type);
-//    ub=indices[0] + blocklens[0]*smpi_datatype_ub(old_type);
-//  }
-//  for (int i = 0; i < count; i++) {
-//    if (blocklens[i] < 0)
-//      return MPI_ERR_ARG;
-//    size += blocklens[i];
-
-//    if(indices[i]+smpi_datatype_lb(old_type)<lb) 
-//      lb = indices[i]+smpi_datatype_lb(old_type);
-//    if(indices[i]+blocklens[i]*smpi_datatype_ub(old_type)>ub) 
-//      ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_type);
-
-//    if ( (i< count -1) && (indices[i]+blocklens[i]*(static_cast<int>(smpi_datatype_size(old_type))) != indices[i+1]) )
-//      contiguous=false;
-//  }
-//  if (old_type->sizeof_substruct != 0 || lb!=0)
-//    contiguous=false;
-
-//  if(!contiguous){
-//    s_smpi_mpi_hindexed_t* subtype = smpi_datatype_hindexed_create( blocklens, indices, count, old_type,
-//                                                                  smpi_datatype_size(old_type));
-//    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type), lb, ub ,sizeof(s_smpi_mpi_hindexed_t), subtype, DT_FLAG_DATA);
-//  }else{
-//    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create(lb,size, old_type, smpi_datatype_size(old_type));
-//    smpi_datatype_create(new_type,  size * smpi_datatype_size(old_type), 0,size * smpi_datatype_size(old_type),
-//               1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
-//  }
-  return MPI_SUCCESS;
-}
-
-/* struct Implementation - Indexed with indices in bytes */
-
-/* Copies noncontiguous data into contiguous memory.
- *  @param contiguous_struct - output struct
- *  @param noncontiguous_struct - input struct
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void serialize_struct( void* noncontiguous_struct, void *contiguous_struct, int count, void *type)
-{
-//  s_smpi_mpi_struct_t* type_c = reinterpret_cast<s_smpi_mpi_struct_t*>(type);
-//  char* contiguous_struct_char = static_cast<char*>(contiguous_struct);
-//  char* noncontiguous_struct_char = static_cast<char*>(noncontiguous_struct)+ type_c->block_indices[0];
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_types[i]->sizeof_substruct == 0)
-//        memcpy(contiguous_struct_char, noncontiguous_struct_char,
-//               type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));
-//      else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_types[i]->substruct)->serialize( noncontiguous_struct_char,
-//                                                                         contiguous_struct_char,
-//                                                                         type_c->block_lengths[i],
-//                                                                         type_c->old_types[i]->substruct);
-
-
-//      contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
-//      if (i<type_c->block_count-1)
-//        noncontiguous_struct_char = static_cast<char*>(noncontiguous_struct) + type_c->block_indices[i+1];
-//      else //let's hope this is MPI_UB ?
-//        noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
-//    }
-//    noncontiguous_struct=static_cast<void*>(noncontiguous_struct_char);
-//  }
-}
-
-/* Copies contiguous data into noncontiguous memory.
- *  @param noncontiguous_struct - output struct
- *  @param contiguous_struct - input struct
- *  @param type - pointer contening :
- *      - stride - stride of between noncontiguous data
- *      - block_length - the width or height of blocked matrix
- *      - count - the number of rows of matrix
- */
-void unserialize_struct( void* contiguous_struct, void *noncontiguous_struct, int count, void *type, MPI_Op op)
-{
-//  s_smpi_mpi_struct_t* type_c = reinterpret_cast<s_smpi_mpi_struct_t*>(type);
-
-//  char* contiguous_struct_char = static_cast<char*>(contiguous_struct);
-//  char* noncontiguous_struct_char = static_cast<char*>(noncontiguous_struct)+ type_c->block_indices[0];
-//  for (int j = 0; j < count; j++) {
-//    for (int i = 0; i < type_c->block_count; i++) {
-//      if (type_c->old_types[i]->sizeof_substruct == 0){
-//        if(op!=MPI_OP_NULL) 
-//          op->apply( contiguous_struct_char, noncontiguous_struct_char, &type_c->block_lengths[i],
-//           & type_c->old_types[i]);
-//      }else
-//        static_cast<s_smpi_subtype_t*>(type_c->old_types[i]->substruct)->unserialize( contiguous_struct_char,
-//                                                                           noncontiguous_struct_char,
-//                                                                           type_c->block_lengths[i],
-//                                                                           type_c->old_types[i]->substruct, op);
-
-//      contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
-//      if (i<type_c->block_count-1)
-//        noncontiguous_struct_char =  static_cast<char*>(noncontiguous_struct) + type_c->block_indices[i+1];
-//      else
-//        noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
-//    }
-//    noncontiguous_struct=reinterpret_cast<void*>(noncontiguous_struct_char);
-//  }
-}
-
-void free_struct(MPI_Datatype* type){
-//  for (int i = 0; i < reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->block_count; i++)
-//    smpi_datatype_unuse(reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->old_types[i]);
-//  if((*type)->in_use==0){
-//    xbt_free(reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->block_lengths);
-//    xbt_free(reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->block_indices);
-//    xbt_free(reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->old_types);
-//  }
-}
-
-void use_struct(MPI_Datatype* type){
-//  for (int i = 0; i < reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->block_count; i++)
-//    smpi_datatype_use(reinterpret_cast<s_smpi_mpi_struct_t*>((*type)->substruct)->old_types[i]);
-}
-
-/* Create a Sub type struct to be able to serialize and unserialize it the structure s_smpi_mpi_struct_t is derived
- * from s_smpi_subtype which required the functions unserialize and serialize
- */
-s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
-                                                  MPI_Datatype* old_types){
-  s_smpi_mpi_struct_t *new_t= xbt_new(s_smpi_mpi_struct_t,1);
-  new_t->base.serialize = &serialize_struct;
-  new_t->base.unserialize = &unserialize_struct;
-  new_t->base.subtype_free = &free_struct;
-  new_t->base.subtype_use = &use_struct;
-  new_t->block_lengths= xbt_new(int, block_count);
-  new_t->block_indices= xbt_new(MPI_Aint, block_count);
-  new_t->old_types=  xbt_new(MPI_Datatype, block_count);
-  for (int i = 0; i < block_count; i++) {
-    new_t->block_lengths[i]=block_lengths[i];
-    new_t->block_indices[i]=block_indices[i];
-    new_t->old_types[i]=old_types[i];
-    smpi_datatype_use(new_t->old_types[i]);
-  }
-  new_t->block_count = block_count;
-  return new_t;
-}
-
-int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type)
-{
-//  size_t size = 0;
-//  bool contiguous=true;
-//  size = 0;
-//  MPI_Aint lb = 0;
-//  MPI_Aint ub = 0;
-//  if(count>0){
-//    lb=indices[0] + smpi_datatype_lb(old_types[0]);
-//    ub=indices[0] + blocklens[0]*smpi_datatype_ub(old_types[0]);
-//  }
-//  bool forced_lb=false;
-//  bool forced_ub=false;
-//  for (int i = 0; i < count; i++) {
-//    if (blocklens[i]<0)
-//      return MPI_ERR_ARG;
-//    if (old_types[i]->sizeof_substruct != 0)
-//      contiguous=false;
-
-//    size += blocklens[i]*smpi_datatype_size(old_types[i]);
-//    if (old_types[i]==MPI_LB){
-//      lb=indices[i];
-//      forced_lb=true;
-//    }
-//    if (old_types[i]==MPI_UB){
-//      ub=indices[i];
-//      forced_ub=true;
-//    }
-
-//    if(!forced_lb && indices[i]+smpi_datatype_lb(old_types[i])<lb) 
-//      lb = indices[i];
-//    if(!forced_ub &&  indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i])>ub)
-//      ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i]);
-
-//    if ( (i< count -1) && (indices[i]+blocklens[i]*static_cast<int>(smpi_datatype_size(old_types[i])) != indices[i+1]) )
-//      contiguous=false;
-//  }
-
-//  if(!contiguous){
-//    s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocklens, indices, count, old_types);
-
-//    smpi_datatype_create(new_type,  size, lb, ub,sizeof(s_smpi_mpi_struct_t), subtype, DT_FLAG_DATA);
-//  }else{
-//    s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, MPI_CHAR, 1);
-//    smpi_datatype_create(new_type,  size, lb, ub,1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
-//  }
-  return MPI_SUCCESS;
-}
-
-void smpi_datatype_commit(MPI_Datatype *datatype)
-{
-//  (*datatype)->flags=  ((*datatype)->flags | DT_FLAG_COMMITED);
-}
-
-
-int smpi_type_attr_delete(MPI_Datatype type, int keyval){
-//  smpi_type_key_elem elem =
-//    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
-//  if(elem==nullptr)
-//    return MPI_ERR_ARG;
-//  if(elem->delete_fn!=MPI_NULL_DELETE_FN){
-//    void * value = nullptr;
-//    int flag;
-//    if(smpi_type_attr_get(type, keyval, &value, &flag)==MPI_SUCCESS){
-//      int ret = elem->delete_fn(type, keyval, value, &flag);
-//      if(ret!=MPI_SUCCESS) 
-//        return ret;
-//    }
-//  }  
-//  if(type->attributes==nullptr)
-//    return MPI_ERR_ARG;
-
-//  xbt_dict_remove_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
-  return MPI_SUCCESS;
-}
-
-int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag){
-//  smpi_type_key_elem elem =
-//    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
-//  if(elem==nullptr)
-//    return MPI_ERR_ARG;
-//  if(type->attributes==nullptr){
-//    *flag=0;
-//    return MPI_SUCCESS;
-//  }
-//  try {
-//    *static_cast<void**>(attr_value) = xbt_dict_get_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
-//    *flag=1;
-//  }
-//  catch (xbt_ex& ex) {
-//    *flag=0;
-//  }
-  return MPI_SUCCESS;
-}
-
-int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
-//  if(smpi_type_keyvals==nullptr)
-//    smpi_type_keyvals = xbt_dict_new_homogeneous(nullptr);
-//  smpi_type_key_elem elem =
-//     static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
-//  if(elem==nullptr)
-//    return MPI_ERR_ARG;
-//  int flag;
-//  void* value = nullptr;
-//  smpi_type_attr_get(type, keyval, &value, &flag);
-//  if(flag!=0 && elem->delete_fn!=MPI_NULL_DELETE_FN){
-//    int ret = elem->delete_fn(type, keyval, value, &flag);
-//    if(ret!=MPI_SUCCESS) 
-//      return ret;
-//  }
-//  if(type->attributes==nullptr)
-//    type->attributes = xbt_dict_new_homogeneous(nullptr);
-
-//  xbt_dict_set_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
-  return MPI_SUCCESS;
-}
-
-int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
-                            void* extra_state){
-//  if(smpi_type_keyvals==nullptr)
-//    smpi_type_keyvals = xbt_dict_new_homogeneous(nullptr);
-
-//  smpi_type_key_elem value = (smpi_type_key_elem) xbt_new0(s_smpi_mpi_type_key_elem_t,1);
-
-//  value->copy_fn=copy_fn;
-//  value->delete_fn=delete_fn;
-
-//  *keyval = type_keyval_id;
-//  xbt_dict_set_ext(smpi_type_keyvals,reinterpret_cast<const char*>(keyval), sizeof(int),reinterpret_cast<void*>(value), nullptr);
-//  type_keyval_id++;
-  return MPI_SUCCESS;
-}
-
-int smpi_type_keyval_free(int* keyval){
-//  smpi_type_key_elem elem =
-//    static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int)));
-//  if(elem==0){
-//    return MPI_ERR_ARG;
-//  }
-//  xbt_dict_remove_ext(smpi_type_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int));
-//  xbt_free(elem);
-  return MPI_SUCCESS;
-}
-
-int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,MPI_Comm comm){
-  size_t size = smpi_datatype_size(type);
-  if (outcount - *position < incount*static_cast<int>(size))
-    return MPI_ERR_BUFFER;
-  smpi_datatype_copy(inbuf, incount, type, static_cast<char*>(outbuf) + *position, outcount, MPI_CHAR);
-  *position += incount * size;
-  return MPI_SUCCESS;
-}
-
-int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,MPI_Comm comm){
-  int size = static_cast<int>(smpi_datatype_size(type));
-  if (outcount*size> insize)
-    return MPI_ERR_BUFFER;
-  smpi_datatype_copy(static_cast<char*>(inbuf) + *position, insize, MPI_CHAR, outbuf, outcount, type);
-  *position += outcount * size;
-  return MPI_SUCCESS;
-}
diff --git a/src/smpi/smpi_mpi_dt_private.h b/src/smpi/smpi_mpi_dt_private.h
deleted file mode 100644 (file)
index b6dd5ba..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/* smpi_mpi_dt_private.h -- functions of smpi_mpi_dt.c that are exported to other SMPI modules. */
-
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef SMPI_DT_PRIVATE_H
-#define SMPI_DT_PRIVATE_H
-
-#include <xbt/base.h>
-
-#include "private.h"
-
-SG_BEGIN_DECL()
-
-#define DT_FLAG_DESTROYED     0x0001  /**< user destroyed but some other layers still have a reference */
-#define DT_FLAG_COMMITED      0x0002  /**< ready to be used for a send/recv operation */
-#define DT_FLAG_CONTIGUOUS    0x0004  /**< contiguous datatype */
-#define DT_FLAG_OVERLAP       0x0008  /**< datatype is unpropper for a recv operation */
-#define DT_FLAG_USER_LB       0x0010  /**< has a user defined LB */
-#define DT_FLAG_USER_UB       0x0020  /**< has a user defined UB */
-#define DT_FLAG_PREDEFINED    0x0040  /**< cannot be removed: initial and predefined datatypes */
-#define DT_FLAG_NO_GAPS       0x0080  /**< no gaps around the datatype */
-#define DT_FLAG_DATA          0x0100  /**< data or control structure */
-#define DT_FLAG_ONE_SIDED     0x0200  /**< datatype can be used for one sided operations */
-#define DT_FLAG_UNAVAILABLE   0x0400  /**< datatypes unavailable on the build (OS or compiler dependant) */
-#define DT_FLAG_VECTOR        0x0800  /**< valid only for loops. The loop contain only one element
-                                       **< without extent. It correspond to the vector type. */
-/*
- * We should make the difference here between the predefined contiguous and non contiguous
- * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
- */
-#define DT_FLAG_BASIC      (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
-
-extern const MPI_Datatype MPI_PTR;
-
-/* Structures that handle complex data type information, used for serialization/unserialization of messages */
-typedef struct s_smpi_mpi_contiguous{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  MPI_Aint lb;
-  size_t size_oldtype;
-  int block_count;
-} s_smpi_mpi_contiguous_t;
-
-typedef struct s_smpi_mpi_vector{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
-  int block_stride;
-  int block_length;
-  int block_count;
-} s_smpi_mpi_vector_t;
-
-typedef struct s_smpi_mpi_hvector{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
-  MPI_Aint block_stride;
-  int block_length;
-  int block_count;
-} s_smpi_mpi_hvector_t;
-
-typedef struct s_smpi_mpi_indexed{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
-  int* block_lengths;
-  int* block_indices;
-  int block_count;
-} s_smpi_mpi_indexed_t;
-
-typedef struct s_smpi_mpi_hindexed{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
-  int* block_lengths;
-  MPI_Aint* block_indices;
-  int block_count;
-} s_smpi_mpi_hindexed_t;
-
-typedef struct s_smpi_mpi_struct{
-  s_smpi_subtype_t base;
-  MPI_Datatype old_type;
-  size_t size_oldtype;
-  int* block_lengths;
-  MPI_Aint* block_indices;
-  int block_count;
-  MPI_Datatype* old_types;
-} s_smpi_mpi_struct_t;
-
-//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
-typedef struct {
-  float value;
-  int index;
-} float_int;
-typedef struct {
-  float value;
-  float index;
-} float_float;
-typedef struct {
-  long value;
-  long index;
-} long_long;
-typedef struct {
-  double value;
-  double index;
-} double_double;
-typedef struct {
-  long value;
-  int index;
-} long_int;
-typedef struct {
-  double value;
-  int index;
-} double_int;
-typedef struct {
-  short value;
-  int index;
-} short_int;
-typedef struct {
-  int value;
-  int index;
-} int_int;
-typedef struct {
-  long double value;
-  int index;
-} long_double_int;
-typedef struct {
-  int64_t value;
-  int64_t index;
-} integer128_t;
-
-
-/*
-  Functions to handle serialization/unserialization of messages, 3 for each type of MPI_Type
-  One for creating the substructure to handle, one for serialization, one for unserialization
-*/
-XBT_PRIVATE void unserialize_contiguous( void *contiguous_vector, void *noncontiguous_vector, int count,
-                         void *type, MPI_Op op);
-XBT_PRIVATE void serialize_contiguous( void *noncontiguous_vector, void *contiguous_vector, int count,void *type);
-XBT_PRIVATE void free_contiguous(MPI_Datatype* type);
-XBT_PRIVATE void use_contiguous(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype);
-                                                  
-XBT_PRIVATE void unserialize_vector( void *contiguous_vector, void *noncontiguous_vector, int count,void *type,
-                         MPI_Op op);
-XBT_PRIVATE void serialize_vector( void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
-XBT_PRIVATE void free_vector(MPI_Datatype* type);
-XBT_PRIVATE void use_vector(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
-                                                  MPI_Datatype old_type, int size_oldtype);
-
-XBT_PRIVATE void unserialize_hvector( void *contiguous_vector, void *noncontiguous_vector, int count, void *type,
-                         MPI_Op op);
-XBT_PRIVATE void serialize_hvector( void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
-XBT_PRIVATE void free_hvector(MPI_Datatype* type);
-XBT_PRIVATE void use_hvector(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length,
-                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
-
-XBT_PRIVATE void unserialize_indexed( void *contiguous_indexed, void *noncontiguous_indexed, int count,
-                         void *type, MPI_Op op);
-XBT_PRIVATE void serialize_indexed( void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
-XBT_PRIVATE void free_indexed(MPI_Datatype* type);
-XBT_PRIVATE void use_indexed(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths, int* block_indices,
-                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
-
-XBT_PRIVATE void unserialize_hindexed( void *contiguous_indexed, void *noncontiguous_indexed, int count,
-                         void *type, MPI_Op op);
-XBT_PRIVATE void serialize_hindexed( void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
-XBT_PRIVATE void free_hindexed(MPI_Datatype* type);
-XBT_PRIVATE void use_hindexed(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths, MPI_Aint* block_indices,
-                                                  int block_count, MPI_Datatype old_type, int size_oldtype);
-
-XBT_PRIVATE void unserialize_struct( void *contiguous_indexed, void *noncontiguous_indexed, int count, void *type,
-                         MPI_Op op);
-XBT_PRIVATE void serialize_struct( void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
-XBT_PRIVATE void free_struct(MPI_Datatype* type);
-XBT_PRIVATE void use_struct(MPI_Datatype* type);
-XBT_PRIVATE s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths, MPI_Aint* block_indices,
-                                                  int block_count, MPI_Datatype* old_types);
-
-SG_END_DECL()
-#endif
index 96ac1b8..3cd260e 100644 (file)
@@ -5,7 +5,6 @@
 
 #include "mc/mc.h"
 #include "private.h"
-#include "smpi_mpi_dt_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_op, smpi, "Logging specific to SMPI (op)");
 
@@ -186,7 +185,7 @@ static void maxloc_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 
 static void replace_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
-  memcpy(b, a, *length * smpi_datatype_size(*datatype));
+  memcpy(b, a, *length * (*datatype)->size());
 }
 
 #define CREATE_MPI_OP(name, func)                             \
index 41ab06e..4d8d8f0 100644 (file)
@@ -7,7 +7,6 @@
 #include <xbt/ex.hpp>
 
 #include "private.h"
-#include "smpi_mpi_dt_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
 
@@ -153,7 +152,7 @@ int PMPI_Type_free(MPI_Datatype * datatype)
   if (*datatype == MPI_DATATYPE_NULL) {
     return MPI_ERR_ARG;
   } else {
-    smpi_datatype_unuse(*datatype);
+    (*datatype)->unuse();
     return MPI_SUCCESS;
   }
 }
@@ -165,7 +164,7 @@ int PMPI_Type_size(MPI_Datatype datatype, int *size)
   } else if (size == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *size = static_cast<int>(smpi_datatype_size(datatype));
+    *size = static_cast<int>(datatype->size());
     return MPI_SUCCESS;
   }
 }
@@ -177,7 +176,7 @@ int PMPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size)
   } else if (size == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *size = static_cast<MPI_Count>(smpi_datatype_size(datatype));
+    *size = static_cast<MPI_Count>(datatype->size());
     return MPI_SUCCESS;
   }
 }
@@ -189,7 +188,7 @@ int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent
   } else if (lb == nullptr || extent == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    return smpi_datatype_extent(datatype, lb, extent);
+    return datatype->extent(lb, extent);
   }
 }
 
@@ -205,7 +204,7 @@ int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
   } else if (extent == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *extent = smpi_datatype_get_extent(datatype);
+    *extent = datatype->get_extent();
     return MPI_SUCCESS;
   }
 }
@@ -217,7 +216,7 @@ int PMPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
   } else if (disp == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *disp = smpi_datatype_lb(datatype);
+    *disp = datatype->lb();
     return MPI_SUCCESS;
   }
 }
@@ -229,7 +228,7 @@ int PMPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
   } else if (disp == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *disp = smpi_datatype_ub(datatype);
+    *disp = datatype->ub();
     return MPI_SUCCESS;
   }
 }
@@ -238,7 +237,8 @@ int PMPI_Type_dup(MPI_Datatype datatype, MPI_Datatype *newtype){
   if (datatype == MPI_DATATYPE_NULL) {
     return MPI_ERR_TYPE;
   } else {
-    return smpi_datatype_dup(datatype, newtype);
+    *newtype = new Datatype(datatype);
+    return MPI_SUCCESS;
   }
 }
 
@@ -601,7 +601,7 @@ int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag
       retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
       retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
       retval = MPI_SUCCESS;
@@ -624,7 +624,7 @@ int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
@@ -647,7 +647,7 @@ int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int ta
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
@@ -729,7 +729,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -746,7 +746,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     extra->datatype1 = encode_datatype(datatype, &known);
     int dt_size_send = 1;
     if(known==0)
-      dt_size_send = smpi_datatype_size(datatype);
+      dt_size_send = datatype->size();
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra);
 
@@ -779,7 +779,7 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -794,10 +794,10 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     extra->datatype1 = encode_datatype(datatype, &known);
     int dt_size_send = 1;
     if(known==0)
-      dt_size_send = smpi_datatype_size(datatype);
+      dt_size_send = datatype->size();
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-    TRACE_smpi_send(rank, rank, dst_traced, tag, count*smpi_datatype_size(datatype));
+    TRACE_smpi_send(rank, rank, dst_traced, tag, count*datatype->size());
 
     *request = Request::isend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -827,7 +827,7 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
     retval = MPI_ERR_RANK;
   } else if ((count < 0)|| (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -842,10 +842,10 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
     extra->datatype1 = encode_datatype(datatype, &known);
     int dt_size_send = 1;
     if(known==0)
-      dt_size_send = smpi_datatype_size(datatype);
+      dt_size_send = datatype->size();
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-    TRACE_smpi_send(rank, rank, dst_traced, tag, count*smpi_datatype_size(datatype));
+    TRACE_smpi_send(rank, rank, dst_traced, tag, count*datatype->size());
 
     *request = Request::issend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -874,7 +874,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
       retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -889,7 +889,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
     TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra);
 
@@ -924,7 +924,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf == nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if(tag < 0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -939,12 +939,12 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0) {
-      dt_size_send = smpi_datatype_size(datatype);
+      dt_size_send = datatype->size();
     }
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
     if (!TRACE_smpi_view_internals()) {
-      TRACE_smpi_send(rank, rank, dst_traced, tag,count*smpi_datatype_size(datatype));
+      TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
     }
 
     Request::send(buf, count, datatype, dst, tag, comm);
@@ -970,7 +970,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!is_datatype_valid(datatype)){
+  } else if (!datatype->is_valid()){
     retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -985,11 +985,11 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if(known == 0) {
-      dt_size_send = smpi_datatype_size(datatype);
+      dt_size_send = datatype->size();
     }
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-    TRACE_smpi_send(rank, rank, dst_traced, tag,count*smpi_datatype_size(datatype));
+    TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
   
     Request::ssend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -1010,7 +1010,7 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(sendtype) || !is_datatype_valid(recvtype)) {
+  } else if (!sendtype->is_valid() || !recvtype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
     smpi_empty_status(status);
@@ -1037,16 +1037,16 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
   extra->datatype1 = encode_datatype(sendtype, &known);
   int dt_size_send = 1;
   if(known==0)
-    dt_size_send = smpi_datatype_size(sendtype);
+    dt_size_send = sendtype->size();
   extra->send_size = sendcount*dt_size_send;
   extra->datatype2 = encode_datatype(recvtype, &known);
   int dt_size_recv = 1;
   if(known==0)
-    dt_size_recv = smpi_datatype_size(recvtype);
+    dt_size_recv = recvtype->size();
   extra->recv_size = recvcount*dt_size_recv;
 
   TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__, extra);
-  TRACE_smpi_send(rank, rank, dst_traced, sendtag,sendcount*smpi_datatype_size(sendtype));
+  TRACE_smpi_send(rank, rank, dst_traced, sendtag,sendcount*sendtype->size());
 
   Request::sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src, recvtag, comm,
                     status);
@@ -1064,16 +1064,16 @@ int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst,
                           MPI_Comm comm, MPI_Status* status)
 {
   int retval = 0;
-  if (!is_datatype_valid(datatype)) {
+  if (!datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else if (count < 0) {
     return MPI_ERR_COUNT;
   } else {
-    int size = smpi_datatype_get_extent(datatype) * count;
+    int size = datatype->get_extent() * count;
     void* recvbuf = xbt_new0(char, size);
     retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
     if(retval==MPI_SUCCESS){
-        smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
+        Datatype::copy(recvbuf, count, datatype, buf, count, datatype);
     }
     xbt_free(recvbuf);
 
@@ -1363,7 +1363,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_ARG;
   } else {
     int rank        = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
@@ -1376,7 +1376,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
     TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
     if (comm->size() > 1)
@@ -1445,12 +1445,12 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbu
     extra->datatype1       = encode_datatype(sendtmptype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(sendtmptype);
+      dt_size_send   = sendtmptype->size();
     extra->send_size = sendtmpcount * dt_size_send;
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if ((comm->rank() == root) && known == 0)
-      dt_size_recv   = smpi_datatype_size(recvtype);
+      dt_size_recv   = recvtype->size();
     extra->recv_size = recvcount * dt_size_recv;
 
     TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
@@ -1502,12 +1502,12 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
     extra->datatype1       = encode_datatype(sendtmptype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(sendtype);
+      dt_size_send   = sendtype->size();
     extra->send_size = sendtmpcount * dt_size_send;
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if (known == 0)
-      dt_size_recv = smpi_datatype_size(recvtype);
+      dt_size_recv = recvtype->size();
     if ((comm->rank() == root)) {
       extra->recvcounts = xbt_new(int, size);
       for (i                 = 0; i < size; i++) // copy data to avoid bad free
@@ -1541,7 +1541,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     retval = MPI_ERR_COUNT;
   } else {
     if(sendbuf == MPI_IN_PLACE) {
-      sendbuf=static_cast<char*>(recvbuf)+smpi_datatype_get_extent(recvtype)*recvcount*comm->rank();
+      sendbuf=static_cast<char*>(recvbuf)+recvtype->get_extent()*recvcount*comm->rank();
       sendcount=recvcount;
       sendtype=recvtype;
     }
@@ -1552,12 +1552,12 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     extra->datatype1       = encode_datatype(sendtype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(sendtype);
+      dt_size_send   = sendtype->size();
     extra->send_size = sendcount * dt_size_send;
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if (known == 0)
-      dt_size_recv   = smpi_datatype_size(recvtype);
+      dt_size_recv   = recvtype->size();
     extra->recv_size = recvcount * dt_size_recv;
 
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
@@ -1588,7 +1588,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   } else {
 
     if(sendbuf == MPI_IN_PLACE) {
-      sendbuf=static_cast<char*>(recvbuf)+smpi_datatype_get_extent(recvtype)*displs[comm->rank()];
+      sendbuf=static_cast<char*>(recvbuf)+recvtype->get_extent()*displs[comm->rank()];
       sendcount=recvcounts[comm->rank()];
       sendtype=recvtype;
     }
@@ -1602,12 +1602,12 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     extra->datatype1       = encode_datatype(sendtype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(sendtype);
+      dt_size_send   = sendtype->size();
     extra->send_size = sendcount * dt_size_send;
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if (known == 0)
-      dt_size_recv    = smpi_datatype_size(recvtype);
+      dt_size_recv    = recvtype->size();
     extra->recvcounts = xbt_new(int, size);
     for (i                 = 0; i < size; i++) // copy data to avoid bad free
       extra->recvcounts[i] = recvcounts[i] * dt_size_recv;
@@ -1632,8 +1632,8 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (((comm->rank() == root) && (!is_datatype_valid(sendtype))) ||
-             ((recvbuf != MPI_IN_PLACE) && (!is_datatype_valid(recvtype)))) {
+  } else if (((comm->rank() == root) && (!sendtype->is_valid())) ||
+             ((recvbuf != MPI_IN_PLACE) && (!recvtype->is_valid()))) {
     retval = MPI_ERR_TYPE;
   } else if ((sendbuf == recvbuf) ||
       ((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr))){
@@ -1653,12 +1653,12 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     extra->datatype1       = encode_datatype(sendtype, &known);
     int dt_size_send       = 1;
     if ((comm->rank() == root) && known == 0)
-      dt_size_send   = smpi_datatype_size(sendtype);
+      dt_size_send   = sendtype->size();
     extra->send_size = sendcount * dt_size_send;
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if (known == 0)
-      dt_size_recv   = smpi_datatype_size(recvtype);
+      dt_size_recv   = recvtype->size();
     extra->recv_size = recvcount * dt_size_recv;
     TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
 
@@ -1702,7 +1702,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
     extra->datatype1       = encode_datatype(sendtype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send = smpi_datatype_size(sendtype);
+      dt_size_send = sendtype->size();
     if ((comm->rank() == root)) {
       extra->sendcounts = xbt_new(int, size);
       for (i                 = 0; i < size; i++) // copy data to avoid bad free
@@ -1711,7 +1711,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
     extra->datatype2 = encode_datatype(recvtype, &known);
     int dt_size_recv = 1;
     if (known == 0)
-      dt_size_recv   = smpi_datatype_size(recvtype);
+      dt_size_recv   = recvtype->size();
     extra->recv_size = recvcount * dt_size_recv;
     TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
 
@@ -1733,7 +1733,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype) || op == MPI_OP_NULL) {
+  } else if (!datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     int rank               = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
@@ -1744,7 +1744,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
     extra->root      = root_traced;
 
@@ -1764,7 +1764,7 @@ int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datat
   int retval = 0;
 
   smpi_bench_end();
-  if (!is_datatype_valid(datatype) || op == MPI_OP_NULL) {
+  if (!datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     if(op!=MPI_OP_NULL) op->apply( inbuf, inoutbuf, &count, datatype);
@@ -1782,7 +1782,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1790,8 +1790,8 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
 
     char* sendtmpbuf = static_cast<char*>(sendbuf);
     if( sendbuf == MPI_IN_PLACE ) {
-      sendtmpbuf = static_cast<char*>(xbt_malloc(count*smpi_datatype_get_extent(datatype)));
-      smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
+      sendtmpbuf = static_cast<char*>(xbt_malloc(count*datatype->get_extent()));
+      Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
     }
     int rank               = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
@@ -1800,7 +1800,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
 
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
@@ -1826,7 +1826,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1838,7 +1838,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
 
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
@@ -1860,7 +1860,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1872,12 +1872,12 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send   = smpi_datatype_size(datatype);
+      dt_size_send   = datatype->size();
     extra->send_size = count * dt_size_send;
     void* sendtmpbuf = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
-      sendtmpbuf = static_cast<void*>(xbt_malloc(count * smpi_datatype_size(datatype)));
-      memcpy(sendtmpbuf, recvbuf, count * smpi_datatype_size(datatype));
+      sendtmpbuf = static_cast<void*>(xbt_malloc(count * datatype->size()));
+      memcpy(sendtmpbuf, recvbuf, count * datatype->size());
     }
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
 
@@ -1899,7 +1899,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1916,7 +1916,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send    = smpi_datatype_size(datatype);
+      dt_size_send    = datatype->size();
     extra->send_size  = 0;
     extra->recvcounts = xbt_new(int, size);
     int totalcount    = 0;
@@ -1926,8 +1926,8 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
     }
     void* sendtmpbuf = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
-      sendtmpbuf = static_cast<void*>(xbt_malloc(totalcount * smpi_datatype_size(datatype)));
-      memcpy(sendtmpbuf, recvbuf, totalcount * smpi_datatype_size(datatype));
+      sendtmpbuf = static_cast<void*>(xbt_malloc(totalcount * datatype->size()));
+      memcpy(sendtmpbuf, recvbuf, totalcount * datatype->size());
     }
 
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
@@ -1952,7 +1952,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1969,15 +1969,15 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
     extra->datatype1       = encode_datatype(datatype, &known);
     int dt_size_send       = 1;
     if (known == 0)
-      dt_size_send    = smpi_datatype_size(datatype);
+      dt_size_send    = datatype->size();
     extra->send_size  = 0;
     extra->recvcounts = xbt_new(int, count);
     for (int i             = 0; i < count; i++) // copy data to avoid bad free
       extra->recvcounts[i] = recvcount * dt_size_send;
     void* sendtmpbuf       = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
-      sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * count * smpi_datatype_size(datatype)));
-      memcpy(sendtmpbuf, recvbuf, recvcount * count * smpi_datatype_size(datatype));
+      sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * count * datatype->size()));
+      memcpy(sendtmpbuf, recvbuf, recvcount * count * datatype->size());
     }
 
     TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
@@ -2018,8 +2018,8 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
     int sendtmpcount         = sendcount;
     MPI_Datatype sendtmptype = sendtype;
     if (sendbuf == MPI_IN_PLACE) {
-      sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * comm->size() * smpi_datatype_size(recvtype)));
-      memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * smpi_datatype_size(recvtype));
+      sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * comm->size() * recvtype->size()));
+      memcpy(sendtmpbuf, recvbuf, recvcount * comm->size() * recvtype->size());
       sendtmpcount = recvcount;
       sendtmptype  = recvtype;
     }
@@ -2027,12 +2027,12 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
     int known        = 0;
     extra->datatype1 = encode_datatype(sendtmptype, &known);
     if (known == 0)
-      extra->send_size = sendtmpcount * smpi_datatype_size(sendtmptype);
+      extra->send_size = sendtmpcount * sendtmptype->size();
     else
       extra->send_size = sendtmpcount;
     extra->datatype2   = encode_datatype(recvtype, &known);
     if (known == 0)
-      extra->recv_size = recvcount * smpi_datatype_size(recvtype);
+      extra->recv_size = recvcount * recvtype->size();
     else
       extra->recv_size = recvcount;
 
@@ -2077,7 +2077,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     int known              = 0;
     int dt_size_recv       = 1;
     extra->datatype2       = encode_datatype(recvtype, &known);
-    dt_size_recv           = smpi_datatype_size(recvtype);
+    dt_size_recv           = recvtype->size();
 
     void* sendtmpbuf         = static_cast<char*>(sendbuf);
     int* sendtmpcounts       = sendcounts;
@@ -2103,7 +2103,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
 
     extra->datatype1 = encode_datatype(sendtmptype, &known);
     int dt_size_send = 1;
-    dt_size_send     = smpi_datatype_size(sendtmptype);
+    dt_size_send     = sendtmptype->size();
 
     for (i = 0; i < size; i++) { // copy data to avoid bad free
       extra->send_size += sendtmpcounts[i] * dt_size_send;
@@ -2141,10 +2141,10 @@ int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
 {
   if (status == nullptr || count == nullptr) {
     return MPI_ERR_ARG;
-  } else if (!is_datatype_valid(datatype)) {
+  } else if (!datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else {
-    size_t size = smpi_datatype_size(datatype);
+    size_t size = datatype->size();
     if (size == 0) {
       *count = 0;
       return MPI_SUCCESS;
@@ -2163,7 +2163,7 @@ int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_typ
   } else if (count<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_contiguous(count, old_type, new_type, 0);
+    return Datatype::create_contiguous(count, old_type, 0, new_type);
   }
 }
 
@@ -2171,7 +2171,7 @@ int PMPI_Type_commit(MPI_Datatype* datatype) {
   if (datatype == nullptr || *datatype == MPI_DATATYPE_NULL) {
     return MPI_ERR_TYPE;
   } else {
-    smpi_datatype_commit(datatype);
+    (*datatype)->commit();
     return MPI_SUCCESS;
   }
 }
@@ -2182,7 +2182,7 @@ int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type,
   } else if (count<0 || blocklen<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
+    return Datatype::create_vector(count, blocklen, stride, old_type, new_type);
   }
 }
 
@@ -2192,7 +2192,7 @@ int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old
   } else if (count<0 || blocklen<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
+    return Datatype::create_hvector(count, blocklen, stride, old_type, new_type);
   }
 }
 
@@ -2206,7 +2206,7 @@ int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_
   } else if (count<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
+    return Datatype::create_indexed(count, blocklens, indices, old_type, new_type);
   }
 }
 
@@ -2216,7 +2216,7 @@ int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Dataty
   } else if (count<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
+    return Datatype::create_indexed(count, blocklens, indices, old_type, new_type);
   }
 }
 
@@ -2231,7 +2231,7 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI
     int* blocklens=static_cast<int*>(xbt_malloc(blocklength*count*sizeof(int)));
     for (int i    = 0; i < count; i++)
       blocklens[i]=blocklength;
-    int retval    = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
+    int retval    = Datatype::create_indexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
     return retval;
   }
@@ -2244,7 +2244,7 @@ int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatyp
   } else if (count<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
+    return Datatype::create_hindexed(count, blocklens, indices, old_type, new_type);
   }
 }
 
@@ -2263,7 +2263,7 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indice
     int* blocklens=(int*)xbt_malloc(blocklength*count*sizeof(int));
     for (int i     = 0; i < count; i++)
       blocklens[i] = blocklength;
-    int retval     = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
+    int retval     = Datatype::create_hindexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
     return retval;
   }
@@ -2273,7 +2273,7 @@ int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype*
   if (count<0){
     return MPI_ERR_COUNT;
   } else {
-    return smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
+    return Datatype::create_struct(count, blocklens, indices, old_types, new_type);
   }
 }
 
@@ -2419,8 +2419,7 @@ int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
   MPI_Aint disps[3]     = {lb, 0, lb + extent};
   MPI_Datatype types[3] = {MPI_LB, oldtype, MPI_UB};
 
-  s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create(blocks, disps, 3, types);
-  smpi_datatype_create(newtype, oldtype->size(), lb, lb + extent, sizeof(s_smpi_mpi_struct_t), subtype, DT_FLAG_VECTOR);
+  *newtype = new Type_Struct(oldtype->size(), lb, lb + extent, DT_FLAG_DERIVED, 3, blocks, disps, types);
 
   (*newtype)->addflag(~DT_FLAG_COMMITED);
   return MPI_SUCCESS;
@@ -2518,7 +2517,7 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
+  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process_index();
@@ -2551,7 +2550,7 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
+  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process_index();
@@ -2559,7 +2558,7 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     win->get_group(&group);
     int dst_traced = group->index(target_rank);
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, nullptr);
-    TRACE_smpi_send(rank, rank, dst_traced, SMPI_RMA_TAG, origin_count*smpi_datatype_size(origin_datatype));
+    TRACE_smpi_send(rank, rank, dst_traced, SMPI_RMA_TAG, origin_count*origin_datatype->size());
 
     retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
                            target_datatype);
@@ -2585,8 +2584,8 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!is_datatype_valid(origin_datatype)) ||
-            (!is_datatype_valid(target_datatype))) {
+  } else if ((!origin_datatype->is_valid()) ||
+            (!target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2696,7 +2695,7 @@ int PMPI_Type_set_name(MPI_Datatype  datatype, char * name)
   } else if (name == nullptr)  {
     return MPI_ERR_ARG;
   } else {
-    smpi_datatype_set_name(datatype, name);
+    datatype->set_name(name);
     return MPI_SUCCESS;
   }
 }
@@ -2708,7 +2707,7 @@ int PMPI_Type_get_name(MPI_Datatype  datatype, char * name, int* len)
   } else if (name == nullptr)  {
     return MPI_ERR_ARG;
   } else {
-    smpi_datatype_get_name(datatype, name, len);
+    datatype->get_name(name, len);
     return MPI_SUCCESS;
   }
 }
@@ -2866,7 +2865,7 @@ int PMPI_Type_get_attr (MPI_Datatype type, int type_keyval, void *attribute_val,
   if (type==MPI_DATATYPE_NULL)
     return MPI_ERR_TYPE;
   else
-    return smpi_type_attr_get(type, type_keyval, attribute_val, flag);
+    return type->attr_get(type_keyval, attribute_val, flag);
 }
 
 int PMPI_Type_set_attr (MPI_Datatype type, int type_keyval, void *attribute_val)
@@ -2874,7 +2873,7 @@ int PMPI_Type_set_attr (MPI_Datatype type, int type_keyval, void *attribute_val)
   if (type==MPI_DATATYPE_NULL)
     return MPI_ERR_TYPE;
   else
-    return smpi_type_attr_put(type, type_keyval, attribute_val);
+    return type->attr_put(type_keyval, attribute_val);
 }
 
 int PMPI_Type_delete_attr (MPI_Datatype type, int type_keyval)
@@ -2882,17 +2881,17 @@ int PMPI_Type_delete_attr (MPI_Datatype type, int type_keyval)
   if (type==MPI_DATATYPE_NULL)
     return MPI_ERR_TYPE;
   else
-    return smpi_type_attr_delete(type, type_keyval);
+    return type->attr_delete(type_keyval);
 }
 
 int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
                             void* extra_state)
 {
-  return smpi_type_keyval_create(copy_fn, delete_fn, keyval, extra_state);
+  return Datatype::keyval_create(copy_fn, delete_fn, keyval, extra_state);
 }
 
 int PMPI_Type_free_keyval(int* keyval) {
-  return smpi_type_keyval_free(keyval);
+  return Datatype::keyval_free(keyval);
 }
 
 int PMPI_Info_create( MPI_Info *info){
@@ -3007,32 +3006,32 @@ int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
 int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
   if(incount<0 || outcount < 0 || inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!is_datatype_valid(type))
+  if(!type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
-  return smpi_mpi_unpack(inbuf, incount, position, outbuf,outcount,type, comm);
+  return type->unpack(inbuf, incount, position, outbuf,outcount, comm);
 }
 
 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
   if(incount<0 || outcount < 0|| inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!is_datatype_valid(type))
+  if(!type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
-  return smpi_mpi_pack(inbuf, incount, type, outbuf,outcount,position, comm);
+  return type->pack(inbuf, incount, outbuf,outcount,position, comm);
 }
 
 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
   if(incount<0)
     return MPI_ERR_ARG;
-  if(!is_datatype_valid(datatype))
+  if(!datatype->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
 
-  *size=incount*smpi_datatype_size(datatype);
+  *size=incount*datatype->size();
 
   return MPI_SUCCESS;
 }
index 44720cf..95e10a6 100644 (file)
@@ -226,7 +226,7 @@ static void action_send(const char *const *action)
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
   if (!TRACE_smpi_view_internals())
-    TRACE_smpi_send(rank, rank, dst_traced, 0, size*smpi_datatype_size(MPI_CURRENT_TYPE));
+    TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
   Request::send(nullptr, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
 
@@ -257,7 +257,7 @@ static void action_Isend(const char *const *action)
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
   if (!TRACE_smpi_view_internals())
-    TRACE_smpi_send(rank, rank, dst_traced, 0, size*smpi_datatype_size(MPI_CURRENT_TYPE));
+    TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
   MPI_Request request = Request::isend(nullptr, size, MPI_CURRENT_TYPE, to, 0,MPI_COMM_WORLD);
 
@@ -475,7 +475,7 @@ static void action_bcast(const char *const *action)
   extra->root = root_traced;
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
-  void *sendbuf = smpi_get_tmp_sendbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
 
   mpi_coll_bcast_fun(sendbuf, size, MPI_CURRENT_TYPE, root, MPI_COMM_WORLD);
 
@@ -509,8 +509,8 @@ static void action_reduce(const char *const *action)
 
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
 
-  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
+  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
   mpi_coll_reduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
   smpi_execute_flops(comp_size);
 
@@ -537,8 +537,8 @@ static void action_allReduce(const char *const *action) {
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
+  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
   mpi_coll_allreduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
   smpi_execute_flops(comp_size);
 
@@ -561,8 +561,8 @@ static void action_allToAll(const char *const *action) {
   else
     MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
 
-  void *send = smpi_get_tmp_sendbuffer(send_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
+  void *send = smpi_get_tmp_sendbuffer(send_size*comm_size* MPI_CURRENT_TYPE->size());
+  void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process_index();
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
@@ -602,7 +602,7 @@ static void action_gather(const char *const *action) {
   } else {
     MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
   }
-  void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *send = smpi_get_tmp_sendbuffer(send_size* MPI_CURRENT_TYPE->size());
   void *recv = nullptr;
   int root=0;
   if(action[4])
@@ -610,7 +610,7 @@ static void action_gather(const char *const *action) {
   int rank = MPI_COMM_WORLD->rank();
 
   if(rank==root)
-    recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
+    recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
 
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
   extra->type = TRACING_GATHER;
@@ -653,7 +653,7 @@ static void action_gatherv(const char *const *action) {
   } else
     MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
 
-  void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *send = smpi_get_tmp_sendbuffer(send_size* MPI_CURRENT_TYPE->size());
   void *recv = nullptr;
   for(int i=0;i<comm_size;i++) {
     recvcounts[i] = atoi(action[i+3]);
@@ -665,7 +665,7 @@ static void action_gatherv(const char *const *action) {
   int rank = MPI_COMM_WORLD->rank();
 
   if(rank==root)
-    recv = smpi_get_tmp_recvbuffer(recv_sum* smpi_datatype_size(MPI_CURRENT_TYPE2));
+    recv = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
 
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
   extra->type = TRACING_GATHERV;
@@ -723,8 +723,8 @@ static void action_reducescatter(const char *const *action) {
 
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
 
-  void *sendbuf = smpi_get_tmp_sendbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *recvbuf = smpi_get_tmp_recvbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
+  void *recvbuf = smpi_get_tmp_recvbuffer(size* MPI_CURRENT_TYPE->size());
 
   mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
   smpi_execute_flops(comp_size);
@@ -755,8 +755,8 @@ static void action_allgather(const char *const *action) {
   } else
     MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
 
-  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2));
+  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* MPI_CURRENT_TYPE->size());
+  void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process_index();
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
@@ -799,14 +799,14 @@ static void action_allgatherv(const char *const *action) {
   } else
     MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
 
-  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
+  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* MPI_CURRENT_TYPE->size());
 
   for(int i=0;i<comm_size;i++) {
     recvcounts[i] = atoi(action[i+3]);
     recv_sum=recv_sum+recvcounts[i];
     disps[i] = 0;
   }
-  void *recvbuf = smpi_get_tmp_recvbuffer(recv_sum* smpi_datatype_size(MPI_CURRENT_TYPE2));
+  void *recvbuf = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process_index();
   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
@@ -857,8 +857,8 @@ static void action_allToAllv(const char *const *action) {
   else
     MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
 
-  void *sendbuf = smpi_get_tmp_sendbuffer(send_buf_size* smpi_datatype_size(MPI_CURRENT_TYPE));
-  void *recvbuf  = smpi_get_tmp_recvbuffer(recv_buf_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
+  void *sendbuf = smpi_get_tmp_sendbuffer(send_buf_size* MPI_CURRENT_TYPE->size());
+  void *recvbuf  = smpi_get_tmp_recvbuffer(recv_buf_size* MPI_CURRENT_TYPE2->size());
 
   for(int i=0;i<comm_size;i++) {
     sendcounts[i] = atoi(action[i+3]);
index 6414543..d6e0fcc 100644 (file)
@@ -118,15 +118,15 @@ Request::Request(void *buf, int count, MPI_Datatype datatype, int src, int dst,
 //  if((((flags & RECV) != 0) && ((flags & ACCUMULATE) !=0)) || (datatype->sizeof_substruct != 0)){
 //    // This part handles the problem of non-contiguous memory
 //    old_buf = buf;
-//    buf_ = count==0 ? nullptr : xbt_malloc(count*smpi_datatype_size(datatype));
+//    buf_ = count==0 ? nullptr : xbt_malloc(count*datatype->size());
 //    if ((datatype->sizeof_substruct != 0) && ((flags & SEND) != 0)) {
 //      subtype->serialize(old_buf, buf_, count, datatype->substruct);
 //    }
 //  }
   // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
   old_buf_  = old_buf;
-  size_ = smpi_datatype_size(datatype) * count;
-  smpi_datatype_use(datatype);
+  size_ = datatype->size() * count;
+  datatype->use();
   comm_->use();
   action_          = nullptr;
   detached_        = 0;
@@ -181,7 +181,7 @@ void Request::unuse(MPI_Request* request)
     if((*request)->refcount_<0) xbt_die("wrong refcount");
 
     if((*request)->refcount_==0){
-        smpi_datatype_unuse((*request)->old_type_);
+        (*request)->old_type_->unuse();
         (*request)->comm_->unuse();
         (*request)->print_request("Destroying");
         delete *request;
@@ -391,7 +391,7 @@ void Request::sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int d
   MPI_Status stats[2];
   int myid=smpi_process_index();
   if ((comm->group()->index(dst) == myid) && (comm->group()->index(src) == myid)){
-      smpi_datatype_copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
+      Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
       return;
   }
   requests[0] = isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
@@ -805,12 +805,12 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
 //        // This part handles the problem of non-contignous memory the unserialization at the reception
 //        s_smpi_subtype_t *subtype = static_cast<s_smpi_subtype_t*>(datatype->substruct);
 //        if(req->flags_ & RECV)
-//          subtype->unserialize(req->buf_, req->old_buf_, req->real_size_/smpi_datatype_size(datatype) ,
+//          subtype->unserialize(req->buf_, req->old_buf_, req->real_size_/datatype->size() ,
 //                               datatype->substruct, req->op_);
 //        xbt_free(req->buf_);
 //      }else 
     if(req->flags_ & RECV){//apply op on contiguous buffer for accumulate
-          int n =req->real_size_/smpi_datatype_size(datatype);
+          int n =req->real_size_/datatype->size();
           req->op_->apply(req->buf_, req->old_buf_, &n, datatype);
           xbt_free(req->buf_);
       }
index 86646a9..fa26e84 100644 (file)
@@ -125,7 +125,7 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   //get receiver pointer
   MPI_Win recv_win = connected_wins_[target_rank];
 
-  if(target_count*smpi_datatype_get_extent(target_datatype)>recv_win->size_)
+  if(target_count*target_datatype->get_extent()>recv_win->size_)
     return MPI_ERR_ARG;
 
   void* recv_addr = static_cast<void*> ( static_cast<char*>(recv_win->base_) + target_disp * recv_win->disp_unit_);
@@ -152,7 +152,7 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     requests_->push_back(sreq);
     xbt_mutex_release(mut_);
   }else{
-    smpi_datatype_copy(origin_addr, origin_count, origin_datatype, recv_addr, target_count, target_datatype);
+    Datatype::copy(origin_addr, origin_count, origin_datatype, recv_addr, target_count, target_datatype);
   }
 
   return MPI_SUCCESS;
@@ -166,7 +166,7 @@ int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   //get sender pointer
   MPI_Win send_win = connected_wins_[target_rank];
 
-  if(target_count*smpi_datatype_get_extent(target_datatype)>send_win->size_)
+  if(target_count*target_datatype->get_extent()>send_win->size_)
     return MPI_ERR_ARG;
 
   void* send_addr = static_cast<void*>(static_cast<char*>(send_win->base_) + target_disp * send_win->disp_unit_);
@@ -197,7 +197,7 @@ int Win::get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
     requests_->push_back(rreq);
     xbt_mutex_release(mut_);
   }else{
-    smpi_datatype_copy(send_addr, target_count, target_datatype, origin_addr, origin_count, origin_datatype);
+    Datatype::copy(send_addr, target_count, target_datatype, origin_addr, origin_count, origin_datatype);
   }
 
   return MPI_SUCCESS;
@@ -213,7 +213,7 @@ int Win::accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   //get receiver pointer
   MPI_Win recv_win = connected_wins_[target_rank];
 
-  if(target_count*smpi_datatype_get_extent(target_datatype)>recv_win->size_)
+  if(target_count*target_datatype->get_extent()>recv_win->size_)
     return MPI_ERR_ARG;
 
   void* recv_addr = static_cast<void*>(static_cast<char*>(recv_win->base_) + target_disp * recv_win->disp_unit_);
index be46644..0c7a95f 100644 (file)
@@ -43,7 +43,6 @@ set(EXTRA_DIST
   src/smpi/colls/smpi_mvapich2_selector_stampede.h
   src/smpi/private.h
   src/smpi/private.hpp
-  src/smpi/smpi_mpi_dt_private.h
   src/surf/cpu_cas01.hpp
   src/surf/cpu_interface.hpp
   src/surf/cpu_ti.hpp
@@ -219,7 +218,6 @@ set(SMPI_SRC
   src/smpi/smpi_group.cpp
   src/smpi/smpi_group.hpp
   src/smpi/smpi_mpi.cpp
-  src/smpi/smpi_mpi_dt.cpp
   src/smpi/smpi_datatype.cpp
   src/smpi/smpi_datatype.hpp
   src/smpi/smpi_op.cpp