Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update URLs (FG #1).
[simgrid.git] / src / smpi / bindings / smpi_f77.cpp
index 407ff14..71d2988 100644 (file)
@@ -98,7 +98,7 @@ void mpi_group_incl_(int* group, int* n, int* ranks, int* group_out, int* ierr)
 
   *ierr = MPI_Group_incl(simgrid::smpi::Group::f2c(*group), *n, ranks, &tmp);
   if(*ierr == MPI_SUCCESS) {
-    *group_out = tmp->add_f();
+    *group_out = tmp->c2f();
   }
 }
 
@@ -107,6 +107,8 @@ void mpi_initialized_(int* flag, int* ierr){
 }
 
 void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
+  //fortran does not handle string endings cleanly, so initialize everything before
+  memset(name, 0, MPI_MAX_PROCESSOR_NAME);
   *ierr = MPI_Get_processor_name(name, resultlen);
 }
 
@@ -508,11 +510,12 @@ void mpi_op_commutative_ (int* op, int* commute, int* ierr){
 }
 
 void mpi_group_free_ (int* group, int* ierr){
- MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
- *ierr = MPI_Group_free(&tmp);
- if(*ierr == MPI_SUCCESS) {
-   simgrid::smpi::F2C::free_f(*group);
- }
+  MPI_Group tmp = simgrid::smpi::Group::f2c(*group);
+  if(tmp != MPI_COMM_WORLD->group() && tmp != MPI_GROUP_EMPTY){
+    simgrid::smpi::Group::unref(tmp);
+    simgrid::smpi::F2C::free_f(*group);
+  }
+  *ierr = MPI_SUCCESS;
 }
 
 void mpi_group_size_ (int* group, int *size, int* ierr){