Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use/unuse -> ref/unref
authordegomme <augustin.degomme@unibas.ch>
Sat, 11 Mar 2017 16:18:28 +0000 (17:18 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Sat, 11 Mar 2017 16:18:28 +0000 (17:18 +0100)
15 files changed:
src/smpi/colls/allgatherv-ompi-bruck.cpp
src/smpi/colls/allgatherv-ompi-neighborexchange.cpp
src/smpi/colls/alltoall-bruck.cpp
src/smpi/colls/alltoallv-ompi-basic-linear.cpp
src/smpi/colls/reduce_scatter-mpich.cpp
src/smpi/smpi_base.cpp
src/smpi/smpi_coll.cpp
src/smpi/smpi_datatype.cpp
src/smpi/smpi_datatype.hpp
src/smpi/smpi_datatype_derived.cpp
src/smpi/smpi_datatype_derived.hpp
src/smpi/smpi_pmpi.cpp
src/smpi/smpi_request.cpp
src/smpi/smpi_request.hpp
src/smpi/smpi_win.cpp

index 2f12eba..c18c400 100644 (file)
@@ -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);
                                      rbuf, 1, new_rdtype, recvfrom,
                                      COLL_TAG_ALLGATHERV,
                                      comm, MPI_STATUS_IGNORE);
-      new_sdtype->unuse();
-      new_rdtype->unuse();
+      Datatype::unref(new_sdtype);
+      Datatype::unref(new_rdtype);
 
    }
 
 
    }
 
index 16c515a..1679e38 100644 (file)
@@ -205,8 +205,8 @@ smpi_coll_tuned_allgatherv_ompi_neighborexchange(void *sbuf, int scount,
 
         send_data_from = recv_data_from[i_parity];
       
 
         send_data_from = recv_data_from[i_parity];
       
-        new_sdtype->unuse();
-        new_rdtype->unuse();
+        Datatype::unref(new_sdtype);
+        Datatype::unref(new_rdtype);
     }
 
     return MPI_SUCCESS;
     }
 
     return MPI_SUCCESS;
index 026d9bb..9c0e30c 100644 (file)
@@ -86,7 +86,7 @@ smpi_coll_tuned_alltoall_bruck(void *send_buff, int send_count,
 
     Request::sendrecv(tmp_buff, position, MPI_PACKED, dst, tag, recv_buff, 1,
                  new_type, src, tag, comm, &status);
 
     Request::sendrecv(tmp_buff, position, MPI_PACKED, dst, tag, recv_buff, 1,
                  new_type, src, tag, comm, &status);
-    smpi_datatype_unuse(new_type);
+    Datatype::unref(new_type);
 
     pof2 *= 2;
   }
 
     pof2 *= 2;
   }
index 6d970cd..3439a79 100644 (file)
@@ -97,7 +97,7 @@ smpi_coll_tuned_alltoallv_ompi_basic_linear(void *sbuf, int *scounts, int *sdisp
     /* Free the requests. */
     for (i = 0; i < nreqs; ++i) {
       if(ireqs[i]!=MPI_REQUEST_NULL)
     /* Free the requests. */
     for (i = 0; i < nreqs; ++i) {
       if(ireqs[i]!=MPI_REQUEST_NULL)
-        Request::unuse(&ireqs[i]);
+        Request::unref(&ireqs[i]);
     }
     free(ireqs);
 
     }
     free(ireqs);
 
index 1e64860..0848b17 100644 (file)
@@ -480,8 +480,8 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                     }
                 }
 
                     }
                 }
 
-                sendtype->unuse();
-                recvtype->unuse();
+                Datatype::unref(sendtype);
+                Datatype::unref(recvtype);
 
                 mask <<= 1;
                 i++;
 
                 mask <<= 1;
                 i++;
index d363f8d..1ad7735 100644 (file)
@@ -97,7 +97,7 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
-      Request::unuse(&requests[src]);
+      Request::unref(&requests[src]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -155,7 +155,7 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
-      Request::unuse(&requests[src]);
+      Request::unref(&requests[src]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -192,7 +192,7 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
-    Request::unuse(&requests[other]);
+    Request::unref(&requests[other]);
   }
   xbt_free(requests);
 }
   }
   xbt_free(requests);
 }
@@ -227,7 +227,7 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, vo
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
-    Request::unuse(&requests[other]);
+    Request::unref(&requests[other]);
   }
   xbt_free(requests);
 }
   }
   xbt_free(requests);
 }
@@ -266,7 +266,7 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
-      Request::unuse(&requests[dst]);
+      Request::unref(&requests[dst]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -305,7 +305,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
-      Request::unuse(&requests[dst]);
+      Request::unref(&requests[dst]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -364,7 +364,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
       if(index == MPI_UNDEFINED) {
         break;
       }else{
       if(index == MPI_UNDEFINED) {
         break;
       }else{
-        Request::unuse(&requests[index]);
+        Request::unref(&requests[index]);
       }
       if(op) /* op can be MPI_OP_NULL that does nothing */
         if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype);
       }
       if(op) /* op can be MPI_OP_NULL that does nothing */
         if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype);
@@ -441,7 +441,7 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
-    Request::unuse(&requests[index]);
+    Request::unref(&requests[index]);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);
@@ -506,7 +506,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
-    Request::unuse(&requests[index]);
+    Request::unref(&requests[index]);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);
index 8c9aaea..15d583b 100644 (file)
@@ -192,7 +192,7 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount, MPI_Datatype se
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL)
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL)
-        Request::unuse(&requests[i]);
+        Request::unref(&requests[i]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -246,7 +246,7 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount, MPI_Data
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL)
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL)
-        Request::unuse(&requests[i]);
+        Request::unref(&requests[i]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
@@ -303,7 +303,7 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MP
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL) 
     Request::waitall(count, requests, MPI_STATUS_IGNORE);
     for(i = 0; i < count; i++) {
       if(requests[i]!=MPI_REQUEST_NULL) 
-        Request::unuse(&requests[i]);
+        Request::unref(&requests[i]);
     }
     xbt_free(requests);
   }
     }
     xbt_free(requests);
   }
index 43cffe5..865de31 100644 (file)
@@ -110,22 +110,22 @@ namespace smpi{
 
 MPI_Datatype Datatype::null_id_=MPI_DATATYPE_NULL;
 
 
 MPI_Datatype Datatype::null_id_=MPI_DATATYPE_NULL;
 
-Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), attributes_(nullptr), in_use_(1){
+Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), attributes_(nullptr), refcount_(1){
 #if HAVE_MC
   if(MC_is_active())
 #if HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(in_use_), sizeof(in_use_));
+    MC_ignore(&(refcount_), sizeof(refcount_));
 #endif
 }
 
 //for predefined types, so in_use = 0.
 #endif
 }
 
 //for predefined types, so in_use = 0.
-Datatype::Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(name), size_(size), lb_(lb), ub_(ub), flags_(flags), attributes_(nullptr), in_use_(0){
+Datatype::Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(name), size_(size), lb_(lb), ub_(ub), flags_(flags), attributes_(nullptr), refcount_(0){
 #if HAVE_MC
   if(MC_is_active())
 #if HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(in_use_), sizeof(in_use_));
+    MC_ignore(&(refcount_), sizeof(refcount_));
 #endif
 }
 
 #endif
 }
 
-Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), attributes_(nullptr), in_use_(1)
+Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), attributes_(nullptr), refcount_(1)
 {
   flags_ &= ~DT_FLAG_PREDEFINED;
   *ret = MPI_SUCCESS;
 {
   flags_ &= ~DT_FLAG_PREDEFINED;
   *ret = MPI_SUCCESS;
@@ -154,13 +154,13 @@ Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), lb_(datatype-
 }
 
 Datatype::~Datatype(){
 }
 
 Datatype::~Datatype(){
-  xbt_assert(in_use_ >= 0);
+  xbt_assert(refcount_ >= 0);
 
   if(flags_ & DT_FLAG_PREDEFINED)
     return;
 
   //if still used, mark for deletion
 
   if(flags_ & DT_FLAG_PREDEFINED)
     return;
 
   //if still used, mark for deletion
-  if(in_use_!=0){
+  if(refcount_!=0){
       flags_ |=DT_FLAG_DESTROYED;
       return;
   }
       flags_ |=DT_FLAG_DESTROYED;
       return;
   }
@@ -182,27 +182,27 @@ Datatype::~Datatype(){
 }
 
 
 }
 
 
-void Datatype::use(){
+void Datatype::ref(){
 
 
-  in_use_++;
+  refcount_++;
 
 #if HAVE_MC
   if(MC_is_active())
 
 #if HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(in_use_), sizeof(in_use_));
+    MC_ignore(&(refcount_), sizeof(refcount_));
 #endif
 }
 
 #endif
 }
 
-void Datatype::unuse()
+void Datatype::unref(MPI_Datatype datatype)
 {
 {
-  if (in_use_ > 0)
-    in_use_--;
+  if (datatype->refcount_ > 0)
+    datatype->refcount_--;
 
 
-  if (in_use_ == 0)
-    this->~Datatype();
+  if (datatype->refcount_ == 0  && !(datatype->flags_ & DT_FLAG_PREDEFINED))
+    delete datatype;
 
 #if HAVE_MC
   if(MC_is_active())
 
 #if HAVE_MC
   if(MC_is_active())
-    MC_ignore(&(in_use_), sizeof(in_use_));
+    MC_ignore(&(datatype->refcount_), sizeof(datatype->refcount_));
 #endif
 }
 
 #endif
 }
 
index b639ceb..dc5ea85 100644 (file)
@@ -85,7 +85,7 @@ class Datatype : public F2C{
     MPI_Aint ub_;
     int flags_;
     xbt_dict_t attributes_;
     MPI_Aint ub_;
     int flags_;
     xbt_dict_t attributes_;
-    int in_use_;
+    int refcount_;
   public:
     static MPI_Datatype null_id_;
 
   public:
     static MPI_Datatype null_id_;
 
@@ -93,8 +93,8 @@ class Datatype : public F2C{
     Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags);
     Datatype(Datatype *datatype, int* ret);
     virtual ~Datatype();
     Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags);
     Datatype(Datatype *datatype, int* ret);
     virtual ~Datatype();
-    void use();
-    void unuse();
+    void ref();
+    static void unref(MPI_Datatype datatype);
     void commit();
     bool is_valid();
     size_t size();
     void commit();
     bool is_valid();
     size_t size();
index c6aeec1..7a8bc0f 100644 (file)
@@ -21,15 +21,15 @@ namespace smpi{
 
 
 Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type){
 
 
 Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint 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();
+  old_type_->ref();
 }
 
 Type_Contiguous::~Type_Contiguous(){
 }
 
 Type_Contiguous::~Type_Contiguous(){
-  old_type_->unuse();
+  Datatype::unref(old_type_);
 }
 
 }
 
-void Type_Contiguous::use(){
-  old_type_->use();
+void Type_Contiguous::ref(){
+  old_type_->ref();
 };
 
 void Type_Contiguous::serialize( void* noncontiguous_buf, void *contiguous_buf, 
 };
 
 void Type_Contiguous::serialize( void* noncontiguous_buf, void *contiguous_buf, 
@@ -49,15 +49,15 @@ void Type_Contiguous::unserialize( void* contiguous_buf, void *noncontiguous_buf
 
 
 Type_Vector::Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int block_length, int stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(block_length),block_stride_(stride),  old_type_(old_type){
 
 
 Type_Vector::Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int block_length, int stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(block_length),block_stride_(stride),  old_type_(old_type){
-old_type_->use();
+  old_type_->ref();
 }
 
 Type_Vector::~Type_Vector(){
 }
 
 Type_Vector::~Type_Vector(){
-  old_type_->unuse();
+  Datatype::unref(old_type_);
 }
 
 }
 
-void Type_Vector::use(){
-  old_type_->use();
+void Type_Vector::ref(){
+  old_type_->ref();
 }
 
 
 }
 
 
@@ -104,13 +104,13 @@ void Type_Vector::unserialize( void* contiguous_buf, void *noncontiguous_buf,
 }
 
 Type_Hvector::Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int block_length, MPI_Aint stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(block_length), block_stride_(stride), old_type_(old_type){
 }
 
 Type_Hvector::Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int block_length, MPI_Aint stride, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), block_length_(block_length), block_stride_(stride), old_type_(old_type){
-  old_type->use();
+  old_type->ref();
 }
 Type_Hvector::~Type_Hvector(){
 }
 Type_Hvector::~Type_Hvector(){
-  old_type_->unuse();
+  Datatype::unref(old_type_);
 }
 }
-void Type_Hvector::use(){
-  old_type_->use();
+void Type_Hvector::ref(){
+  old_type_->ref();
 }
 
 void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
 }
 
 void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, 
@@ -155,7 +155,7 @@ void Type_Hvector::unserialize( void* contiguous_buf, void *noncontiguous_buf,
 }
 
 Type_Indexed::Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths, int* block_indices, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type){
 }
 
 Type_Indexed::Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths, int* block_indices, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type){
-  old_type->use();
+  old_type->ref();
   block_lengths_ = new int[count];
   block_indices_ = new int[count];
   for (int i = 0; i < count; i++) {
   block_lengths_ = new int[count];
   block_indices_ = new int[count];
   for (int i = 0; i < count; i++) {
@@ -165,15 +165,15 @@ Type_Indexed::Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int cou
 }
 
 Type_Indexed::~Type_Indexed(){
 }
 
 Type_Indexed::~Type_Indexed(){
-  old_type_->unuse();
-  if(in_use_==0){
+  Datatype::unref(old_type_);
+  if(refcount_==0){
     delete[] block_lengths_;
     delete[] block_indices_;
   }
 }
 
     delete[] block_lengths_;
     delete[] block_indices_;
   }
 }
 
-void Type_Indexed::use(){
-  old_type_->use();
+void Type_Indexed::ref(){
+  old_type_->ref();
 }
 
 void Type_Indexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
 }
 
 void Type_Indexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
@@ -227,7 +227,7 @@ void Type_Indexed::unserialize( void* contiguous_buf, void *noncontiguous_buf,
 Type_Hindexed::Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type)
 : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
 {
 Type_Hindexed::Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type)
 : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
 {
-  old_type_->use();
+  old_type_->ref();
   block_lengths_ = new int[count];
   block_indices_ = new MPI_Aint[count];
   for (int i = 0; i < count; i++) {
   block_lengths_ = new int[count];
   block_indices_ = new MPI_Aint[count];
   for (int i = 0; i < count; i++) {
@@ -237,15 +237,15 @@ Type_Hindexed::Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int c
 }
 
     Type_Hindexed::~Type_Hindexed(){
 }
 
     Type_Hindexed::~Type_Hindexed(){
-  old_type_->unuse();
-  if(in_use_==0){
+  Datatype::unref(old_type_);
+  if(refcount_==0){
     delete[] block_lengths_;
     delete[] block_indices_;
   }
 }
 
     delete[] block_lengths_;
     delete[] block_indices_;
   }
 }
 
-void Type_Hindexed::use(){
-  old_type_->use();
+void Type_Hindexed::ref(){
+  old_type_->ref();
 }
 void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
                 int count){
 }
 void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf, 
                 int count){
@@ -299,24 +299,24 @@ Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count
     block_lengths_[i]=block_lengths[i];
     block_indices_[i]=block_indices[i];
     old_types_[i]=old_types[i];
     block_lengths_[i]=block_lengths[i];
     block_indices_[i]=block_indices[i];
     old_types_[i]=old_types[i];
-    old_types_[i]->use();
+    old_types_[i]->ref();
   }
 }
 
 Type_Struct::~Type_Struct(){
   for (int i = 0; i < block_count_; i++) {
   }
 }
 
 Type_Struct::~Type_Struct(){
   for (int i = 0; i < block_count_; i++) {
-    old_types_[i]->unuse();
+    Datatype::unref(old_types_[i]);
   }
   }
-  if(in_use_==0){
+  if(refcount_==0){
     delete[] block_lengths_;
     delete[] block_indices_;
     delete[] old_types_;
   }
 }
 
     delete[] block_lengths_;
     delete[] block_indices_;
     delete[] old_types_;
   }
 }
 
-void Type_Struct::use(){
+void Type_Struct::ref(){
   for (int i = 0; i < block_count_; i++) {
   for (int i = 0; i < block_count_; i++) {
-    old_types_[i]->use();
+    old_types_[i]->ref();
   }
 }
 
   }
 }
 
index 22d957b..914f9d8 100644 (file)
@@ -21,7 +21,7 @@ class Type_Contiguous: public Datatype{
   public:
     Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
     ~Type_Contiguous();
   public:
     Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
     ~Type_Contiguous();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
@@ -37,7 +37,7 @@ class Type_Vector: public Datatype{
   public:
     Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type);
     ~Type_Vector();
   public:
     Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type);
     ~Type_Vector();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
@@ -53,7 +53,7 @@ class Type_Hvector: public Datatype{
   public:
     Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type);
     ~Type_Hvector();
   public:
     Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type);
     ~Type_Hvector();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
@@ -69,7 +69,7 @@ class Type_Indexed: public Datatype{
   public:
     Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type);
     ~Type_Indexed();
   public:
     Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type);
     ~Type_Indexed();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
@@ -85,7 +85,7 @@ class Type_Hindexed: public Datatype{
   public:
     Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type);
     ~Type_Hindexed();
   public:
     Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type);
     ~Type_Hindexed();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
@@ -101,7 +101,7 @@ class Type_Struct: public Datatype{
   public:
     Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types);
     ~Type_Struct();
   public:
     Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types);
     ~Type_Struct();
-    void use();
+    void ref();
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
     void serialize( void* noncontiguous, void *contiguous, 
                             int count);
     void unserialize( void* contiguous_vector, void *noncontiguous_vector, 
index 7dc9eae..5acaab9 100644 (file)
@@ -151,7 +151,7 @@ int PMPI_Type_free(MPI_Datatype * datatype)
   if (*datatype == MPI_DATATYPE_NULL) {
     return MPI_ERR_ARG;
   } else {
   if (*datatype == MPI_DATATYPE_NULL) {
     return MPI_ERR_ARG;
   } else {
-    (*datatype)->unuse();
+    Datatype::unref(*datatype);
     return MPI_SUCCESS;
   }
 }
     return MPI_SUCCESS;
   }
 }
@@ -240,7 +240,7 @@ int PMPI_Type_dup(MPI_Datatype datatype, MPI_Datatype *newtype){
     *newtype = new Datatype(datatype, &retval);
     //error when duplicating, free the new datatype
     if(retval!=MPI_SUCCESS){
     *newtype = new Datatype(datatype, &retval);
     //error when duplicating, free the new datatype
     if(retval!=MPI_SUCCESS){
-      (*newtype)->unuse();
+      Datatype::unref(*newtype);
       *newtype = MPI_DATATYPE_NULL;
     }
   }
       *newtype = MPI_DATATYPE_NULL;
     }
   }
@@ -711,7 +711,7 @@ int PMPI_Request_free(MPI_Request * request)
   if (*request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_ARG;
   } else {
   if (*request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_ARG;
   } else {
-    Request::unuse(request);
+    Request::unref(request);
     retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
     retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
index 978e335..1a5dcf5 100644 (file)
@@ -126,7 +126,7 @@ Request::Request(void *buf, int count, MPI_Datatype datatype, int src, int dst,
   // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
   old_buf_  = old_buf;
   size_ = datatype->size() * count;
   // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
   old_buf_  = old_buf;
   size_ = datatype->size() * count;
-  datatype->use();
+  datatype->ref();
   comm_->ref();
   action_          = nullptr;
   detached_        = 0;
   comm_->ref();
   action_          = nullptr;
   detached_        = 0;
@@ -182,14 +182,14 @@ size_t Request::real_size(){
 }
 
 
 }
 
 
-void Request::unuse(MPI_Request* request)
+void Request::unref(MPI_Request* request)
 {
   if((*request) != MPI_REQUEST_NULL){
     (*request)->refcount_--;
     if((*request)->refcount_<0) xbt_die("wrong refcount");
 
     if((*request)->refcount_==0){
 {
   if((*request) != MPI_REQUEST_NULL){
     (*request)->refcount_--;
     if((*request)->refcount_<0) xbt_die("wrong refcount");
 
     if((*request)->refcount_==0){
-        (*request)->old_type_->unuse();
+        Datatype::unref((*request)->old_type_);
         Comm::unref((*request)->comm_);
         (*request)->print_request("Destroying");
         delete *request;
         Comm::unref((*request)->comm_);
         (*request)->print_request("Destroying");
         delete *request;
@@ -406,8 +406,8 @@ void Request::sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int d
   requests[1] = irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
   startall(2, requests);
   waitall(2, requests, stats);
   requests[1] = irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
   startall(2, requests);
   waitall(2, requests, stats);
-  unuse(&requests[0]);
-  unuse(&requests[1]);
+  unref(&requests[0]);
+  unref(&requests[1]);
   if(status != MPI_STATUS_IGNORE) {
     // Copy receive status
     *status = stats[1];
   if(status != MPI_STATUS_IGNORE) {
     // Copy receive status
     *status = stats[1];
@@ -778,7 +778,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
     if (xbt_cfg_get_boolean("smpi/grow-injected-times"))
       nsleeps++;
   }
     if (xbt_cfg_get_boolean("smpi/grow-injected-times"))
       nsleeps++;
   }
-  unuse(&request);
+  unref(&request);
 }
 
 
 }
 
 
@@ -834,12 +834,12 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
       simcall_process_sleep(sleeptime);
       XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
     }
       simcall_process_sleep(sleeptime);
       XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime);
     }
-    unuse(&(req->detached_sender_));
+    unref(&(req->detached_sender_));
   }
   if(req->flags_ & PERSISTENT)
     req->action_ = nullptr;
   req->flags_ |= FINISHED;
   }
   if(req->flags_ & PERSISTENT)
     req->action_ = nullptr;
   req->flags_ |= FINISHED;
-  unuse(request);
+  unref(request);
 }
 
 
 }
 
 
index e4e2e4b..68ddcd9 100644 (file)
@@ -53,7 +53,7 @@ class Request : public F2C{
     void start();
 
     static void finish_wait(MPI_Request* request, MPI_Status * status);
     void start();
 
     static void finish_wait(MPI_Request* request, MPI_Status * status);
-    static void unuse(MPI_Request* request);
+    static void unref(MPI_Request* request);
     static void wait(MPI_Request* req, MPI_Status * status);
     static MPI_Request send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
     static MPI_Request isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
     static void wait(MPI_Request* req, MPI_Status * status);
     static MPI_Request send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
     static MPI_Request isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
index 16a465a..de5d18c 100644 (file)
@@ -274,7 +274,7 @@ int Win::start(MPI_Group group, int assert){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
-    Request::unuse(&reqs[i]);
+    Request::unref(&reqs[i]);
   }
   xbt_free(reqs);
   opened_++; //we're open for business !
   }
   xbt_free(reqs);
   opened_++; //we're open for business !
@@ -303,7 +303,7 @@ int Win::post(MPI_Group group, int assert){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
-    Request::unuse(&reqs[i]);
+    Request::unref(&reqs[i]);
   }
   xbt_free(reqs);
   opened_++; //we're open for business !
   }
   xbt_free(reqs);
   opened_++; //we're open for business !
@@ -336,7 +336,7 @@ int Win::complete(){
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
 
   for(i=0;i<size;i++){
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
 
   for(i=0;i<size;i++){
-    Request::unuse(&reqs[i]);
+    Request::unref(&reqs[i]);
   }
   xbt_free(reqs);
 
   }
   xbt_free(reqs);
 
@@ -384,7 +384,7 @@ int Win::wait(){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
   Request::startall(size, reqs);
   Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
   for(i=0;i<size;i++){
-    Request::unuse(&reqs[i]);
+    Request::unref(&reqs[i]);
   }
   xbt_free(reqs);
   xbt_mutex_acquire(mut_);
   }
   xbt_free(reqs);
   xbt_mutex_acquire(mut_);