/* * _pack_front_end - dump all configuration information about a specific * front_end node in machine independent form (for network transmission) * IN dump_front_end_ptr - pointer to front_end node for which information is * requested * IN/OUT buffer - buffer where data is placed, pointers automatically updated * IN protocol_version - slurm protocol version of client * NOTE: if you make any changes here be sure to make the corresponding * changes to load_front_end_config in api/node_info.c */ static void _pack_front_end(struct front_end_record *dump_front_end_ptr, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_2_6_PROTOCOL_VERSION) { packstr(dump_front_end_ptr->allow_groups, buffer); packstr(dump_front_end_ptr->allow_users, buffer); pack_time(dump_front_end_ptr->boot_time, buffer); packstr(dump_front_end_ptr->deny_groups, buffer); packstr(dump_front_end_ptr->deny_users, buffer); packstr(dump_front_end_ptr->name, buffer); pack16(dump_front_end_ptr->node_state, buffer); packstr(dump_front_end_ptr->reason, buffer); pack_time(dump_front_end_ptr->reason_time, buffer); pack32(dump_front_end_ptr->reason_uid, buffer); pack_time(dump_front_end_ptr->slurmd_start_time, buffer); } else if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { pack_time(dump_front_end_ptr->boot_time, buffer); packstr(dump_front_end_ptr->name, buffer); pack16(dump_front_end_ptr->node_state, buffer); packstr(dump_front_end_ptr->reason, buffer); pack_time(dump_front_end_ptr->reason_time, buffer); pack32(dump_front_end_ptr->reason_uid, buffer); pack_time(dump_front_end_ptr->slurmd_start_time, buffer); } else { error("_pack_front_end: Unsupported slurm version %u", protocol_version); } }
extern int select_nodeinfo_pack(select_nodeinfo_t *nodeinfo, Buf buffer, uint16_t protocol_version) { ListIterator itr; node_subgrp_t *subgrp = NULL; uint16_t count = 0; if (protocol_version >= SLURM_2_1_PROTOCOL_VERSION) { pack16(nodeinfo->bitmap_size, buffer); if (nodeinfo->subgrp_list) count = list_count(nodeinfo->subgrp_list); pack16(count, buffer); if (count > 0) { itr = list_iterator_create(nodeinfo->subgrp_list); while ((subgrp = list_next(itr))) { _pack_node_subgrp(subgrp, buffer, protocol_version); } list_iterator_destroy(itr); } } return SLURM_SUCCESS; }
extern void pack_slurm_step_layout(slurm_step_layout_t *step_layout, Buf buffer, uint16_t protocol_version) { uint32_t i = 0; if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) { if (step_layout) i=1; pack16(i, buffer); if (!i) return; packstr(step_layout->front_end, buffer); packstr(step_layout->node_list, buffer); pack32(step_layout->node_cnt, buffer); pack32(step_layout->task_cnt, buffer); pack16(step_layout->task_dist, buffer); for (i=0; i<step_layout->node_cnt; i++) { pack32_array(step_layout->tids[i], step_layout->tasks[i], buffer); } } else { error("pack_slurm_step_layout: protocol_version " "%hu not supported", protocol_version); } }
extern int slurm_ckpt_pack_job(check_jobinfo_t jobinfo, Buf buffer, uint16_t protocol_version) { struct check_job_info *check_ptr = (struct check_job_info *)jobinfo; if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { uint32_t x; uint32_t y; uint32_t z; uint32_t size; size = 0; pack16(CHECK_POE, buffer); x = get_buf_offset(buffer); pack32(size, buffer); y = get_buf_offset(buffer); pack16(check_ptr->disabled, buffer); pack16(check_ptr->node_cnt, buffer); pack16(check_ptr->reply_cnt, buffer); pack16(check_ptr->wait_time, buffer); pack32(check_ptr->error_code, buffer); packstr(check_ptr->error_msg, buffer); pack_time(check_ptr->time_stamp, buffer); z = get_buf_offset(buffer); set_buf_offset(buffer, x); pack32(z - y, buffer); set_buf_offset(buffer, z); } return SLURM_SUCCESS; }
void main() { vec4 heightRT = texture2D( u_Texture0, v_TexCoords ); vec4 normRT = texture2D( u_Texture1, v_TexCoords ); vec3 baseNorm = (normRT.rgb-0.5)*2.0; baseNorm.z = 0.0; baseNorm = normalize(baseNorm); vec3 faceNorm = vec3(0.0,0.0,1.0); float curDis = heightRT.b; float maxDis = 128.0/255.0; float startZ = 0.0; float endZ = 1.0; float lerpPow = 2.0; float lerpAmount = max(maxDis-curDis,0.0)/maxDis; /* // sharp bevel lerpAmount = 0.5; if (curDis >= 80.0/255.0) { lerpAmount = 0.0; }*/ if (curDis <= 16.0/255.0) { lerpAmount = 1.0; } vec3 finalNorm = mix(faceNorm, baseNorm, lerpAmount ); finalNorm = normalize(finalNorm); float alphaVal = heightRT.g; if (alphaVal == 0.0) { discard; } vec4 gIdRGBA; float groupId = v_Data0.z; gIdRGBA.rg = pack16(groupId); //gIdRGBA.r = floor(groupId/256.0)/255.0; //gIdRGBA.g = mod(groupId,256.0)/255.0; float matId = v_Data0.w; gIdRGBA.ba = pack16(matId); //gIdRGBA.b = floor(matId/256.0)/255.0; //gIdRGBA.a = mod(matId,256.0)/255.0; gl_FragColor = gIdRGBA; }
static void _pack_alloc(struct bb_alloc *bb_alloc, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_16_05_PROTOCOL_VERSION) { packstr(bb_alloc->account, buffer); pack32(bb_alloc->array_job_id, buffer); pack32(bb_alloc->array_task_id, buffer); pack_time(bb_alloc->create_time, buffer); pack32(bb_alloc->job_id, buffer); packstr(bb_alloc->name, buffer); packstr(bb_alloc->partition, buffer); packstr(bb_alloc->pool, buffer); packstr(bb_alloc->qos, buffer); pack64(bb_alloc->size, buffer); pack16(bb_alloc->state, buffer); pack32(bb_alloc->user_id, buffer); } else { packstr(bb_alloc->account, buffer); pack32(bb_alloc->array_job_id, buffer); pack32(bb_alloc->array_task_id, buffer); pack_time(bb_alloc->create_time, buffer); pack32((uint32_t)0, buffer); pack32(bb_alloc->job_id, buffer); packstr(bb_alloc->name, buffer); packstr(bb_alloc->partition, buffer); packstr(bb_alloc->qos, buffer); pack64(bb_alloc->size, buffer); pack16(bb_alloc->state, buffer); pack32(bb_alloc->user_id, buffer); } }
/* * _dump_part_state - dump the state of a specific partition to a buffer * IN part_ptr - pointer to partition for which information * is requested * IN/OUT buffer - location to store data, pointers automatically advanced */ static void _dump_part_state(struct part_record *part_ptr, Buf buffer) { xassert(part_ptr); if (default_part_loc == part_ptr) part_ptr->flags |= PART_FLAG_DEFAULT; else part_ptr->flags &= (~PART_FLAG_DEFAULT); packstr(part_ptr->name, buffer); pack32(part_ptr->grace_time, buffer); pack32(part_ptr->max_time, buffer); pack32(part_ptr->default_time, buffer); pack32(part_ptr->max_nodes_orig, buffer); pack32(part_ptr->min_nodes_orig, buffer); pack16(part_ptr->flags, buffer); pack16(part_ptr->max_share, buffer); pack16(part_ptr->preempt_mode, buffer); pack16(part_ptr->priority, buffer); pack16(part_ptr->state_up, buffer); packstr(part_ptr->allow_groups, buffer); packstr(part_ptr->allow_alloc_nodes, buffer); packstr(part_ptr->alternate, buffer); packstr(part_ptr->nodes, buffer); }
void io_hdr_pack(io_hdr_t *hdr, Buf buffer) { pack16(hdr->type, buffer); pack16(hdr->gtaskid, buffer); pack16(hdr->ltaskid, buffer); pack32(hdr->length, buffer); }
static void _select_jobinfo_pack(select_jobinfo_t *jobinfo, Buf buffer, uint16_t protocol_version) { if (!jobinfo) { pack16(0, buffer); } else { pack16(jobinfo->cleaning, buffer); } }
static void _pack_register_ctld_msg(dbd_register_ctld_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { pack16(msg->dimensions, buffer); pack32(msg->flags, buffer); pack32(msg->plugin_id_select, buffer); pack16(msg->port, buffer); } }
static int _pack_node_subgrp(node_subgrp_t *subgrp, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { pack_bit_fmt(subgrp->bitmap, buffer); pack16(subgrp->cnode_cnt, buffer); pack16(subgrp->state, buffer); } return SLURM_SUCCESS; }
static void _pack_jobacct_id(jobacct_id_t *jobacct_id, uint16_t rpc_version, Buf buffer) { if (jobacct_id) { pack32((uint32_t) jobacct_id->nodeid, buffer); pack16((uint16_t) jobacct_id->taskid, buffer); } else { pack32((uint32_t) NO_VAL, buffer); pack16((uint16_t) NO_VAL, buffer); } }
extern void slurm_persist_pack_rc_msg( persist_rc_msg_t *msg, Buf buffer, uint16_t protocol_version) { if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { packstr(msg->comment, buffer); pack16(msg->flags, buffer); pack32(msg->rc, buffer); pack16(msg->ret_info, buffer); } else { error("%s: invalid protocol version %u", __func__, protocol_version); } }
extern void slurm_persist_pack_init_req_msg( persist_init_req_msg_t *msg, Buf buffer) { /* always send version field first for backwards compatibility */ pack16(msg->version, buffer); if (msg->version >= SLURM_MIN_PROTOCOL_VERSION) { packstr(msg->cluster_name, buffer); pack16(msg->persist_type, buffer); pack16(msg->port, buffer); } else { error("%s: invalid protocol version %u", __func__, msg->version); } }
int switch_p_pack_jobinfo(switch_jobinfo_t *switch_job, Buf buffer, uint16_t protocol_version) { sw_gen_step_info_t *gen_step_info = (sw_gen_step_info_t *) switch_job; sw_gen_node_t *node_ptr; sw_gen_ifa_t *ifa_ptr; int i, j; if (debug_flags & DEBUG_FLAG_SWITCH) info("switch_p_pack_jobinfo() starting"); xassert(gen_step_info); xassert(gen_step_info->magic == SW_GEN_STEP_INFO_MAGIC); if (!libstate) { /* The function is being called from srun or slurmd. * There is no more need for moving this data. */ pack32((uint32_t) 0, buffer); return SLURM_SUCCESS; } pack32(gen_step_info->node_cnt, buffer); for (i = 0; i < gen_step_info->node_cnt; i++) { node_ptr = gen_step_info->node_array[i]; packstr(node_ptr->node_name, buffer); pack16(node_ptr->ifa_cnt, buffer); for (j = 0; j < node_ptr->ifa_cnt; j++) { ifa_ptr = node_ptr->ifa_array[j]; packstr(ifa_ptr->ifa_addr, buffer); packstr(ifa_ptr->ifa_family, buffer); packstr(ifa_ptr->ifa_name, buffer); } } return SLURM_SUCCESS; }
int switch_p_pack_jobinfo(switch_jobinfo_t *switch_job, Buf buffer, uint16_t protocol_version) { sw_gen_step_info_t *gen_step_info = (sw_gen_step_info_t *) switch_job; sw_gen_node_t *node_ptr; sw_gen_ifa_t *ifa_ptr; int i, j; if (debug_flags & DEBUG_FLAG_SWITCH) info("switch_p_pack_jobinfo() starting"); xassert(gen_step_info); xassert(gen_step_info->magic == SW_GEN_STEP_INFO_MAGIC); pack32(gen_step_info->node_cnt, buffer); for (i = 0; i < gen_step_info->node_cnt; i++) { node_ptr = gen_step_info->node_array[i]; packstr(node_ptr->node_name, buffer); pack16(node_ptr->ifa_cnt, buffer); for (j = 0; j < node_ptr->ifa_cnt; j++) { ifa_ptr = node_ptr->ifa_array[j]; if (debug_flags & DEBUG_FLAG_SWITCH) { info("node=%s name=%s family=%s addr=%s", node_ptr->node_name, ifa_ptr->ifa_name, ifa_ptr->ifa_family, ifa_ptr->ifa_addr); } packstr(ifa_ptr->ifa_addr, buffer); packstr(ifa_ptr->ifa_family, buffer); packstr(ifa_ptr->ifa_name, buffer); } } return SLURM_SUCCESS; }
extern void slurm_persist_pack_rc_msg( persist_rc_msg_t *msg, Buf buffer, uint16_t protocol_version) { packstr(msg->comment, buffer); pack32(msg->rc, buffer); pack16(msg->ret_info, buffer); }
extern int name_unpublish_up(char *name) { Buf buf = NULL, resp_buf = NULL; uint32_t size, tmp_32; int rc; buf = init_buf(1024); pack16((uint16_t)TREE_CMD_NAME_UNPUBLISH, buf); packstr(name, buf); size = get_buf_offset(buf); rc = tree_msg_to_srun_with_resp(size, get_buf_data(buf), &resp_buf); free_buf(buf); if (rc == SLURM_SUCCESS) { safe_unpack32(&tmp_32, resp_buf); rc = (int) tmp_32; } unpack_error: if (resp_buf) free_buf(resp_buf); return rc; }
extern Buf slurm_persist_msg_pack(slurm_persist_conn_t *persist_conn, persist_msg_t *req_msg) { Buf buffer; xassert(persist_conn); if (persist_conn->flags & PERSIST_FLAG_DBD) buffer = pack_slurmdbd_msg((slurmdbd_msg_t *)req_msg, persist_conn->version); else { slurm_msg_t msg; slurm_msg_t_init(&msg); msg.data = req_msg->data; msg.data_size = req_msg->data_size; msg.msg_type = req_msg->msg_type; msg.protocol_version = persist_conn->version; buffer = init_buf(BUF_SIZE); pack16(req_msg->msg_type, buffer); if (pack_msg(&msg, buffer) != SLURM_SUCCESS) { free_buf(buffer); return NULL; } } return buffer; }
static void _pack_roll_usage_msg(dbd_roll_usage_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { pack16(msg->archive_data, buffer); pack_time(msg->end, buffer); pack_time(msg->start, buffer); } }
extern int slurm_ckpt_pack_job(check_jobinfo_t jobinfo, Buf buffer, uint16_t protocol_version) { struct check_job_info *check_ptr = (struct check_job_info *)jobinfo; if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) { pack16(check_ptr->disabled, buffer); pack16(check_ptr->reply_cnt, buffer); pack16(check_ptr->wait_time, buffer); pack32(check_ptr->error_code, buffer); packstr(check_ptr->error_msg, buffer); pack_time(check_ptr->time_stamp, buffer); } return SLURM_SUCCESS; }
/* * _dump_front_end_state - dump state of a specific front_end node to a buffer * IN front_end_ptr - pointer to node for which information is requested * IN/OUT buffer - location to store data, pointers automatically advanced */ static void _dump_front_end_state(front_end_record_t *front_end_ptr, Buf buffer) { packstr (front_end_ptr->name, buffer); pack16 (front_end_ptr->node_state, buffer); packstr (front_end_ptr->reason, buffer); pack_time(front_end_ptr->reason_time, buffer); pack32 (front_end_ptr->reason_uid, buffer); }
static void io_init_msg_pack(struct slurm_io_init_msg *hdr, Buf buffer) { pack16(hdr->version, buffer); pack32(hdr->nodeid, buffer); pack32(hdr->stdout_objs, buffer); pack32(hdr->stderr_objs, buffer); packmem((char *) hdr->cred_signature, (uint32_t) SLURM_IO_KEY_SIZE, buffer); }
/* Given a *uint16_t, it will pack an array of size_val */ void pack16_array(uint16_t * valp, uint32_t size_val, Buf buffer) { uint32_t i = 0; pack32(size_val, buffer); for (i = 0; i < size_val; i++) { pack16(*(valp + i), buffer); } }
extern int slurm_ckpt_pack_job(check_jobinfo_t jobinfo, Buf buffer, uint16_t protocol_version) { uint32_t size; size = 0; if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { pack16(CHECK_NONE, buffer); pack32(size, buffer); } return SLURM_SUCCESS; }
static void _state_write_buf(Buf buffer) { pack16(SLURM_PROTOCOL_VERSION, buffer); pack32(MIN_PORT, buffer); pack32(MAX_PORT, buffer); pthread_mutex_lock(&port_mutex); pack32(last_alloc_port, buffer); pack_bit_str(port_resv, buffer); pthread_mutex_unlock(&port_mutex); }
static void _pack_node_state_msg(dbd_node_state_msg_t *msg, uint16_t rpc_version, Buf buffer) { if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { packstr(msg->hostlist, buffer); packstr(msg->reason, buffer); pack32(msg->reason_uid, buffer); pack16(msg->new_state, buffer); pack_time(msg->event_time, buffer); pack32(msg->state, buffer); packstr(msg->tres_str, buffer); } }
extern int select_nodeinfo_pack(select_nodeinfo_t *nodeinfo, Buf buffer, uint16_t protocol_version) { ListIterator itr; node_subgrp_t *subgrp = NULL; uint16_t count = 0; if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { pack16(nodeinfo->bitmap_size, buffer); packstr(nodeinfo->extra_info, buffer); packstr(nodeinfo->failed_cnodes, buffer); if (nodeinfo->ba_mp) packstr(nodeinfo->ba_mp->loc, buffer); else packstr(nodeinfo->rack_mp, buffer); if (nodeinfo->subgrp_list) count = list_count(nodeinfo->subgrp_list); pack16(count, buffer); if (count > 0) { itr = list_iterator_create(nodeinfo->subgrp_list); while ((subgrp = list_next(itr))) { _pack_node_subgrp(subgrp, buffer, protocol_version); } list_iterator_destroy(itr); } } else { error("select_nodeinfo_pack: protocol_version " "%hu not supported", protocol_version); } return SLURM_SUCCESS; }
/* Return a buffer containing a DBD_RC (return code) message * caller must free returned buffer */ extern Buf make_dbd_rc_msg(uint16_t rpc_version, int rc, char *comment, uint16_t sent_type) { Buf buffer; dbd_rc_msg_t msg; buffer = init_buf(1024); pack16((uint16_t) DBD_RC, buffer); msg.return_code = rc; msg.comment = comment; msg.sent_type = sent_type; slurmdbd_pack_rc_msg(&msg, rpc_version, buffer); return buffer; }
/* * Pack current burst buffer state information for network transmission to * user (e.g. "scontrol show burst") * * Returns a SLURM errno. */ extern int bb_p_state_pack(Buf buffer, uint16_t protocol_version) { struct bb_alloc *bb_next; uint32_t rec_count = 0; int i, eof, offset; pthread_mutex_lock(&bb_mutex); if (debug_flag) info("%s: %s", __func__, plugin_type); packstr((char *)plugin_type, buffer); /* Remove "const" qualifier */ offset = get_buf_offset(buffer); pack32(rec_count, buffer); packstr(allow_users_str, buffer); packstr(deny_users_str, buffer); packstr(get_sys_state, buffer); packstr(start_stage_in, buffer); packstr(start_stage_out, buffer); packstr(stop_stage_in, buffer); packstr(stop_stage_out, buffer); pack32(job_size_limit, buffer); pack32(prio_boost, buffer); pack32(total_space, buffer); pack32(user_size_limit, buffer); if (bb_hash) { for (i = 0; i < BB_HASH_SIZE; i++) { bb_next = bb_hash[i]; while (bb_next) { pack32(bb_next->array_job_id, buffer); pack32(bb_next->array_task_id, buffer); pack32(bb_next->job_id, buffer); packstr(bb_next->name, buffer); pack32(bb_next->size, buffer); pack16(bb_next->state, buffer); pack32(bb_next->user_id, buffer); rec_count++; bb_next = bb_next->next; } } if (rec_count != 0) { eof = get_buf_offset(buffer); set_buf_offset(buffer, offset); pack32(rec_count, buffer); set_buf_offset(buffer, eof); } } info("%s: record_count:%u", __func__, rec_count); pthread_mutex_unlock(&bb_mutex); return SLURM_SUCCESS; }