{"action":"created","comment":{"url":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments/174784205","pull_request_review_id":104203523,"id":174784205,"diff_hunk":"@@ -6397,129 +6665,927 @@ alps_inventory(void)\n }\n \n /**\n- * Define the array that is used to register the expat element handlers.\n- * See parse_element_start, parse_element_end, and parse_char_data for\n- * further information.\n- * The definition of element_handler_t above explains the different\n- * structure elements.\n+ *\n+ * @brief System Query handling (for KNL Nodes).\n+ * \t  Invoked from dep_topology() in mom_mach.c before alps_inventory()\n+ * \t  (which handles processing for non-KNL Cray Compute Nodes) is called.\n+ *\t  Checks if BASIL 1.7 is supported, then makes a System Query request and\n+ *\t  populates System Query related structures.\n+ *\n+ * @return void\n+ *\n  */\n-static element_handler_t handler[] =\n+void\n+alps_system_KNL(void)\n {\n-\t{\n-\t\t\"UNDEFINED\",\n-\t\tNULL,\n-\t\tNULL,\n-\t\tNULL\n-\t},\n-\t{\n-\t\tBASIL_ELM_MESSAGE,\n-\t\tmessage_start,\n-\t\tmessage_end,\n-\t\tmessage_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_RESPONSE,\n-\t\tresponse_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_RESPONSEDATA,\n-\t\tresponse_data_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_RESERVED,\n-\t\treserved_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_CONFIRMED,\n-\t\tconfirmed_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_RELEASED,\n-\t\treleased_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_INVENTORY,\n-\t\tinventory_start,\n-\t\tinventory_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_ENGINE,\n-\t\tengine_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_NODEARRAY,\n-\t\tnode_array_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_NODE,\n-\t\tnode_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_SOCKETARRAY,\n-\t\tsocket_array_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_SOCKET,\n-\t\tsocket_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_SEGMENTARRAY,\n-\t\tsegment_array_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_SEGMENT,\n-\t\tsegment_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_CUARRAY,\n-\t\tcomputeunit_array_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_COMPUTEUNIT,\n-\t\tcomputeunit_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_PROCESSORARRAY,\n-\t\tprocessor_array_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n-\t\tBASIL_ELM_PROCESSOR,\n-\t\tprocessor_start,\n-\t\tdefault_element_end,\n-\t\tdisallow_char_data\n-\t},\n-\t{\n+\t/*\n+\t * Determine if ALPS supports the BASIL 1.7 protocol. We are only\n+\t * partially supporting the BASIL 1.7 protocol (for the System Query).\n+\t */\n+\talps_engine_query_KNL();\n+\n+\tif (basil_1_7_supported)\n+\t\tlog_event(PBSEVENT_DEBUG4, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__,\n+\t\t\t\"This Cray system supports the BASIL 1.7 protocol.\");\n+\telse {\n+\t\tlog_event(PBSEVENT_DEBUG4, PBS_EVENTCLASS_NODE, LOG_ERR, __func__,\n+\t\t\t\"This Cray system does not support the BASIL 1.7 protocol.\");\n+\t\treturn;\n+\t}\n+\n+\t/*\n+\t * Allocate a buffer (requestBuffer_knl) for a new ALPS request (System Query).\n+\t * A nonzero return value indicates failure; return at this point without proceeding\n+\t * with System Query processing.\n+\t */\n+\tif (init_KNL_alps_req_buf() != 0)\n+\t\treturn;\n+\n+\t/* Create a System (BASIL 1.7) Query request to fetch KNL information. */\n+\tsnprintf(requestBuffer_knl, UTIL_BUFFER_LEN, \"<?xml version=\\\"1.0\\\"?>\\n\"\n+\t\t\"<\" BASIL_ELM_REQUEST \" \"\n+\t\tBASIL_ATR_PROTOCOL \"=\\\"%s\\\" \"\n+\t\tBASIL_ATR_METHOD \"=\\\"\" BASIL_VAL_QUERY \"\\\" \"\n+\t\tBASIL_ATR_TYPE \"=\\\"\" BASIL_VAL_SYSTEM \"\\\"/>\", basilversion_system);\n+\n+\t/*\n+\t * The 'basil_ver' argument is checked in response_start() (a callback\n+\t * function invoked during alps_request() processing). Flow of control can\n+\t * arrive at response_start() from either alps_system_KNL() or alps_inventory().\n+\t * This argument helps make the distinction.\n+\t */\n+\tif ((brp_knl = alps_request(requestBuffer_knl, basilversion_system)) == NULL) {\n+\n+\t\t/* Failure to get KNL Node information from ALPS. */\n+\t\tlog_event(PBSEVENT_SYSTEM, PBS_EVENTCLASS_NODE, LOG_NOTICE, __func__,\n+\t\t\t  \"ALPS System Query request failed.\");\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n+ * @brief Issue an ENGINE query to determine if BASIL 1.7 is supported.\n+ * \t  We are partially supporting the BASIL 1.7 protocol (for the System Query).\n+ *\t  If the BASIL 1.7 protocol is found in the query response, set a flag\n+ *\t  that will be checked in alps_system_KNL().\n+ *\n+ * @return void\n+ */\n+static void\n+alps_engine_query_KNL(void)\n+{\n+\tbasil_response_t *brp_eng;\n+\n+\t/*\n+\t * Allocate a buffer (requestBuffer_knl) for a new ALPS request (Engine Query).\n+\t * A nonzero return value indicates failure.\n+\t */\n+\tif (init_KNL_alps_req_buf() != 0)\n+\t\treturn;\n+\n+\t/* This is set to \"1.1\", since PBS may be running on a system that may or */\n+\t/* may not support BASIL 1.7. BASIL 1.1 is the lowest version that supports */\n+\t/* the ENGINE Query. */\n+\n+\tsprintf(requestBuffer_knl, \"<?xml version=\\\"1.0\\\"?>\\n\"\n+\t\t\"<\" BASIL_ELM_REQUEST \" \"\n+\t\tBASIL_ATR_PROTOCOL \"=\\\"%s\\\" \"\n+\t\tBASIL_ATR_METHOD \"=\\\"\" BASIL_VAL_QUERY \"\\\" \"\n+\t\tBASIL_ATR_TYPE \"=\\\"\" BASIL_VAL_ENGINE \"\\\"/>\",\n+\t\tBASIL_VAL_VERSION_1_1);\n+\tif ((brp_eng = alps_request(requestBuffer_knl, BASIL_VAL_VERSION_1_1)) != NULL) {\n+\t\t/* Proceed if no errors in the response data. */\n+\t\tif (*brp_eng->error == '\\0') {\n+\t\t\t/* Ensure we have the correct response. */\n+\t\t\tif (brp_eng->method == basil_method_query) {\n+\t\t\t\t/* Check if 'basil_support' is set before trying to strdup. */\n+\t\t\t\tif (brp_eng->data.query.data.engine.basil_support != NULL) {\n+\n+\t\t\t\t\tif (strstr(brp_eng->data.query.data.engine.basil_support,\n+\t\t\t\t\t\t   BASIL_VAL_VERSION_1_7) != NULL) {\n+\t\t\t\t\t\tbasil_1_7_supported = 1;\n+\t\t\t\t\t\tsnprintf(basilversion_system, sizeof(basilversion_system),\n+\t\t\t\t\t\t\t BASIL_VAL_VERSION_1_7);\n+\t\t\t\t\t} else\n+\t\t\t\t\t\tbasil_1_7_supported = 0;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\t/* Wrong method in the response. */\n+\t\t\t\tsprintf(log_buffer, \"Wrong method, expected: %d but \"\n+\t\t\t\t\t\"got: %d\", basil_method_query, brp_eng->method);\n+\t\t\t\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE,\n+\t\t\t\t\tLOG_DEBUG, __func__, log_buffer);\n+\t\t\t}\n+\t\t} else {\n+\t\t\t/* There was an error in the BASIL response. */\n+\t\t\tsprintf(log_buffer, \"Error in BASIL response: %s\", brp_eng->error);\n+\t\t\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, LOG_DEBUG,\n+\t\t\t\t__func__, log_buffer);\n+\t\t}\n+\t}\n+\n+\tfree_basil_response_data(brp_eng);\n+}\n+\n+/**\n+ * @brief Process the System (BASIL 1.7) Query Response. This includes creation\n+ *\t  of KNL vnodes.\n+ *\n+ * @return void\n+ */\n+void\n+system_to_vnodes_KNL(void)\n+{\n+\tbasil_response_query_system_t *sys_knl;\n+\n+\tif (!basil_1_7_supported)\n+\t\treturn;\n+\n+\t/* System 1.7 Query failed to get KNL Node information from ALPS. */\n+\tif (!brp_knl)\n+\t\treturn;\n+\n+\tif (brp_knl->method != basil_method_query) {\n+\t\tsnprintf(log_buffer, sizeof(log_buffer), \"Wrong method: %d\",\n+\t\t\tbrp_knl->method);\n+\t\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__,\n+\t\t\tlog_buffer);\n+\t\treturn;\n+\t}\n+\n+\tif (brp_knl->data.query.type != basil_query_system) {\n+\t\tsnprintf(log_buffer, sizeof(log_buffer), \"Wrong query type: %d\",\n+\t\t\tbrp_knl->data.query.type);\n+\t\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__,\n+\t\t\tlog_buffer);\n+\t\treturn;\n+\t}\n+\n+\tif (*brp_knl->error != '\\0') {\n+\t\tsnprintf(log_buffer, sizeof(log_buffer), \"Error in BASIL response: %s\",\n+\t\t\tbrp_knl->error);\n+\t\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__,\n+\t\t\tlog_buffer);\n+\t\treturn;\n+\t}\n+\n+\tsys_knl = &brp_knl->data.query.data.system;\n+\n+\tcreate_vnodes_KNL(sys_knl);\n+\n+\tfree_basil_response_data(brp_knl);\n+}\n+\n+/**\n+ *\n+ * @brief Create KNL vnodes.\n+ * \t  'vnlp' is a global pointer that gets freed in process_hup() (mom_main.c)\n+ * \t  during a MoM restart. The vnode state gets cleared and we repeat the vnode\n+ *\t  creation cycle i.e. creation of non-KNL vnodes (in inventory_to_vnodes())\n+ *\t  followed by KNL vnodes in this function.\n+ *\n+ * @param[in] sys_knl ALPS BASIL System Query response.\n+ *\n+ * @return void\n+ */\n+static void\n+create_vnodes_KNL(basil_response_query_system_t *sys_knl)\n+{\n+\tchar\t*attr, *arch;\n+\tchar\tvname[VNODE_NAME_LEN];\n+\tchar\tutilBuffer_knl[(UTIL_BUFFER_LEN * sizeof(char))];\n+\tint\tncpus_per_knl;\n+\tint\tnode_idx = 0;\n+\tint\tnode_count =0;\n+\tlong\tnode_id = 0;\n+\tlong\t*nid_arr = NULL;\n+\tint\tatype = READ_WRITE | ATR_DFLAG_CVTSLT;\n+\tchar\tmpphost_knl[BASIL_STRING_LONG];\n+\n+\n+\tbasil_system_element_t *node_group;\n+\n+\n+\tif (sys_knl == NULL)\n+\t\treturn;\n+\n+\tsnprintf(mpphost_knl, sizeof(mpphost_knl), \"%s\", sys_knl->mpp_host);\n+\n+\n+\t/*\n+\t * Iterate through all the Node groups in the System Query Response. Each\n+\t * Node group may contain information about multiple (a 'range list') of KNL Nodes.\n+\t * Each XML Element <Nodes ...> </Nodes> encapsulates information about a group of Nodes.\n+\t */\n+\tfor (node_group = sys_knl->elements; node_group; node_group = node_group->next) {\n+\n+\t\t/*\n+\t\t * The System Query XML Response contains information about KNL and\n+\t\t * non-KNL Nodes. We are only interested in KNL nodes that are in\n+\t\t * \"batch\" mode and in the \"up\" state.\n+\t\t */\n+\t\tif (exclude_from_KNL_processing(node_group))\n+\t\t\tcontinue;\n+\n+\t\t/*\n+\t\t * Extract NIDs (Node ID) from node_group->nidlist.\n+\t\t * If nidlist is empty, node_count gets set to 0 and vnode\n+\t\t * creation in the inner for() is bypassed.\n+\t\t */\n+\t\tnid_arr = (long *) process_nodelist_KNL(node_group->nidlist, &node_count);\n+\n+\t\t/*\n+\t\t * Create vnodes for each of the KNL Nodes listed in this Node group.\n+\t\t * All KNL Nodes within a Node Group will have similar vnode attributes,\n+\t\t * since all attributes in each <Nodes ...> XML element apply to all\n+\t\t * Nodes listed in the 'rangelist'.\n+\t\t */\n+\t\tfor (node_idx = 0; node_idx < node_count; node_idx++) {\n+\n+\t\t\tnode_id = nid_arr[node_idx];\n+\t\t\tsnprintf(vname, VNODE_NAME_LEN, \"%s_%ld\", mpphost_knl, node_id);\n+\n+\t\t\tif (first_compute_node) {\n+\t\t\t\t/*\n+\t\t\t\t * Create the name of the very first vnode so we\n+\t\t\t\t * can attach topology info to it.\n+\t\t\t\t */\n+\n+\t\t\t\tattr = ATTR_NODE_TopologyInfo;\n+\t\t\t\tif (vn_addvnr(vnlp, vname, attr, (char *) basil_inventory,\n+\t\t\t\t\t     ATR_TYPE_STR, READ_ONLY, NULL) == -1)\n+\t\t\t\t\t  goto bad_vnl;\n+\t\t\t\tfirst_compute_node = 0;\n+\t\t\t}\n+\n+\t\t\tattr = \"sharing\";\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, ND_Force_Exclhost, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"resources_available.vntype\";\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, CRAY_COMPUTE, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"resources_available.PBScrayhost\";\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, mpphost_knl, ATR_TYPE_STR, atype, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"resources_available.arch\";\n+\t\t\tarch = BASIL_VAL_XT;\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, arch, ATR_TYPE_STR, atype, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"resources_available.host\";\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%s_%ld\", mpphost_knl, node_id);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"resources_available.PBScraynid\";\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%ld\", node_id);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, ATR_TYPE_STR, atype, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tif (vnode_per_numa_node) {\n+\t\t\t\tattr = \"resources_available.PBScrayseg\";\n+\t\t\t\tif (vn_addvnr(vnlp, vname, attr, \"0\", ATR_TYPE_STR, atype, NULL) == -1)\n+\t\t\t\t\tgoto bad_vnl;\n+\t\t\t}\n+\t\t\tattr = \"resources_available.ncpus\";\n+\t\t\tncpus_per_knl = atoi(node_group->compute_units);\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%d\", ncpus_per_knl);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\t/* avlmem is conventional DRAM mem. avlmem = page_size_kb * page_count. */\n+\t\t\tattr = \"resources_available.mem\";\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%skb\", node_group->avlmem);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\tattr = \"current_aoe\";\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%s_%s\",\n+\t\t\t\tnode_group->numa_cfg, node_group->hbm_cfg);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\n+\t\t\t/* hbmem is high bandwidth mem (MCDRAM) in megabytes. */\n+\t\t\tattr = \"resources_available.hbmem\";\n+\t\t\tsnprintf(utilBuffer_knl, sizeof(utilBuffer_knl), \"%smb\", node_group->hbmsize);\n+\t\t\tif (vn_addvnr(vnlp, vname, attr, utilBuffer_knl, 0, 0, NULL) == -1)\n+\t\t\t\tgoto bad_vnl;\n+\t\t}\n+\t\t/* We have no further use for this array of KNL node ids. */\n+\t\tif (nid_arr) {\n+\t\t\tfree(nid_arr);\n+\t\t\tnid_arr = NULL;\n+\t\t}\n+\t}\n+\n+\treturn;\n+\n+bad_vnl:\n+\tsnprintf(log_buffer, sizeof(log_buffer), \"Creation of Cray KNL vnodes failed with name %s\", vname);\n+\tlog_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__, log_buffer);\n+\t/*\n+\t * Don't free nv since it might be important in the dump.\n+\t */\n+\tabort();\n+}\n+\n+/**\n+ *\n+ * @brief Check if this Node Group needs to be considered for KNL processing.\n+ *        We are only interested in KNL Nodes that have \"role\" set to \"batch\" and\n+ *\t  \"state\" set to \"up\".\n+ *\t  The attributes \"numa_cfg\", \"hbmsize\", \"hbm_cfg\" not being empty (\"\") implies\n+ *\t  they pertain to KNL Nodes.\n+ *\n+ * @param[in] ptrNodeGrp Pointer to the current Node Group in the System XML Response.\n+ *\n+ * @return int\n+ * @retval 1 Indicates that the Node Group should not be considered.\n+ * @retval 0 Indicates that the Node Group should be considered.\n+ *\n+ */\n+static int\n+exclude_from_KNL_processing(basil_system_element_t *ptrNodeGrp)\n+{\n+\tif ((strcmp(ptrNodeGrp->role, BASIL_VAL_BATCH_SYS) != 0) ||\n+\t    (strcmp(ptrNodeGrp->state, BASIL_VAL_UP_SYS) != 0) ||\n+\t    ((strcmp(ptrNodeGrp->numa_cfg, \"\") == 0) &&\n+\t     (strcmp(ptrNodeGrp->hbmsize, \"\") == 0) &&\n+\t     (strcmp(ptrNodeGrp->hbm_cfg, \"\") == 0)))\n+\t\treturn 1;\n+\telse\n+\t\treturn 0;\n+}\n+\n+/**\n+ *\n+ * @brief KNL Nodes are specified in 'Rangelist' format in a string e.g. \"12,13,14-18,21\".\n+ * \t  Extract Node IDs from this string and store them in an integer array.\n+ *\n+ * @param[in] nidlist String containing rangelist of Nodes.\n+ * @param[out] ptr_count Total number of Nodes in this list.\n+ *\n+ * @return int *\n+ * @retval This is an long integer array containing Node IDs.\n+ *\t   nid_arr returned here is freed in the calling function after use.\n+ */\n+static long *\n+process_nodelist_KNL(char *nidlist, int *ptr_count)\n+{\n+\tchar delim[] = \",\";\n+\tchar *token, *nidlist_array, *endptr;\n+\tint nid_num = 0;\n+\tint nid_count = 0;\n+\tlong *nid_arr = NULL;\n+\n+\tif (nidlist == NULL) {\n+\t\tlog_event(PBSEVENT_DEBUG3, PBS_EVENTCLASS_NODE, LOG_DEBUG, __func__, \"No KNL nodes.\");\n+\t\t*ptr_count = 0;\n+\t\treturn NULL;\n+\t}\n+\n+\tif ((nidlist_array = strdup(nidlist)) == NULL){\n+\t\tlog_err(errno, __func__, \"malloc failure\");\n+\t\t*ptr_count = 0;\n+\t\treturn NULL;\n+\t}\n+\n+\tendptr = NULL;\n+\t/* 'token' points to a null terminated string containing the token e.g. \"12\\0\", \"14-18\\0\". */\n+\ttoken = strtok(nidlist_array, delim);\n+\twhile (token != NULL) {\n+\t\t/*\n+\t\t * Each token (e.g. \"12\" or \"14-18\") is converted to an int and sent as\n+\t\t * an argument to store_nids(). In case of tokens such as \"14-18\", nid_num=14\n+\t\t * and 'endptr' points to the first invalid character i.e. \"-\".\n+\t\t */\n+\t\tnid_num = (int)strtol(token, &endptr, 10);\n+\t\t/* Checking for invalid data in the Node rangelist. */\n+\t\tif ((*endptr != '\\0') && (*endptr != '-')) {\n+\t\t\tsnprintf(log_buffer, sizeof(log_buffer), \"Bad KNL Rangelist: \\\"%s\\\"\", nidlist_array);\n+\t\t\tlog_event(PBSEVENT_ERROR, PBS_EVENTCLASS_NODE, LOG_ERR, __func__, log_buffer);\n+\t\t\tif (nid_arr != NULL) {\n+\t\t\t\tfree(nid_arr);","path":"src/resmom/linux/alps.c","position":1427,"original_position":1427,"commit_id":"85c065f0e3685ac70185dbbe64f8a8216a82ead8","original_commit_id":"85c065f0e3685ac70185dbbe64f8a8216a82ead8","user":{"login":"riyazhakki","id":17975656,"avatar_url":"https://avatars2.githubusercontent.com/u/17975656?v=4","gravatar_id":"","url":"https://api.github.com/users/riyazhakki","html_url":"https://github.com/riyazhakki","followers_url":"https://api.github.com/users/riyazhakki/followers","following_url":"https://api.github.com/users/riyazhakki/following{/other_user}","gists_url":"https://api.github.com/users/riyazhakki/gists{/gist_id}","starred_url":"https://api.github.com/users/riyazhakki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riyazhakki/subscriptions","organizations_url":"https://api.github.com/users/riyazhakki/orgs","repos_url":"https://api.github.com/users/riyazhakki/repos","events_url":"https://api.github.com/users/riyazhakki/events{/privacy}","received_events_url":"https://api.github.com/users/riyazhakki/received_events","type":"User","site_admin":false},"body":"Yes, as per C99 there will be no operation if do free(NULL).  I will consider this in my next commit.","created_at":"2018-03-15T13:40:28Z","updated_at":"2018-03-15T13:40:28Z","html_url":"https://github.com/PBSPro/pbspro/pull/529#discussion_r174784205","pull_request_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/529","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments/174784205"},"html":{"href":"https://github.com/PBSPro/pbspro/pull/529#discussion_r174784205"},"pull_request":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/529"}},"in_reply_to_id":174620215},"pull_request":{"url":"https://api.github.com/repos/PBSPro/pbspro/pulls/529","id":164005757,"html_url":"https://github.com/PBSPro/pbspro/pull/529","diff_url":"https://github.com/PBSPro/pbspro/pull/529.diff","patch_url":"https://github.com/PBSPro/pbspro/pull/529.patch","issue_url":"https://api.github.com/repos/PBSPro/pbspro/issues/529","number":529,"state":"open","locked":false,"title":"PP-706 Automatically create KNL specific information","user":{"login":"dilip-krishnan","id":17922772,"avatar_url":"https://avatars3.githubusercontent.com/u/17922772?v=4","gravatar_id":"","url":"https://api.github.com/users/dilip-krishnan","html_url":"https://github.com/dilip-krishnan","followers_url":"https://api.github.com/users/dilip-krishnan/followers","following_url":"https://api.github.com/users/dilip-krishnan/following{/other_user}","gists_url":"https://api.github.com/users/dilip-krishnan/gists{/gist_id}","starred_url":"https://api.github.com/users/dilip-krishnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilip-krishnan/subscriptions","organizations_url":"https://api.github.com/users/dilip-krishnan/orgs","repos_url":"https://api.github.com/users/dilip-krishnan/repos","events_url":"https://api.github.com/users/dilip-krishnan/events{/privacy}","received_events_url":"https://api.github.com/users/dilip-krishnan/received_events","type":"User","site_admin":false},"body":"<!--- Please review your changes in preview mode -->\r\n<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n#### Bug/feature Description\r\n* Automatically create KNL specific information\r\n*[PP-706](https://pbspro.atlassian.net/browse/PP-706)*\r\n*[PP-980](https://pbspro.atlassian.net/browse/PP-980)*\r\n*[PP-981](https://pbspro.atlassian.net/browse/PP-981)*\r\n*[PP-982](https://pbspro.atlassian.net/browse/PP-980)*\r\n\r\n\r\n#### Affected Platform(s) and PBS Version\r\n* Changes are specific for Cray cluster, with bootable processor capability. \r\n\r\n#### Cause / Analysis / Design\r\nAs part of the BASIL 1.7 project, we will be making a System Query to get KNL Node information. One vnode per KNL node will be created using this information.\r\n\r\nIn the current system, we make an Inventory (BASIL 1.4) Query to get Inventory information. Vnodes are created for compute nodes based on this information.\r\n\r\nWe are currently at BASIL 1.4. For BASIL 1.5 and 1.6, changes have not been implemented in PBS. This project aims to support the BASIL 1.7 System Query for KNL nodes only.\r\n\r\nAt some point in the future, we may migrate from the the existing Inventory (BASIL 1.4) Query and implement the Inventory (BASIL 1.7) Query.\r\n\r\nDefinitions:\r\n\r\nA Node may have one or more Microprocessors/Sockets.\r\nEach Socket may have one or more Segments (also known as NUMA Nodes).\r\nEach Segment may have one or more CPUs.\r\nIn the current system, for non-KNL nodes returned as part of the Inventory (BASIL 1.4) Query, we create a vnode per Segment( vnode_per_numa_node=True). The PBScrayseg attribute of the created vnode will reflect the segment ordinal e.g.\r\n\r\nfor ordinal=0, PBScrayseg=0, for ordinal=1, PBScrayseg=1 etc.\r\n\r\nIn the current system, for KNL nodes returned as part of the Inventory (BASIL 1.4) Query, we create 1 vnode per Node (the segment ordinal for KNL Nodes is set to 0 & PBScrayseg = 0).\r\n\r\nThe System (BASIL 1.7) Query returns grouped information (attributes) that apply to a range of Nodes.\r\n\r\nThe numa_nodes attribute will reflect the number of NUMA Nodes/Segments this KNL Node has. Regardless, we will be creating 1 vnode per KNL Node.\r\n\r\nAdditional attributes such as numa_cfg, hbm_cache_pct and hbm_size_mb will also be considered when creating KNL vnodes.\r\n\r\n#### Checklist:\r\n<!--- Use the preview button to see the checkboxes/links properly. -->\r\n<!--- Go over the following points, and put an `x` (without spaces around it) in the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] I have joined the **[pbspro community forum](http://community.pbspro.org/)**.\r\n- [ ] My pull request contains a **single, signed** commit. See **[setting up gpg signature](https://pbspro.atlassian.net/wiki/display/DG/Signing+Your+Git+Commits)**.\r\n- [x] My code follows the **[coding style](https://pbspro.atlassian.net/wiki/display/DG/Coding+Standards)** of this project.\r\n- [x] My change requires project documentation. See **[required documentation checklist](https://pbspro.atlassian.net/wiki/spaces/PD/pages/68845606/PP-706+Automatically+create+KNL+specific+information)** for details.\r\n- [x] I have added documentation in the **[project documentation area](https://pbspro.atlassian.net/wiki/display/PD)**.\r\n- [x] I have added new **PTL test(s) to my commit**. (See **[using PTL for testing](https://pbspro.atlassian.net/wiki/display/DG/Using+PTL+for+Testing)**) *(or)*\r\n- [ ] I have added  **manual test(s) to this pull request and explained why PTL is not appropriate** for this case.\r\n- [ ] All new and existing automated tests have passed. (See **[running automated PTL tests](https://pbspro.atlassian.net/wiki/display/DG/PTL+Quick+Start+Guide)**).\r\n- [x] I have attached **test logs to this pull request** as evidence of testing/verification.\r\n\r\n\r\n__***For further information please visit the [Developer Guide Home](https://pbspro.atlassian.net/wiki/display/DG/Developer+Guide+Home).***__\r\n","created_at":"2018-01-19T16:02:55Z","updated_at":"2018-03-15T13:40:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6eb3166048822b0a2334ea17c04ecd5a5efaa348","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/529/commits","review_comments_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/529/comments","review_comment_url":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PBSPro/pbspro/issues/529/comments","statuses_url":"https://api.github.com/repos/PBSPro/pbspro/statuses/85c065f0e3685ac70185dbbe64f8a8216a82ead8","head":{"label":"dilip-krishnan:PP-706","ref":"PP-706","sha":"85c065f0e3685ac70185dbbe64f8a8216a82ead8","user":{"login":"dilip-krishnan","id":17922772,"avatar_url":"https://avatars3.githubusercontent.com/u/17922772?v=4","gravatar_id":"","url":"https://api.github.com/users/dilip-krishnan","html_url":"https://github.com/dilip-krishnan","followers_url":"https://api.github.com/users/dilip-krishnan/followers","following_url":"https://api.github.com/users/dilip-krishnan/following{/other_user}","gists_url":"https://api.github.com/users/dilip-krishnan/gists{/gist_id}","starred_url":"https://api.github.com/users/dilip-krishnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilip-krishnan/subscriptions","organizations_url":"https://api.github.com/users/dilip-krishnan/orgs","repos_url":"https://api.github.com/users/dilip-krishnan/repos","events_url":"https://api.github.com/users/dilip-krishnan/events{/privacy}","received_events_url":"https://api.github.com/users/dilip-krishnan/received_events","type":"User","site_admin":false},"repo":{"id":63232421,"name":"pbspro","full_name":"dilip-krishnan/pbspro","owner":{"login":"dilip-krishnan","id":17922772,"avatar_url":"https://avatars3.githubusercontent.com/u/17922772?v=4","gravatar_id":"","url":"https://api.github.com/users/dilip-krishnan","html_url":"https://github.com/dilip-krishnan","followers_url":"https://api.github.com/users/dilip-krishnan/followers","following_url":"https://api.github.com/users/dilip-krishnan/following{/other_user}","gists_url":"https://api.github.com/users/dilip-krishnan/gists{/gist_id}","starred_url":"https://api.github.com/users/dilip-krishnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dilip-krishnan/subscriptions","organizations_url":"https://api.github.com/users/dilip-krishnan/orgs","repos_url":"https://api.github.com/users/dilip-krishnan/repos","events_url":"https://api.github.com/users/dilip-krishnan/events{/privacy}","received_events_url":"https://api.github.com/users/dilip-krishnan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dilip-krishnan/pbspro","description":"An HPC workload manager and job scheduler for desktops, clusters, and clouds.","fork":true,"url":"https://api.github.com/repos/dilip-krishnan/pbspro","forks_url":"https://api.github.com/repos/dilip-krishnan/pbspro/forks","keys_url":"https://api.github.com/repos/dilip-krishnan/pbspro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dilip-krishnan/pbspro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dilip-krishnan/pbspro/teams","hooks_url":"https://api.github.com/repos/dilip-krishnan/pbspro/hooks","issue_events_url":"https://api.github.com/repos/dilip-krishnan/pbspro/issues/events{/number}","events_url":"https://api.github.com/repos/dilip-krishnan/pbspro/events","assignees_url":"https://api.github.com/repos/dilip-krishnan/pbspro/assignees{/user}","branches_url":"https://api.github.com/repos/dilip-krishnan/pbspro/branches{/branch}","tags_url":"https://api.github.com/repos/dilip-krishnan/pbspro/tags","blobs_url":"https://api.github.com/repos/dilip-krishnan/pbspro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dilip-krishnan/pbspro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dilip-krishnan/pbspro/git/refs{/sha}","trees_url":"https://api.github.com/repos/dilip-krishnan/pbspro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dilip-krishnan/pbspro/statuses/{sha}","languages_url":"https://api.github.com/repos/dilip-krishnan/pbspro/languages","stargazers_url":"https://api.github.com/repos/dilip-krishnan/pbspro/stargazers","contributors_url":"https://api.github.com/repos/dilip-krishnan/pbspro/contributors","subscribers_url":"https://api.github.com/repos/dilip-krishnan/pbspro/subscribers","subscription_url":"https://api.github.com/repos/dilip-krishnan/pbspro/subscription","commits_url":"https://api.github.com/repos/dilip-krishnan/pbspro/commits{/sha}","git_commits_url":"https://api.github.com/repos/dilip-krishnan/pbspro/git/commits{/sha}","comments_url":"https://api.github.com/repos/dilip-krishnan/pbspro/comments{/number}","issue_comment_url":"https://api.github.com/repos/dilip-krishnan/pbspro/issues/comments{/number}","contents_url":"https://api.github.com/repos/dilip-krishnan/pbspro/contents/{+path}","compare_url":"https://api.github.com/repos/dilip-krishnan/pbspro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dilip-krishnan/pbspro/merges","archive_url":"https://api.github.com/repos/dilip-krishnan/pbspro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dilip-krishnan/pbspro/downloads","issues_url":"https://api.github.com/repos/dilip-krishnan/pbspro/issues{/number}","pulls_url":"https://api.github.com/repos/dilip-krishnan/pbspro/pulls{/number}","milestones_url":"https://api.github.com/repos/dilip-krishnan/pbspro/milestones{/number}","notifications_url":"https://api.github.com/repos/dilip-krishnan/pbspro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dilip-krishnan/pbspro/labels{/name}","releases_url":"https://api.github.com/repos/dilip-krishnan/pbspro/releases{/id}","deployments_url":"https://api.github.com/repos/dilip-krishnan/pbspro/deployments","created_at":"2016-07-13T09:18:08Z","updated_at":"2016-07-13T09:18:13Z","pushed_at":"2018-03-13T14:06:37Z","git_url":"git://github.com/dilip-krishnan/pbspro.git","ssh_url":"git@github.com:dilip-krishnan/pbspro.git","clone_url":"https://github.com/dilip-krishnan/pbspro.git","svn_url":"https://github.com/dilip-krishnan/pbspro","homepage":"www.pbspro.org","size":10243,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PBSPro:master","ref":"master","sha":"cab95edab2454485d2a068798d33ccecb3a98691","user":{"login":"PBSPro","id":19280436,"avatar_url":"https://avatars2.githubusercontent.com/u/19280436?v=4","gravatar_id":"","url":"https://api.github.com/users/PBSPro","html_url":"https://github.com/PBSPro","followers_url":"https://api.github.com/users/PBSPro/followers","following_url":"https://api.github.com/users/PBSPro/following{/other_user}","gists_url":"https://api.github.com/users/PBSPro/gists{/gist_id}","starred_url":"https://api.github.com/users/PBSPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PBSPro/subscriptions","organizations_url":"https://api.github.com/users/PBSPro/orgs","repos_url":"https://api.github.com/users/PBSPro/repos","events_url":"https://api.github.com/users/PBSPro/events{/privacy}","received_events_url":"https://api.github.com/users/PBSPro/received_events","type":"Organization","site_admin":false},"repo":{"id":59082072,"name":"pbspro","full_name":"PBSPro/pbspro","owner":{"login":"PBSPro","id":19280436,"avatar_url":"https://avatars2.githubusercontent.com/u/19280436?v=4","gravatar_id":"","url":"https://api.github.com/users/PBSPro","html_url":"https://github.com/PBSPro","followers_url":"https://api.github.com/users/PBSPro/followers","following_url":"https://api.github.com/users/PBSPro/following{/other_user}","gists_url":"https://api.github.com/users/PBSPro/gists{/gist_id}","starred_url":"https://api.github.com/users/PBSPro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PBSPro/subscriptions","organizations_url":"https://api.github.com/users/PBSPro/orgs","repos_url":"https://api.github.com/users/PBSPro/repos","events_url":"https://api.github.com/users/PBSPro/events{/privacy}","received_events_url":"https://api.github.com/users/PBSPro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PBSPro/pbspro","description":"An HPC workload manager and job scheduler for desktops, clusters, and clouds.","fork":false,"url":"https://api.github.com/repos/PBSPro/pbspro","forks_url":"https://api.github.com/repos/PBSPro/pbspro/forks","keys_url":"https://api.github.com/repos/PBSPro/pbspro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PBSPro/pbspro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PBSPro/pbspro/teams","hooks_url":"https://api.github.com/repos/PBSPro/pbspro/hooks","issue_events_url":"https://api.github.com/repos/PBSPro/pbspro/issues/events{/number}","events_url":"https://api.github.com/repos/PBSPro/pbspro/events","assignees_url":"https://api.github.com/repos/PBSPro/pbspro/assignees{/user}","branches_url":"https://api.github.com/repos/PBSPro/pbspro/branches{/branch}","tags_url":"https://api.github.com/repos/PBSPro/pbspro/tags","blobs_url":"https://api.github.com/repos/PBSPro/pbspro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PBSPro/pbspro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PBSPro/pbspro/git/refs{/sha}","trees_url":"https://api.github.com/repos/PBSPro/pbspro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PBSPro/pbspro/statuses/{sha}","languages_url":"https://api.github.com/repos/PBSPro/pbspro/languages","stargazers_url":"https://api.github.com/repos/PBSPro/pbspro/stargazers","contributors_url":"https://api.github.com/repos/PBSPro/pbspro/contributors","subscribers_url":"https://api.github.com/repos/PBSPro/pbspro/subscribers","subscription_url":"https://api.github.com/repos/PBSPro/pbspro/subscription","commits_url":"https://api.github.com/repos/PBSPro/pbspro/commits{/sha}","git_commits_url":"https://api.github.com/repos/PBSPro/pbspro/git/commits{/sha}","comments_url":"https://api.github.com/repos/PBSPro/pbspro/comments{/number}","issue_comment_url":"https://api.github.com/repos/PBSPro/pbspro/issues/comments{/number}","contents_url":"https://api.github.com/repos/PBSPro/pbspro/contents/{+path}","compare_url":"https://api.github.com/repos/PBSPro/pbspro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PBSPro/pbspro/merges","archive_url":"https://api.github.com/repos/PBSPro/pbspro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PBSPro/pbspro/downloads","issues_url":"https://api.github.com/repos/PBSPro/pbspro/issues{/number}","pulls_url":"https://api.github.com/repos/PBSPro/pbspro/pulls{/number}","milestones_url":"https://api.github.com/repos/PBSPro/pbspro/milestones{/number}","notifications_url":"https://api.github.com/repos/PBSPro/pbspro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PBSPro/pbspro/labels{/name}","releases_url":"https://api.github.com/repos/PBSPro/pbspro/releases{/id}","deployments_url":"https://api.github.com/repos/PBSPro/pbspro/deployments","created_at":"2016-05-18T04:31:29Z","updated_at":"2018-03-14T21:26:49Z","pushed_at":"2018-03-15T11:40:14Z","git_url":"git://github.com/PBSPro/pbspro.git","ssh_url":"git@github.com:PBSPro/pbspro.git","clone_url":"https://github.com/PBSPro/pbspro.git","svn_url":"https://github.com/PBSPro/pbspro","homepage":"www.pbspro.org","size":14468,"stargazers_count":145,"watchers_count":145,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":126,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":126,"open_issues":14,"watchers":145,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/529"},"html":{"href":"https://github.com/PBSPro/pbspro/pull/529"},"issue":{"href":"https://api.github.com/repos/PBSPro/pbspro/issues/529"},"comments":{"href":"https://api.github.com/repos/PBSPro/pbspro/issues/529/comments"},"review_comments":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/529/comments"},"review_comment":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PBSPro/pbspro/pulls/529/commits"},"statuses":{"href":"https://api.github.com/repos/PBSPro/pbspro/statuses/85c065f0e3685ac70185dbbe64f8a8216a82ead8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"riyazhakki"}}