Negative MPI tags: Just. Say. No.

October 12, 2012 - 4 Comments

A user on the Open MPI mailing list recently asked about using negative tags for point-to-point MPI sending/receiving operations.  He was using bit-mapped tags, and needed just one more bit.

Although this may seem like an innocent, easy-to-fulfill feature request, there are several reasons why we can’t allow the use of negative tags.

First and foremost, the MPI standard disallows negative tags.  It is explicitly mentioned in MPI-3 section 3.2.3 that tag values must be non-negative integers.

Second, the MPI standard disallows negative tags!

Ok, you get my point.  🙂

Since the MPI standard disallows them, most/many MPI implementations have parameter-error-checking modes where they will invoke an error if you pass in a negative tag.

Hence, even if you bypass this error check, you have a non-portable MPI application.  While not disastrous, this is certainly not desirable.  Even if you have a fixed environment where you run your MPI application (including a fixed MPI implementation), someday that environment will be upgraded.  You might get entire different hardware, or a new version of the MPI implementation, or …

Something may change such that your non-portable MPI application now stops working.  Probably right before a crucial deadline, too.

As a sidenote, because MPI explicitly disallows negative tags, MPI implementations sometimes use negative tags for internal, in-band control messages.  Hence, even if you throw all cares of portability aside and disable negative tag checking in your MPI implementation, you may actually collide with internal control messages.  Nothing good can come of that.

Friends don’t let friends use negative tags.
The first rule of negative MPI tags is that you do not talk about negative MPI tags.
Negative tags: Just. Say. No.


In an effort to keep conversations fresh, Cisco Blogs closes comments after 60 days. Please visit the Cisco Blogs hub page for the latest content.


  1. I was not around when MPI-1 was designed, but I *suspect* that at least one of the reasons was to allow MPI implementations to send in-band control messages.

  2. Is there a reason behind using signed type for tags?

  3. Absolutely! Heck, I can’t even cook a reasonable dinner for my family without at least 2^17 or 2^18 tags.


  4. Indeed, to be completely portable you have to be ready to use no more than 2^15 tags, which is far, far too few for many useful protocols.