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 void pack_job_resources(job_resources_t *job_resrcs_ptr, Buf buffer, uint16_t protocol_version) { uint32_t cluster_flags = slurmdb_setup_cluster_flags(); if (protocol_version >= SLURM_2_5_PROTOCOL_VERSION) { if (job_resrcs_ptr == NULL) { uint32_t empty = NO_VAL; pack32(empty, buffer); return; } pack32(job_resrcs_ptr->nhosts, buffer); pack32(job_resrcs_ptr->ncpus, buffer); pack32(job_resrcs_ptr->node_req, buffer); packstr(job_resrcs_ptr->nodes, buffer); if (job_resrcs_ptr->cpu_array_reps) pack32_array(job_resrcs_ptr->cpu_array_reps, job_resrcs_ptr->cpu_array_cnt, buffer); else pack32_array(job_resrcs_ptr->cpu_array_reps, 0, buffer); if (job_resrcs_ptr->cpu_array_value) pack16_array(job_resrcs_ptr->cpu_array_value, job_resrcs_ptr->cpu_array_cnt, buffer); else pack16_array(job_resrcs_ptr->cpu_array_value, 0, buffer); if (job_resrcs_ptr->cpus) pack16_array(job_resrcs_ptr->cpus, job_resrcs_ptr->nhosts, buffer); else pack16_array(job_resrcs_ptr->cpus, 0, buffer); if (job_resrcs_ptr->cpus_used) pack16_array(job_resrcs_ptr->cpus_used, job_resrcs_ptr->nhosts, buffer); else pack16_array(job_resrcs_ptr->cpus_used, 0, buffer); if (job_resrcs_ptr->memory_allocated) pack32_array(job_resrcs_ptr->memory_allocated, job_resrcs_ptr->nhosts, buffer); else pack32_array(job_resrcs_ptr->memory_allocated, 0, buffer); if (job_resrcs_ptr->memory_used) pack32_array(job_resrcs_ptr->memory_used, job_resrcs_ptr->nhosts, buffer); else pack32_array(job_resrcs_ptr->memory_used, 0, buffer); if (!(cluster_flags & CLUSTER_FLAG_BG)) { int i; uint32_t core_cnt = 0, sock_recs = 0; xassert(job_resrcs_ptr->cores_per_socket); xassert(job_resrcs_ptr->sock_core_rep_count); xassert(job_resrcs_ptr->sockets_per_node); for (i=0; i<job_resrcs_ptr->nhosts; i++) { core_cnt += job_resrcs_ptr->sockets_per_node[i] * job_resrcs_ptr->cores_per_socket[i] * job_resrcs_ptr->sock_core_rep_count[i]; sock_recs += job_resrcs_ptr-> sock_core_rep_count[i]; if (sock_recs >= job_resrcs_ptr->nhosts) break; } i++; pack16_array(job_resrcs_ptr->sockets_per_node, (uint32_t) i, buffer); pack16_array(job_resrcs_ptr->cores_per_socket, (uint32_t) i, buffer); pack32_array(job_resrcs_ptr->sock_core_rep_count, (uint32_t) i, buffer); xassert(job_resrcs_ptr->core_bitmap); xassert(job_resrcs_ptr->core_bitmap_used); pack_bit_str(job_resrcs_ptr->core_bitmap, buffer); pack_bit_str(job_resrcs_ptr->core_bitmap_used, buffer); } } else if (protocol_version >= SLURM_2_3_PROTOCOL_VERSION) { uint8_t tmp_8; if (job_resrcs_ptr == NULL) { uint32_t empty = NO_VAL; pack32(empty, buffer); return; } pack32(job_resrcs_ptr->nhosts, buffer); pack32(job_resrcs_ptr->ncpus, buffer); tmp_8 = job_resrcs_ptr->node_req; /* 32-bit in v2.5 */ pack8(tmp_8, buffer); packstr(job_resrcs_ptr->nodes, buffer); if (job_resrcs_ptr->cpu_array_reps) pack32_array(job_resrcs_ptr->cpu_array_reps, job_resrcs_ptr->cpu_array_cnt, buffer); else pack32_array(job_resrcs_ptr->cpu_array_reps, 0, buffer); if (job_resrcs_ptr->cpu_array_value) pack16_array(job_resrcs_ptr->cpu_array_value, job_resrcs_ptr->cpu_array_cnt, buffer); else pack16_array(job_resrcs_ptr->cpu_array_value, 0, buffer); if (job_resrcs_ptr->cpus) pack16_array(job_resrcs_ptr->cpus, job_resrcs_ptr->nhosts, buffer); else pack16_array(job_resrcs_ptr->cpus, 0, buffer); if (job_resrcs_ptr->cpus_used) pack16_array(job_resrcs_ptr->cpus_used, job_resrcs_ptr->nhosts, buffer); else pack16_array(job_resrcs_ptr->cpus_used, 0, buffer); if (job_resrcs_ptr->memory_allocated) pack32_array(job_resrcs_ptr->memory_allocated, job_resrcs_ptr->nhosts, buffer); else pack32_array(job_resrcs_ptr->memory_allocated, 0, buffer); if (job_resrcs_ptr->memory_used) pack32_array(job_resrcs_ptr->memory_used, job_resrcs_ptr->nhosts, buffer); else pack32_array(job_resrcs_ptr->memory_used, 0, buffer); if (!(cluster_flags & CLUSTER_FLAG_BG)) { int i; uint32_t core_cnt = 0, sock_recs = 0; xassert(job_resrcs_ptr->cores_per_socket); xassert(job_resrcs_ptr->sock_core_rep_count); xassert(job_resrcs_ptr->sockets_per_node); for (i=0; i<job_resrcs_ptr->nhosts; i++) { core_cnt += job_resrcs_ptr->sockets_per_node[i] * job_resrcs_ptr->cores_per_socket[i] * job_resrcs_ptr->sock_core_rep_count[i]; sock_recs += job_resrcs_ptr-> sock_core_rep_count[i]; if (sock_recs >= job_resrcs_ptr->nhosts) break; } i++; pack16_array(job_resrcs_ptr->sockets_per_node, (uint32_t) i, buffer); pack16_array(job_resrcs_ptr->cores_per_socket, (uint32_t) i, buffer); pack32_array(job_resrcs_ptr->sock_core_rep_count, (uint32_t) i, buffer); xassert(job_resrcs_ptr->core_bitmap); xassert(job_resrcs_ptr->core_bitmap_used); pack_bit_str(job_resrcs_ptr->core_bitmap, buffer); pack_bit_str(job_resrcs_ptr->core_bitmap_used, buffer); } } else { error("pack_job_resources: protocol_version %hu not supported", protocol_version); } }