// -----------------------------------------------------------------
void setup_layout() {
  int k = mynode();

  if (k == 0)
    printf("LAYOUT = Hypercubes, options = ");

  setup_hyper_prime();

  // Compute machine coordinates
  machine_coordinates[XUP] = k % squaresize[XUP];
  k /= squaresize[XUP];
  machine_coordinates[YUP] = k % squaresize[YUP];
  k /= squaresize[YUP];
  machine_coordinates[ZUP] = k % squaresize[ZUP];
  k /= squaresize[ZUP];
  machine_coordinates[TUP] = k % squaresize[TUP];

  // Number of sites on node
  sites_on_node = squaresize[XUP] * squaresize[YUP]
                * squaresize[ZUP] * squaresize[TUP];
  /* Need even number of sites per hypercube */
  if (mynode() == 0) {
    if (sites_on_node % 2 != 0) {
      printf("SORRY, CAN'T LAY OUT THIS LATTICE\n");
      terminate(0);
    }
  }
  node0_printf("ON EACH NODE %d x %d x %d x %d\n",
               squaresize[XUP], squaresize[YUP],
               squaresize[ZUP], squaresize[TUP]);
  if (mynode() == 0 && sites_on_node % 2 != 0)
    printf("WATCH OUT FOR EVEN/ODD SITES ON NODE BUG!!!\n");
  even_sites_on_node = sites_on_node / 2;
  odd_sites_on_node = sites_on_node / 2;
}
Exemple #2
0
void setup_layout(){
  int k = mynode();
#ifdef FIX_NODE_GEOM
  int *geom = node_geometry;
#else
  int *geom = NULL;
#endif

  if(k == 0)
    printf("LAYOUT = Hypercubes, options = ");

#ifdef HAVE_QMP
  /* QMP treatment */
  /* Is there already a grid? 
     This could be a grid architecture with a preset dimension, or
     a geometry could have been set by the -qmp-geom command line arg. 
     In either case we have a nonzero allocated number of dimensions. 
*/
  if(QMP_get_allocated_number_of_dimensions() == 0)
    /* Set the geometry if requested */
    set_qmp_layout_grid(geom, 4);

  /* Has a grid been set up now? */
  if(QMP_get_msg_passing_type() == QMP_GRID)
    setup_qmp_grid();
  else if(geom != NULL)
    setup_fixed_geom(geom, 4);
  else
    setup_hyper_prime();

#else

  /* Non QMP treatment */
  if(geom != NULL)
    setup_fixed_geom(geom, 4);
  else
    setup_hyper_prime();

#endif

#ifdef FIX_IONODE_GEOM
  /* Initialize I/O node function */
  init_io_node();
#endif
  
  /* Compute machine coordinates for this node */
  lex_coords(machine_coordinates, 4, nsquares, k);

  /* Number of sites on node */
  sites_on_node =
    squaresize[XUP]*squaresize[YUP]*squaresize[ZUP]*squaresize[TUP];

  /* Need number of sites per hypercube divisible by 32 */
  if( mynode()==0)if( sites_on_node%32 != 0){
    printf("SORRY, CAN'T LAY OUT THIS LATTICE\n");
    terminate(0);
  }
  subl_sites_on_node = sites_on_node/32;
  if( mynode()==0)
    printf("ON EACH NODE %d x %d x %d x %d\n",squaresize[XUP],squaresize[YUP],
	   squaresize[ZUP],squaresize[TUP]);

  /* Actually we have already required sites_on_node to be a multiple of 32 */
  if( mynode()==0 && sites_on_node%2 != 0)
    printf("WATCH OUT FOR EVEN/ODD SITES ON NODE BUG!!!\n");
  even_sites_on_node = odd_sites_on_node = sites_on_node/2;
}