Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
read, seek + init
[simgrid.git] / src / smpi / mpi / smpi_op.cpp
index e81b93f..2f9da35 100644 (file)
@@ -66,7 +66,9 @@ APPLY_OP_LOOP(MPI_OFFSET, MPI_Offset,op)\
 APPLY_OP_LOOP(MPI_INTEGER1, int,op)\
 APPLY_OP_LOOP(MPI_INTEGER2, int16_t,op)\
 APPLY_OP_LOOP(MPI_INTEGER4, int32_t,op)\
-APPLY_OP_LOOP(MPI_INTEGER8, int64_t,op)
+APPLY_OP_LOOP(MPI_INTEGER8, int64_t,op)\
+APPLY_OP_LOOP(MPI_COUNT, long long,op)
+
 
 #define APPLY_BOOL_OP_LOOP(op)\
 APPLY_OP_LOOP(MPI_C_BOOL, bool,op)
@@ -196,7 +198,7 @@ static void no_func(void*, void*, int*, MPI_Datatype*)
 }
 
 #define CREATE_MPI_OP(name, func)                             \
-  static SMPI_Op mpi_##name (&(func) /* func */, true ); \
+  static SMPI_Op mpi_##name (&(func) /* func */, true, true ); \
 MPI_Op name = &mpi_##name;
 
 CREATE_MPI_OP(MPI_MAX, max_func);
@@ -242,5 +244,17 @@ Op* Op::f2c(int id){
   return static_cast<Op*>(F2C::f2c(id));
 }
 
+void Op::ref(){
+  refcount_++;
+}
+
+void Op::unref(MPI_Op* op){
+  if((*op)!=MPI_OP_NULL){
+    (*op)->refcount_--;
+    if((*op)->refcount_==0 && (*op)->predefined_==false)
+      delete(*op);
+  }
+}
+
 }
 }