Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Useless test; TODO--.
[simgrid.git] / src / smpi / bindings / smpi_pmpi_op.cpp
index 80886a9..653cfd7 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "private.hpp"
 #include "smpi_op.hpp"
+#include "smpi_comm.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
@@ -22,13 +23,16 @@ 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;
+  (*op)->mark_as_deleted();
   simgrid::smpi::Op::unref(op);
   *op = MPI_OP_NULL;
   return MPI_SUCCESS;
 }
 
 int PMPI_Op_commutative(MPI_Op op, int* commute){
-  CHECK_OP(1)
+  CHECK_MPI_NULL(1, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_NULL(1, MPI_ERR_ARG, commute)
   *commute = op->is_commutative();
   return MPI_SUCCESS;