X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/442a7c3376eb3a0bdde33e546a8146690c677466..cf6eca29ed0c04dd6f2e5d1efdac635c64006ff1:/src/smpi/smpi_op.cpp diff --git a/src/smpi/smpi_op.cpp b/src/smpi/smpi_op.cpp index 5d3136e8f2..805647bb61 100644 --- a/src/smpi/smpi_op.cpp +++ b/src/smpi/smpi_op.cpp @@ -18,8 +18,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_op, smpi, "Logging specific to SMPI (op)"); #define BAND_OP(a, b) (b) &= (a) #define BOR_OP(a, b) (b) |= (a) #define BXOR_OP(a, b) (b) ^= (a) -#define MAXLOC_OP(a, b) (b) = (a.value) < (b.value) ? (b) : (a) -#define MINLOC_OP(a, b) (b) = (a.value) < (b.value) ? (a) : (b) +#define MAXLOC_OP(a, b) (b) = (a.value) < (b.value) ? (b) : ((a.value) == (b.value) ? ((a.index) < (b.index) ? (a) : (b)) : (a)) +#define MINLOC_OP(a, b) (b) = (a.value) < (b.value) ? (a) : ((a.value) == (b.value) ? ((a.index) < (b.index) ? (a) : (b)) : (b)) #define APPLY_FUNC(a, b, length, type, func) \ { \ @@ -238,12 +238,12 @@ void Op::set_fortran_op() 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 + if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){//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()); } - if(!smpi_process()->replaying()){ + if(!smpi_process()->replaying() && *len > 0){ if(! is_fortran_op_) this->func_(invec, inoutvec, len, &datatype); else{