void finish_gpu_status( boost::ptr_vector<std::string>::iterator& i, boost::ptr_vector<std::string>::iterator end) { while (i != end) { if (!strcmp(i->c_str(), CRAY_GPU_STATUS_END)) break; i++; } } /* END finish_gpu_status() */
int process_gpu_status( struct pbsnode *pnode, boost::ptr_vector<std::string>::iterator& i, boost::ptr_vector<std::string>::iterator end) { pbs_attribute temp; int gpu_count = 0; int rc; char buf[MAXLINE * 2]; std::string gpu_info = ""; memset(&temp, 0, sizeof(temp)); if ((rc = decode_arst(&temp, NULL, NULL, NULL, 0)) != PBSE_NONE) { log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_NODE, __func__, "cannot initialize attribute"); finish_gpu_status(i,end); return(rc); } /* move past the initial gpu status */ i++; for (; i != end; i++) { if (!strcmp(i->c_str(), CRAY_GPU_STATUS_END)) break; if (!strncmp(i->c_str(), "gpu_id=", strlen("gpu_id="))) { snprintf(buf, sizeof(buf), "gpu[%d]=%s;", gpu_count, i->c_str()); gpu_info += buf; gpu_count++; } else { gpu_info += i->c_str(); gpu_info += ';'; } if (rc != PBSE_NONE) { finish_gpu_status(i,end); return(rc); } } set_ngpus(pnode, gpu_count); decode_arst(&temp, NULL, NULL, gpu_info.c_str(), 0); node_gpustatus_list(&temp, pnode, ATR_ACTION_ALTER); free_arst(&temp); return(rc); } /* END process_gpu_status() */