X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/29aa074252888a50d97e3069f51ffb8e6cf99101..09304e54d26cb2a5b0d3f67bd31f95c982d7c299:/src/smpi/smpi_op.cpp diff --git a/src/smpi/smpi_op.cpp b/src/smpi/smpi_op.cpp index 96ac1b8c10..5d3136e8f2 100644 --- a/src/smpi/smpi_op.cpp +++ b/src/smpi/smpi_op.cpp @@ -5,7 +5,6 @@ #include "mc/mc.h" #include "private.h" -#include "smpi_mpi_dt_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_op, smpi, "Logging specific to SMPI (op)"); @@ -186,7 +185,12 @@ static void maxloc_func(void *a, void *b, int *length, MPI_Datatype * datatype) static void replace_func(void *a, void *b, int *length, MPI_Datatype * datatype) { - memcpy(b, a, *length * smpi_datatype_size(*datatype)); + memcpy(b, a, *length * (*datatype)->size()); +} + +static void no_func(void *a, void *b, int *length, MPI_Datatype * datatype) +{ + /* obviously a no-op */ } #define CREATE_MPI_OP(name, func) \ @@ -206,6 +210,7 @@ CREATE_MPI_OP(MPI_BXOR, bxor_func); CREATE_MPI_OP(MPI_MAXLOC, maxloc_func); CREATE_MPI_OP(MPI_MINLOC, minloc_func); CREATE_MPI_OP(MPI_REPLACE, replace_func); +CREATE_MPI_OP(MPI_NO_OP, no_func); namespace simgrid{ namespace smpi{ @@ -235,14 +240,15 @@ void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype) { if(smpi_privatize_global_variables){//we need to switch as the called function may silently touch global variables XBT_DEBUG("Applying operation, switch to the right data frame "); - smpi_switch_data_segment(smpi_process_index()); + smpi_switch_data_segment(smpi_process()->index()); } - if(!smpi_process_get_replaying()){ + if(!smpi_process()->replaying()){ if(! is_fortran_op_) this->func_(invec, inoutvec, len, &datatype); else{ - int tmp = smpi_type_c2f(datatype); + XBT_DEBUG("Applying operation of length %d from %p and from/to %p", *len, invec, inoutvec); + int tmp = datatype->c2f(); /* Unfortunately, the C and Fortran version of the MPI standard do not agree on the type here, thus the reinterpret_cast. */ this->func_(invec, inoutvec, len, reinterpret_cast(&tmp) ); @@ -250,5 +256,9 @@ void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype) } } +Op* Op::f2c(int id){ + return static_cast(F2C::f2c(id)); +} + } }