Ejemplo n.º 1
0
/* unique numeric SMP-node identifier */
long vt_pform_node_id() {
#ifdef BGP_GROUP_ON_NODEBOARD
  _BGP_UniversalComponentIdentifier uci;
  uci.UCI = mybgp.Kernel_Config.UniversalComponentIdentifier;
  /* use upper part of UCI (upto NodeCard, ignore lower 14bits)
   * but only use the 13 bits (1FFF) that describe row,col,mp,nc */
  return ((uci.UCI>>14)&0x1FFF);
#else
  return ( BGP_Personality_psetNum(&mybgp) *
           BGP_Personality_psetSize(&mybgp) +
           BGP_Personality_rankInPset(&mybgp)) * Kernel_ProcessCount()
           + Kernel_PhysicalProcessorID();
#endif
}
Ejemplo n.º 2
0
/* unique string SMP-node identifier */
char* vt_pform_node_name() {
#ifdef BGP_GROUP_ON_NODEBOARD
  static char buf[BGPPERSONALITY_MAX_LOCATION];
  bgp_getNodeidString(&mybgp, buf);
  return buf;
#else
  static char node[128];
  unsigned x = BGP_Personality_xCoord(&mybgp);
  unsigned y = BGP_Personality_yCoord(&mybgp);
  unsigned z = BGP_Personality_zCoord(&mybgp);

  sprintf(node, "node-%03d-%03d-%03d-%d", x, y, z, Kernel_PhysicalProcessorID());
  return node;
#endif
}
Ejemplo n.º 3
0
int get_my_core()
{
  return Kernel_PhysicalProcessorID();
}
Ejemplo n.º 4
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;
}