Negative MPI tags: Just. Say. No.
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.