Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Die when attempting to free predefined operators.
authorAugustin Degomme <adegomme@gmail.com>
Thu, 18 Feb 2021 00:10:37 +0000 (01:10 +0100)
committerAugustin Degomme <adegomme@gmail.com>
Thu, 18 Feb 2021 00:10:37 +0000 (01:10 +0100)
We used to just ignore that

src/smpi/bindings/smpi_pmpi_op.cpp
src/smpi/include/smpi_op.hpp
src/smpi/mpi/smpi_op.cpp

index 80886a9..e90a6ba 100644 (file)
@@ -22,6 +22,8 @@ int PMPI_Op_free(MPI_Op * op)
 {
   CHECK_NULL(1, MPI_ERR_ARG, op)
   CHECK_MPI_NULL(1, MPI_OP_NULL, MPI_ERR_OP, *op)
+  if((*op)->is_predefined())
+    return MPI_ERR_OP;
   simgrid::smpi::Op::unref(op);
   *op = MPI_OP_NULL;
   return MPI_SUCCESS;
index 310822f..a267f54 100644 (file)
@@ -17,11 +17,12 @@ class Op : public F2C{
   bool is_commutative_;
   bool is_fortran_op_ = false;
   int refcount_ = 1;
-  bool predefined_;
+  bool is_predefined_;
 
 public:
-  Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), predefined_(predefined) {}
+  Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), is_predefined_(predefined) {}
   bool is_commutative() const { return is_commutative_; }
+  bool is_predefined() const { return is_predefined_; }
   bool is_fortran_op() const { return is_fortran_op_; }
   // tell that we were created from fortran, so we need to translate the type to fortran when called
   void set_fortran_op() { is_fortran_op_ = true; }
index bac540c..f2e3d7c 100644 (file)
@@ -270,7 +270,7 @@ void Op::ref(){
 void Op::unref(MPI_Op* op){
   if((*op)!=MPI_OP_NULL){
     (*op)->refcount_--;
-    if ((*op)->refcount_ == 0 && not (*op)->predefined_)
+    if ((*op)->refcount_ == 0 && not (*op)->is_predefined_)
       delete(*op);
   }
 }