diff --git a/mpistalls.c b/mpistalls.c
index 75eec48a61b23fbd1e2de1c342c70282806db294..14b89b8d34d96976ff39ff291782852f63f705e9 100644
--- a/mpistalls.c
+++ b/mpistalls.c
@@ -15,12 +15,16 @@
 #include "error.h"
 #include "mpiuse.h"
 
+/* Global: Our rank for all to see. */
+int myrank = -1;
+
 /* Integer types of send and recv tasks, must match log. */
-static int task_type_send = 22;
-static int task_type_recv = 23;
+static const int task_type_send = 22;
+static const int task_type_recv = 23;
 
-/* Our rank for all to see. */
-int myrank = -1;
+/* Global communicators for each of the subtypes. */
+static const int task_subtype_count = 30; // Just some upper limit on subtype.
+static MPI_Comm subtypeMPI_comms[30];
 
 /* The local queues. */
 static struct mpiuse_log_entry **volatile reqs_queue;
@@ -53,7 +57,7 @@ static void *inject_thread(void *arg) {
     int err = 0;
     if (log->type == task_type_send) {
       err = MPI_Isend(log->data, log->size, MPI_BYTE, log->otherrank,
-                      log->tag, MPI_COMM_WORLD, &log->req);
+                      log->tag, subtypeMPI_comms[log->subtype], &log->req);
 
       /* Add a new send request. */
       int ind = atomic_inc(&nr_sends);
@@ -62,7 +66,7 @@ static void *inject_thread(void *arg) {
 
     } else {
       err = MPI_Irecv(log->data, log->size, MPI_BYTE, log->rank,
-                      log->tag, MPI_COMM_WORLD, &log->req);
+                      log->tag, subtypeMPI_comms[log->subtype], &log->req);
 
       /* Add a new recv request. */
       int ind = atomic_inc(&nr_recvs);
@@ -223,6 +227,10 @@ int main(int argc, char *argv[]) {
   if (res != MPI_SUCCESS)
     error("Call to MPI_Comm_rank failed with error %i.", res);
 
+  /* Create communicators for each subtype of the tasks. */
+  for (int i = 0; i < task_subtype_count; i++) {
+    MPI_Comm_dup(MPI_COMM_WORLD, &subtypeMPI_comms[i]);
+  }
   message("Starts");
 
   /* Each rank requires its own queue, so extract them. */