Пример #1
0
void
setup_layout(void)
{
  int c[4];
  int i,n_mach;
  int d[4];

#ifdef FIX_NODE_GEOM
  int *geom = node_geometry;
#else
  int *geom = NULL;
#endif

  if(mynode()==0){
    printf("LAYOUT = Hypercubes, options = ");
    printf("QDP");
    printf("\n");
  }

  /* 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);

  c[0] = nx;
  c[1] = ny;
  c[2] = nz;
  c[3] = nt;
  QDP_set_latsize(4, c);
  QDP_create_layout();
  sites_on_node = QDP_sites_on_node;
  even_sites_on_node = QDP_subset_len(QDP_even);
  odd_sites_on_node = QDP_subset_len(QDP_odd);
  n_mach = QMP_get_logical_number_of_dimensions();
  dim_mach = QMP_get_logical_dimensions();

  /* Initialize I/O node function */
#ifdef FIX_IONODE_GEOM
  init_io_node();
#endif
  
  /* Report sublattice dimensions */
  for(i = 0; i < 4; i++){
    /* Any extra machine dimensions are assumed to be 1 */
    if(i < n_mach)d[i] = c[i]/dim_mach[i];
    else d[i] = c[i];
  }
  if( mynode()==0)
    printf("ON EACH NODE %d x %d x %d x %d\n",d[0],d[1],d[2],d[3]);

#if 0
  mpi_whoami();  /* Debug */
#endif
}
Пример #2
0
/*--------------------------------------------------------------------*/
static void setup_qmp_grid(){
  int ndim = 4;
  int len[4];
  int ndim2, i;
  const int *nsquares2;

  len[0] = nx; len[1] = ny; len[2] = nz; len[3] = nt;

  if(mynode()==0){
    printf("qmp_grid,");
    printf("\n");
  }

  ndim2 = QMP_get_allocated_number_of_dimensions();
  nsquares2 = QMP_get_allocated_dimensions();

  /* If the dimensions are not already allocated, use the
     node_geometry request.  Otherwise a hardware or command line
     specification trumps the parameter input. */
#ifdef FIX_NODE_GEOM
  if(ndim2 == 0){
    ndim2 = 4;
    nsquares2 = node_geometry;
  }
  else{
    node0_printf("setup_qmp_grid: Preallocated machine geometry overrides request\n");
  }
#endif

  if(mynode()==0){
    printf("Using machine geometry: ");
    for(i=0; i<ndim; i++){
      printf("%d ",nsquares2[i]);
      if(i < ndim-1)printf("X ");
    }
    printf("\n");
  }

  /* In principle, we could now rotate coordinate axes */
  /* Save this for a future upgrade */

  set_qmp_layout_grid(nsquares2, ndim2);

  ndim2 = QMP_get_logical_number_of_dimensions();
  nsquares2 = QMP_get_logical_dimensions();

  for(i=0; i<ndim; i++) {
    if(i<ndim2) nsquares[i] = nsquares2[i];
    else nsquares[i] = 1;
  }

  for(i=0; i<ndim; i++) {
    if(len[i]%nsquares[i] != 0) {
      node0_printf("LATTICE SIZE DOESN'T FIT GRID\n");
      QMP_abort(0);
    }
    squaresize[i] = len[i]/nsquares[i];
  }
}
Пример #3
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;
}