+bool Request::match_types(MPI_Datatype stype, MPI_Datatype rtype){
+ bool match = false;
+ if ((stype == rtype) ||
+ //byte and packed always match with anything
+ (stype == MPI_PACKED || rtype == MPI_PACKED || stype == MPI_BYTE || rtype == MPI_BYTE) ||
+ //complex datatypes - we don't properly match these yet, as it would mean checking each subtype recursively.
+ (stype->flags() & DT_FLAG_DERIVED || rtype->flags() & DT_FLAG_DERIVED) ||
+ //duplicated datatypes, check if underlying is ok
+ (stype->duplicated_datatype()!=MPI_DATATYPE_NULL && match_types(stype->duplicated_datatype(), rtype)) ||
+ (rtype->duplicated_datatype()!=MPI_DATATYPE_NULL && match_types(stype, rtype->duplicated_datatype())))
+ match = true;
+ if (!match)
+ XBT_WARN("Mismatched datatypes : sending %s and receiving %s", stype->name().c_str(), rtype->name().c_str());
+ return match;
+}
+
+