#include <mpc.h>
#include <sys/utsname.h>

nettype Mesh(int m, int n) {
  coord I=m, J=n;
  parent [0,0];
};

#define M 2
#define N 3

int [*]main() {
  net Mesh(M,N) [host]mynet;

  [mynet]: {
    struct utsname un;
    uname(&un);
    if ( I coordof un == 0 )
      MPC_Printf("I'm on \"%s\" and have coordinates (%d, %d).\n",
                 un.nodename, 0, J coordof un);

    ([(M*N)mynet])MPC_Barrier();

    if ( I coordof un != 0 )
      MPC_Printf("I'm on \"%s\" and have coordinates (%d, %d).\n",
                 un.nodename, I coordof un, J coordof un);
  }
}