EPIK_TOPOL * EPIK_Pform_hw_topol() {
  EPIK_TOPOL * myt;

  Kernel_GetPersonality(&mybgp, sizeof(_BGP_Personality_t));

  myt=EPIK_Cart_create("Blue Gene/P Hardware Topology",4);

  EPIK_Cart_add_dim(myt, (elg_ui4)BGP_Personality_xSize(&mybgp),
                         BGP_Personality_isTorusX(&mybgp),"X");
  EPIK_Cart_add_dim(myt, (elg_ui4)BGP_Personality_ySize(&mybgp),
                         BGP_Personality_isTorusY(&mybgp),"Y");
  EPIK_Cart_add_dim(myt, (elg_ui4)BGP_Personality_zSize(&mybgp),
                         BGP_Personality_isTorusZ(&mybgp),"Z");
  EPIK_Cart_add_dim(myt, 4, ELG_FALSE, "Core");   /* BlueGene/P quad-core */

  return myt;
}
Exemple #2
0
void z_mpi_get_cart_topology(int *ndims, int *dims, int *torus, int *pos) /* z_proto, z_func z_mpi_get_cart_topology */
{
  int _ndims, _dims[MAX_CART_NDIMS], _torus[MAX_CART_NDIMS], _pos[MAX_CART_NDIMS];

#if defined(HAVE__BGP_PERSONALITY_T)

  /* BlueGene/P */

  _BGP_Personality_t personality;


  _ndims = 4;

  if (dims == NULL || torus == NULL || pos == NULL) goto exit_ndims_only;

  Kernel_GetPersonality(&personality, sizeof(personality));

  _dims[0] = personality.Network_Config.Xnodes;
  _dims[1] = personality.Network_Config.Ynodes;
  _dims[2] = personality.Network_Config.Znodes;

  _torus[0] = BGP_Personality_isTorusX(&personality);
  _torus[1] = BGP_Personality_isTorusY(&personality);
  _torus[2] = BGP_Personality_isTorusZ(&personality);

  _pos[0] = personality.Network_Config.Xcoord;
  _pos[1] = personality.Network_Config.Ycoord;
  _pos[2] = personality.Network_Config.Zcoord;

  switch (personality.Kernel_Config.ProcessConfig)
  {
    case _BGP_PERS_PROCESSCONFIG_SMP:
      _dims[3] = 1;
      break;
    case _BGP_PERS_PROCESSCONFIG_VNM:
      _dims[3] = 4;
      break;
    case _BGP_PERS_PROCESSCONFIG_2x2:
      _dims[3] = 2;
      break;
    default:
      _dims[3] = 1;
      break;
  }

  _torus[3] = (_torus[0] || _torus[1] || _torus[2]);

  _pos[3] = Kernel_PhysicalProcessorID();

#elif defined(HAVE_MPIX_HARDWARE_T)

  /* BlueGene/Q */

  int i;
  MPIX_Hardware_t hw;


  _ndims = MPIX_TORUS_MAX_DIMS + 1;

  if (dims == NULL || torus == NULL || pos == NULL) goto exit_ndims_only;

  MPIX_Hardware(&hw);

  _torus[MPIX_TORUS_MAX_DIMS] = 0;

  for (i = 0; i < MPIX_TORUS_MAX_DIMS; ++i)
  {
    _dims[i] = hw.Size[i];
    _torus[i] = hw.isTorus[i]?1:0;
    _pos[0] = hw.Coords[i];

    if (_torus[i]) _torus[MPIX_TORUS_MAX_DIMS] = 1;
  }

  _dims[MPIX_TORUS_MAX_DIMS] = hw.ppn;

  _pos[MPIX_TORUS_MAX_DIMS] = hw.coreID;

#else

  /* MPI */

  MPI_Comm comm;
  int size, rank;


  _ndims = 3;

  if (dims == NULL || torus == NULL || pos == NULL) goto exit_ndims_only;

  comm = MPI_COMM_WORLD;
  MPI_Comm_size(comm, &size);
  MPI_Comm_rank(comm, &rank);

  _dims[0] = 0;
  _dims[1] = 0;
  _dims[2] = 0;

  MPI_Dims_create(size, 3, _dims);

  _pos[2] = (rank / (1))                       % _dims[2];
  _pos[1] = (rank / (1 * _dims[2]))            % _dims[1];
  _pos[0] = (rank / (1 * _dims[2] * _dims[1])) % _dims[0];

  _torus[0] = 0;
  _torus[1] = 0;
  _torus[2] = 0;
#endif

  if (*ndims <= 0) *ndims = _ndims;

  z_mpi_remap_cart_topology(_ndims, _dims, _torus, _pos, *ndims, dims, torus, pos);

exit_ndims_only:

  *ndims = _ndims;
}