root/orte/mca/ras/alps/ras_alps_module.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. parser_ini
  2. parser_separated_columns
  3. orte_ras_get_appinfo_path
  4. orte_ras_alps_allocate
  5. ras_alps_getline
  6. orte_ras_alps_read_appinfo_file
  7. orte_ras_alps_finalize

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2008      UT-Battelle, LLC. All rights reserved.
  14  * Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  * Copyright (c) 2014-2018 Intel, Inc.  All rights reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 
  24 #include "orte_config.h"
  25 #include "orte/constants.h"
  26 
  27 #include "opal/mca/installdirs/installdirs.h"
  28 #include "opal/util/output.h"
  29 #include "orte/util/show_help.h"
  30 #include "orte/mca/errmgr/errmgr.h"
  31 #include "orte/mca/ras/base/ras_private.h"
  32 #include "ras_alps.h"
  33 
  34 #include <unistd.h>
  35 #include <string.h>
  36 #include <ctype.h>
  37 #include <errno.h>
  38 #include <fcntl.h>
  39 #ifdef HAVE_SYS_STAT_H
  40 #include <sys/stat.h>
  41 #endif
  42 
  43 #include <alps/apInfo.h>
  44 
  45 typedef int (*parser_fn_t)(char **val_if_found, FILE *fp,
  46                            const char *var_name);
  47 
  48 typedef struct orte_ras_alps_sysconfig_t {
  49     /* path of file to parse */
  50     char *path;
  51     /* target variable name */
  52     char *var_name;
  53     /* parser to use */
  54     parser_fn_t parse;
  55 } orte_ras_alps_sysconfig_t;
  56 
  57 /* /// Local Functions /// */
  58 static int orte_ras_alps_allocate(orte_job_t *jdata, opal_list_t *nodes);
  59 
  60 static int orte_ras_alps_finalize(void);
  61 
  62 static char *ras_alps_getline(FILE *fp);
  63 
  64 static int orte_ras_alps_read_appinfo_file(opal_list_t *nodes,
  65                                            char *filename,
  66                                            unsigned int *uMe);
  67 
  68 static char *orte_ras_get_appinfo_path(void);
  69 
  70 static int parser_ini(char **val_if_found, FILE *fp, const char *var_name);
  71 
  72 static int parser_separated_columns(char **val_if_found, FILE *fp,
  73                                     const char *var_name);
  74 
  75 /* /// Local Variables /// */
  76 static const orte_ras_alps_sysconfig_t sysconfigs[] = {
  77     {"/etc/sysconfig/alps", "ALPS_SHARED_DIR_PATH", parser_ini},
  78     {"/etc/alps.conf"     , "sharedDir"           , parser_separated_columns},
  79     {"/etc/opt/cray/alps/alps.conf", "sharedDir"  , parser_separated_columns},
  80     /* must be last element */
  81     {NULL                 , NULL                  , NULL}
  82 };
  83 
  84 /* /// Global Variables /// */
  85 orte_ras_base_module_t orte_ras_alps_module = {
  86     NULL,
  87     orte_ras_alps_allocate,
  88     NULL,
  89     orte_ras_alps_finalize
  90 };
  91 
  92 /* Parses: VAR_NAME=val text files - Pseudo INI */
  93 static int
  94 parser_ini(char **val_if_found, FILE *fp, const char *var_name)
  95 {
  96     char *alps_config_str = NULL;
  97 
  98     opal_output_verbose(1, orte_ras_base_framework.framework_output,
  99                         "ras:alps:allocate: parser_ini");
 100 
 101     /* invalid argument */
 102     if (NULL == val_if_found) {
 103         ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
 104         return ORTE_ERR_BAD_PARAM;
 105     }
 106 
 107     *val_if_found = NULL;
 108 
 109     while ((alps_config_str = ras_alps_getline(fp))) {
 110         char *cpq;
 111         char *cpr;
 112 
 113         cpq = strchr(alps_config_str, '#'); /* Parse comments, actually ANY # */
 114         cpr = strchr(alps_config_str, '='); /* Parse for variables            */
 115         if (!cpr ||                         /* Skip if not definition         */
 116             (cpq && cpq < cpr)) {           /* Skip if commented              */
 117             free(alps_config_str);
 118             continue;
 119         }
 120         for (cpr--;                         /* Kill trailing whitespace       */
 121              (*cpr == ' ' || *cpr == '\t'); cpr--);
 122         for (cpq = alps_config_str;         /* Kill leading whitespace        */
 123              (*cpq == ' ' || *cpq == '\t'); cpq++);
 124         /* Filter to needed variable */
 125         if (strncmp(cpq, var_name, strlen(var_name))) {
 126             /* Sorry, not the variable name that we are looking for */
 127             free(alps_config_str);
 128             continue;
 129         }
 130         if (!(cpq = strchr(cpr, '"'))) {    /* Can't find pathname start      */
 131             free(alps_config_str);
 132             ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
 133             return ORTE_ERR_FILE_OPEN_FAILURE;
 134         }
 135         if (!(cpr = strchr(++cpq, '"'))) {  /* Can't find pathname end        */
 136             free(alps_config_str);
 137             ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
 138             return ORTE_ERR_FILE_OPEN_FAILURE;
 139         }
 140         *cpr = '\0';
 141         if (strlen(cpq) + 8 > PATH_MAX) {   /* Bad configuration              */
 142             free(alps_config_str);
 143             ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
 144             return ORTE_ERR_FILE_OPEN_FAILURE;
 145         }
 146         /* Success! */
 147         opal_asprintf(val_if_found, "%s/appinfo", cpq);
 148         if (NULL == val_if_found) {
 149             free(alps_config_str);
 150             ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 151             return ORTE_ERR_OUT_OF_RESOURCE;
 152         }
 153         free(alps_config_str);
 154         return ORTE_SUCCESS;
 155     }
 156     /* We didn't find what we were looking for, but no unrecoverable errors
 157      * occurred in the process.
 158      * */
 159     return ORTE_SUCCESS;
 160 }
 161 
 162 /* Parses: VAR_NAME val text files */
 163 static int
 164 parser_separated_columns(char **val_if_found, FILE *fp, const char *var_name)
 165 {
 166     char *alps_config_str = NULL;
 167     int var_len = strlen(var_name);
 168     int i;
 169 
 170     opal_output_verbose(1, orte_ras_base_framework.framework_output,
 171                         "ras:alps:allocate: parser_separated_columns");
 172 
 173     /* invalid argument */
 174     if (NULL == val_if_found) {
 175         ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
 176         return ORTE_ERR_BAD_PARAM;
 177     }
 178 
 179     *val_if_found = NULL;
 180 
 181     while ((alps_config_str = ras_alps_getline(fp))) {
 182         char *cpq = alps_config_str;
 183         char *cpr;
 184 
 185         /* Eat whitespace */
 186         while (' ' == *cpq || '\t' == *cpq) {
 187             cpq++;
 188         }
 189         /* Ignore comments and variable names that aren't what we are looking
 190          * for */
 191         if ('#' == *cpq || strncmp(cpq, var_name, var_len)) {
 192             free(alps_config_str);
 193             continue;
 194         }
 195         /* Move to end of the variable name */
 196         for (i = 0; i < var_len && '\0' != *cpq; ++i, ++cpq);
 197         /* Eat whitespace until we hit val */
 198         while (' ' == *cpq || '\t' == *cpq) {
 199             cpq++;
 200         }
 201         /* Now advance cpr until end of value */
 202         cpr = cpq;
 203         while ('\0' != *cpr && (' ' != *cpr || '\t' != *cpr)) {
 204             cpr++;
 205         }
 206         *cpr = '\0';
 207         /* Bad configuration sanity check */
 208         if (strlen(cpq) + 8 > PATH_MAX) {
 209             free(alps_config_str);
 210             ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
 211             return ORTE_ERR_FILE_OPEN_FAILURE;
 212         }
 213         /* Success! */
 214         opal_asprintf(val_if_found, "%s/appinfo", cpq);
 215         if (NULL == val_if_found) {
 216             free(alps_config_str);
 217             ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 218             return ORTE_ERR_OUT_OF_RESOURCE;
 219         }
 220         free(alps_config_str);
 221         return ORTE_SUCCESS;
 222     }
 223     /* We didn't find what we were looking for, but no unrecoverable errors
 224      * occurred in the process.
 225      * */
 226     return ORTE_SUCCESS;
 227 }
 228 
 229 /* Gets ALPS scheduler information file pathname from system configuration.  On
 230  * our XK6 testbed, ALPS_SHARED_DIR_PATH isn't set in /etc/sysconfig/alps.  The
 231  * shared directory path is set in /etc/alps.conf and its corresponding variable
 232  * is named sharedDir.  We have to support both because XE6 systems (and
 233  * probably others) still rely on ALPS_SHARED_DIR_PATH and /etc/sysconfig/alps.
 234  */
 235 static char *
 236 orte_ras_get_appinfo_path(void)
 237 {
 238     int i, rc = ORTE_ERROR;
 239     FILE *fp = NULL;
 240     char *appinfo_path = NULL;
 241 
 242     /* iterate over all the available ALPS system configurations name pairs
 243      * until we either fail or find what we are looking for.
 244      */
 245     for (i = 0; NULL != sysconfigs[i].path; ++i) {
 246         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 247                             "ras:alps:allocate: Trying ALPS configuration "
 248                             "file: \"%s\"",
 249                             sysconfigs[i].path);
 250         if (NULL == (fp = fopen(sysconfigs[i].path, "r"))) {
 251             int err = errno;
 252             opal_output_verbose(1, orte_ras_base_framework.framework_output,
 253                                 "ras:alps:allocate: Skipping ALPS "
 254                                 "configuration file: \"%s\" (%s).",
 255                                 sysconfigs[i].path, strerror(err));
 256             continue;
 257         }
 258         /* Let the search begin */
 259         rc = sysconfigs[i].parse(&appinfo_path, fp, sysconfigs[i].var_name);
 260         /* no longer needed */
 261         fclose(fp);
 262 
 263         if (ORTE_SUCCESS == rc) {
 264             /* Success! */
 265             if (NULL != appinfo_path) {
 266                 break;
 267             }
 268             /* else we didn't find what we were looking for - just continue */
 269             else {
 270                 continue;
 271             }
 272         }
 273         /* Failure */
 274         else {
 275             opal_output_verbose(1, orte_ras_base_framework.framework_output,
 276                                  "ras:alps:allocate: failure "
 277                                  "(get_appinfo_dir_path = %d)", rc);
 278             return NULL;
 279         }
 280     }
 281     /* Were we successful? */
 282     if (NULL != sysconfigs[i].path) {
 283         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 284                             "ras:alps:allocate: Located ALPS scheduler file: "
 285                             "\"%s\"", appinfo_path);
 286         return appinfo_path;
 287     }
 288     /* Nope */
 289     else {
 290         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 291                             "ras:alps:allocate: Could not locate ALPS "
 292                             "scheduler file.");
 293         return NULL;
 294     }
 295 
 296     /* Never reached */
 297     return NULL;
 298 }
 299 
 300 /**
 301  * Discover available (pre-allocated) nodes.  Allocate the
 302  * requested number of nodes/process slots to the job.
 303  */
 304 static int
 305 orte_ras_alps_allocate(orte_job_t *jdata, opal_list_t *nodes)
 306 {
 307     int ret;
 308     char *appinfo_path = NULL;
 309 
 310     if (0 == orte_ras_alps_res_id) {
 311         orte_show_help("help-ras-alps.txt", "alps-env-var-not-found", 1);
 312         return ORTE_ERR_NOT_FOUND;
 313     }
 314     if (NULL == (appinfo_path = orte_ras_get_appinfo_path())) {
 315         return ORTE_ERR_NOT_FOUND;
 316     }
 317     /* Parse ALPS scheduler information file (appinfo) for node list. */
 318     if (ORTE_SUCCESS != (ret = orte_ras_alps_read_appinfo_file(
 319                                    nodes,
 320                                    appinfo_path,
 321                                    (unsigned int *)&orte_ras_alps_res_id))) {
 322         ORTE_ERROR_LOG(ret);
 323         goto cleanup;
 324     }
 325 
 326     /* Record the number of allocated nodes */
 327     orte_num_allocated_nodes = opal_list_get_size(nodes);
 328 
 329 cleanup:
 330     /* All done */
 331     if (NULL != appinfo_path) {
 332         free(appinfo_path);
 333     }
 334     if (ORTE_SUCCESS == ret) {
 335         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 336                             "ras:alps:allocate: success");
 337     }
 338     else {
 339         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 340                             "ras:alps:allocate: failure "
 341                             "(base_allocate_nodes = %d)", ret);
 342     }
 343     return ret;
 344 }
 345 
 346 #define RAS_BASE_FILE_MAX_LINE_LENGTH (PATH_MAX * 2)
 347 
 348 static char *
 349 ras_alps_getline(FILE *fp)
 350 {
 351     char *ret = NULL, *input = NULL;
 352 
 353     input = (char *)calloc(RAS_BASE_FILE_MAX_LINE_LENGTH + 1, sizeof(char));
 354     /* out of resources */
 355     if (NULL == input) {
 356         ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 357         return NULL;
 358     }
 359     ret = fgets(input, RAS_BASE_FILE_MAX_LINE_LENGTH, fp);
 360     if (NULL != ret) {
 361         input[strlen(input) - 1] = '\0';  /* remove newline */
 362         return input;
 363     }
 364 
 365     return NULL;
 366 }
 367 
 368 #if ALPS_APPINFO_VERSION > 0 && ALPS_APPINFO_VERSION < 3
 369     typedef placeNodeList_t orte_ras_alps_placeNodeList_t;
 370 #else
 371     typedef placeNodeList_ver3_t orte_ras_alps_placeNodeList_t;
 372 #endif
 373 
 374 static int
 375 orte_ras_alps_read_appinfo_file(opal_list_t *nodes, char *filename,
 376                                 unsigned int *uMe)
 377 {
 378     int             iq;
 379     int             ix;
 380     int             iFd;                    /* file descriptor for appinfo    */
 381     int             iTrips;                 /* counter appinfo read attempts  */
 382     int             max_appinfo_read_attempts;
 383     struct stat     ssBuf;                  /* stat buffer                    */
 384     size_t          szLen;                  /* size of appinfo (file)         */
 385     off_t           oNow;                   /* current appinfo data offset    */
 386     off_t           oInfo=sizeof(appInfoHdr_t);
 387     off_t           oDet=sizeof(appInfo_t);
 388     off_t           oSlots;
 389     off_t           oEntry;
 390     int32_t         sNodes=0;
 391     char            *cpBuf;
 392     char            *hostname;
 393     orte_node_t     *node = NULL;
 394     appInfoHdr_t    *apHdr;                 /* ALPS header structure          */
 395     appInfo_t       *apInfo;                /* ALPS table info structure      */
 396 #if ALPS_APPINFO_VERSION==0
 397     placeList_t     *apSlots;               /* ALPS node specific info        */
 398 #else
 399     orte_ras_alps_placeNodeList_t *apNodes;
 400 #endif
 401 
 402     orte_ras_alps_get_appinfo_attempts(&max_appinfo_read_attempts);
 403     oNow=0;
 404     iTrips=0;
 405     opal_output_verbose(1, orte_ras_base_framework.framework_output,
 406                         "ras:alps:allocate: begin processing appinfo file");
 407 
 408     while(!oNow) {                          /* Until appinfo read is complete */
 409         iTrips++;                           /* Increment trip count           */
 410 
 411         iFd=open( filename, O_RDONLY );
 412         if( iFd==-1 ) {                     /* If file absent, ALPS is down   */
 413             opal_output_verbose(1, orte_ras_base_framework.framework_output,
 414                                 "ras:alps:allocate: ALPS information open failure");
 415             usleep(iTrips*50000);           /* Increasing delays, .05 s/try   */
 416 
 417             /*          Fail only when number of attempts have been exhausted.            */
 418             if( iTrips <= max_appinfo_read_attempts ) continue;
 419             ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE);
 420             return ORTE_ERR_FILE_OPEN_FAILURE;
 421         }
 422         if( fstat( iFd, &ssBuf )==-1 ) {    /* If stat fails, access denied   */
 423 
 424             ORTE_ERROR_LOG(ORTE_ERR_NOT_AVAILABLE);
 425             return ORTE_ERR_NOT_AVAILABLE;
 426         }
 427 
 428         szLen=ssBuf.st_size;                /* Get buffer size                */
 429         cpBuf=malloc(szLen+1);              /* Allocate buffer                */
 430         if (NULL == cpBuf) {
 431             ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 432             return ORTE_ERR_OUT_OF_RESOURCE;
 433         }
 434 
 435         /*      Repeated attempts to read appinfo, with an increasing delay between   *
 436          *      successive attempts to allow scheduler I/O a chance to complete.      */
 437         if( (oNow=read( iFd, cpBuf, szLen ))!=(off_t)szLen ) {
 438 
 439             /*          This is where apstat fails; we will record it and try again.      */
 440             opal_output_verbose(1, orte_ras_base_framework.framework_output,
 441                                 "ras:alps:allocate: ALPS information read failure: %ld bytes", (long int)oNow);
 442 
 443             free(cpBuf);                    /* Free (old) buffer              */
 444             close(iFd);                     /* Close (old) descriptor         */
 445             oNow=0;                         /* Reset byte count               */
 446             usleep(iTrips*50000);           /* Increasing delays, .05 s/try   */
 447 
 448             /*          Fail only when number of attempts have been exhausted.            */
 449             if( iTrips<=max_appinfo_read_attempts ) continue;
 450             ORTE_ERROR_LOG(ORTE_ERR_FILE_READ_FAILURE);
 451             return ORTE_ERR_FILE_READ_FAILURE;
 452         }
 453     }
 454     close(iFd);
 455     opal_output_verbose(1, orte_ras_base_framework.framework_output,
 456                         "ras:alps:allocate: file %s read", filename);
 457 
 458     /*  Now that we have the scheduler information, we just have to parse it for  *
 459      *  the data that we seek.                                                    */
 460     oNow=0;
 461     apHdr=(appInfoHdr_t *)cpBuf;
 462 
 463     opal_output_verbose(1, orte_ras_base_framework.framework_output,
 464                         "ras:alps:allocate: %d entries in file", apHdr->apNum);
 465 
 466     /*  Header info (apHdr) tells us how many entries are in the file:            *
 467      *                                                                            *
 468      *      apHdr->apNum                                                          */
 469 
 470     for( iq=0; iq<apHdr->apNum; iq++ ) {    /*  Parse all entries in file     */
 471 
 472         /*      Just at this level, a lot of information is available:                *
 473          *                                                                            *
 474          *          apInfo->apid         ... ALPS job ID                              *
 475          *          apInfo->resId        ... ALPS reservation ID                      *
 476          *          apInfo->numCmds      ... Number of executables                    *
 477          *          apInfo->numPlaces    ... Number of PEs                            */
 478         apInfo=(appInfo_t *)(cpBuf+oNow+oInfo);
 479 
 480         /*      Calculate the dependent offsets.                                      */
 481         oSlots=sizeof(cmdDetail_t)*apInfo->numCmds;
 482 
 483         opal_output_verbose(1, orte_ras_base_framework.framework_output,
 484                             "ras:alps:allocate: read data for resId %u - myId %u",
 485                             apInfo->resId, *uMe);
 486 
 487 
 488 #if ALPS_APPINFO_VERSION==0
 489 
 490         /*      Finally, we get to the actual node-specific information:              *
 491          *                                                                            *
 492          *          apSlots[ix].cmdIx    ... index of apDet[].cmd                     *
 493          *          apSlots[ix].nid      ... NodeID (NID)                             *
 494          *          apSlots[ix].procMask ... mask for processors... need 16-bit shift */
 495         apSlots=(placeList_t *)(cpBuf+oNow+oInfo+oDet+oSlots);
 496         oEntry=sizeof(placeList_t)*apInfo->numPlaces;
 497 
 498         oNow+=(oDet+oSlots+oEntry);         /* Target next slot               */
 499 
 500         if( apInfo->resId != *uMe ) continue; /* Filter to our reservation Id */
 501 
 502         /* in this early version of alps, there is one entry for each PE in the
 503          * allocation - so cycle across the numPlaces entries, assigning a slot
 504          * for each time a node is named
 505          */
 506         for( ix=0; ix<apInfo->numPlaces; ix++ ) {
 507 
 508             opal_output_verbose(5, orte_ras_base_framework.framework_output,
 509                                 "ras:alps:read_appinfo: got NID %d", apSlots[ix].nid);
 510 
 511             opal_asprintf( &hostname, "%d", apSlots[ix].nid );
 512             if (NULL == hostname) {
 513                 ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 514                 return ORTE_ERR_OUT_OF_RESOURCE;
 515             }
 516 
 517             /*          If this matches the prior nodename, just add to the slot count.   */
 518             if( NULL!=node && !strcmp(node->name, hostname) ) {
 519 
 520                 free(hostname);             /* free hostname since not needed */
 521                 ++node->slots;
 522             } else {                        /* must be new, so add to list    */
 523 
 524                 opal_output_verbose(1, orte_ras_base_framework.framework_output,
 525                                     "ras:alps:read_appinfo: added NID %d to list", apSlots[ix].nid);
 526 
 527                 node = OBJ_NEW(orte_node_t);
 528                 node->name = hostname;
 529                 orte_set_attribute(&node->attributes, ORTE_NODE_LAUNCH_ID, ORTE_ATTR_LOCAL, &apSlots[ix].nid, OPAL_INT32);
 530                 node->slots_inuse = 0;
 531                 node->slots_max = 0;
 532                 node->slots = 1;
 533                 node->state = ORTE_NODE_STATE_UP;
 534                 /* need to order these node ids so the regex generator
 535                  * can properly function
 536                  */
 537                 /* add it to the end */
 538                 opal_list_append(nodes, &node->super);
 539                 sNodes++;                   /* Increment the node count       */
 540             }
 541         }
 542 #else
 543         /* in newer versions of alps, there is one entry for each node in the
 544          * allocation, and that struct directly carries the number of PEs
 545          * allocated on that node to this job.
 546          */
 547         apNodes=(orte_ras_alps_placeNodeList_t *)(cpBuf+oNow+oInfo+oDet+oSlots);
 548         oEntry=sizeof(orte_ras_alps_placeNodeList_t)*apInfo->numPlaces;
 549 
 550         oNow+=(oDet+oSlots+oEntry);         /* Target next entry               */
 551 
 552         if( apInfo->resId != *uMe ) continue; /* Filter to our reservation Id */
 553 
 554         for( ix=0; ix<apInfo->numPlaces; ix++ ) {
 555             opal_output_verbose(5, orte_ras_base_framework.framework_output,
 556                                 "ras:alps:read_appinfo(modern): processing NID %d with %d slots",
 557                                 apNodes[ix].nid, apNodes[ix].numPEs);
 558             opal_asprintf( &hostname, "%d", apNodes[ix].nid );
 559             if (NULL == hostname) {
 560                 ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
 561                 return ORTE_ERR_OUT_OF_RESOURCE;
 562             }
 563 
 564             node = OBJ_NEW(orte_node_t);
 565             node->name = hostname;
 566             orte_set_attribute(&node->attributes, ORTE_NODE_LAUNCH_ID, ORTE_ATTR_LOCAL, &apNodes[ix].nid, OPAL_INT32);
 567             node->slots_inuse = 0;
 568             node->slots_max = 0;
 569             if (opal_hwloc_use_hwthreads_as_cpus) {
 570                 node->slots = apNodes[ix].cpuCnt;
 571             } else {
 572                 node->slots = apNodes[ix].numPEs;
 573             }
 574             node->state = ORTE_NODE_STATE_UP;
 575             /* need to order these node ids so the regex generator
 576              * can properly function
 577              */
 578             /* add it to the end */
 579             opal_list_append(nodes, &node->super);
 580             sNodes++;                   /* Increment the node count       */
 581         }
 582 #endif
 583         break;                              /* Extended details ignored       */
 584     }
 585 
 586     free(cpBuf);                            /* Free the buffer                */
 587 
 588     return ORTE_SUCCESS;
 589 }
 590 
 591 /* There's really nothing to do here */
 592 static int
 593 orte_ras_alps_finalize(void)
 594 {
 595     opal_output_verbose(1, orte_ras_base_framework.framework_output,
 596                          "ras:alps:finalize: success (nothing to do)");
 597     return ORTE_SUCCESS;
 598 }

/* [<][>][^][v][top][bottom][index][help] */