/* Assume that the slurmd and slurmstepd are the same version level when slurmd * starts slurmstepd, so we do not need to support different protocol versions * for the different message formats. */ extern void pack_slurmd_conf_lite(slurmd_conf_t *conf, Buf buffer) { xassert(conf != NULL); packstr(conf->hostname, buffer); pack16(conf->cpus, buffer); pack16(conf->boards, buffer); pack16(conf->sockets, buffer); pack16(conf->cores, buffer); pack16(conf->threads, buffer); pack32(conf->real_memory_size, buffer); pack16(conf->block_map_size, buffer); pack16_array(conf->block_map, conf->block_map_size, buffer); pack16_array(conf->block_map_inv, conf->block_map_size, buffer); packstr(conf->spooldir, buffer); packstr(conf->node_name, buffer); packstr(conf->logfile, buffer); packstr(conf->task_prolog, buffer); packstr(conf->task_epilog, buffer); packstr(conf->job_acct_gather_freq, buffer); packstr(conf->job_acct_gather_type, buffer); pack16(conf->propagate_prio, buffer); pack32(conf->debug_flags, buffer); pack32(conf->debug_level, buffer); pack32(conf->daemonize, buffer); pack32((uint32_t)conf->slurm_user_id, buffer); pack16(conf->use_pam, buffer); pack16(conf->task_plugin_param, buffer); packstr(conf->node_topo_addr, buffer); packstr(conf->node_topo_pattern, buffer); pack32((uint32_t)conf->port, buffer); pack16(conf->log_fmt, buffer); pack16(conf->mem_limit_enforce, buffer); }
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); } }