| .TH "Slurm API" "3" "January 2006" "Morris Jette" "Slurm node informational calls" |
| .SH "NAME" |
| slurm_free_node_info, slurm_load_node, |
| slurm_print_node_info_msg, slurm_print_node_table, slurm_sprint_node_table |
| \- Slurm node information reporting functions |
| .SH "SYNTAX" |
| .LP |
| #include <stdio.h> |
| .br |
| #include <slurm/slurm.h> |
| .LP |
| void \fBslurm_free_node_info\fR ( |
| .br |
| node_info_msg_t *\fInode_info_msg_ptr\fP |
| .br |
| ); |
| .LP |
| int \fBslurm_load_node\fR ( |
| .br |
| time_t \fIupdate_time\fP, |
| .br |
| node_info_msg_t **\fInode_info_msg_pptr\fP, |
| .br |
| uint16_t \fIshow_flags\fP |
| .br |
| ); |
| .LP |
| void \fBslurm_print_node_info_msg\fR ( |
| .br |
| FILE *\fIout_file\fp, |
| .br |
| node_info_msg_t *\fInode_info_msg_ptr\fP, |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .LP |
| void \fBslurm_print_node_table\fR ( |
| .br |
| FILE *\fIout_file\fp, |
| .br |
| node_info_t *\fInode_ptr\fP, |
| .br |
| int \fInode_scaling\fP |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .LP |
| char *\fBslurm_sprint_node_table\fR ( |
| .br |
| node_info_t *\fInode_ptr\fP, |
| .br |
| int \fInode_scaling\fP |
| .br |
| int \fIone_liner\fP |
| .br |
| ); |
| .SH "ARGUMENTS" |
| .LP |
| .TP |
| \fInode_info_msg_ptr\fP |
| Specifies the pointer to the structure created by \fBslurm_load_node\fR. |
| .TP |
| \fInode_info_msg_pptr\fP |
| Specifies the double pointer to the structure to be created and filled with |
| the time of the last node update, a record count, and detailed information |
| about each node. Detailed node information is written to fixed sized records |
| and includes: name, state, processor count, memory size, etc. See slurm.h for |
| full details on the data structure's contents. |
| .TP |
| \fInode_info_msg_ptr\fP |
| Specifies the pointer to the structure created by \fBslurm_load_node\fR. |
| .TP |
| \fInode_ptr\fP |
| Specifies a pointer to a single node records from the \fInode_info_msg_ptr\fP |
| data structure. |
| .TP |
| \fInode_scaling\fP |
| number of nodes each node represents default is 1. |
| .TP |
| \fIone_liner\fP |
| Print one record per line if non\-zero. |
| .TP |
| \fIout_file\fP |
| Specifies the file to print data to. |
| .TP |
| \fIshow_flags\fP |
| Job filtering flags, may be ORed. |
| Information about nodes in partitions that are configured as |
| hidden and partitions that the user's group is unable to utilize |
| are not reported by default. |
| The \fBSHOW_ALL\fP flag will cause information about nodes in all |
| partitions to be displayed. |
| |
| .TP |
| \fIupdate_time\fP |
| For all of the following informational calls, if update_time is equal to |
| or greater than the last time changes where made to that information, new |
| information is not returned. Otherwise all the configuration. job, node, |
| or partition records are returned. |
| .SH "DESCRIPTION" |
| .LP |
| \fBslurm_free_node_info\fR Release the storage generated by the |
| \fBslurm_load_node\fR function. |
| .LP |
| \fBslurm_load_node\fR Returns a \fInode_info_msg_t\fP that contains an update |
| time, record count, and array of node_table records for all nodes. |
| .LP |
| \fBslurm_print_node_info_msg\fR Prints the contents of the data structure |
| describing all node records from the data loaded by the \fBslurm_load_node\fR |
| function. |
| .LP |
| \fBslurm_print_node_table\fR Prints the contents of the data structure |
| describing a single node record loaded by the \fBslurm_load_node\fR function. |
| .SH "RETURN VALUE" |
| .LP |
| On success, zero is returned. On error, \-1 is returned, and Slurm error code |
| is set appropriately. |
| .SH "ERRORS" |
| .LP |
| \fBSLURM_NO_CHANGE_IN_DATA\fR Data has not changed since \fBupdate_time\fR. |
| .LP |
| \fBSLURM_PROTOCOL_VERSION_ERROR\fR Protocol version has changed, re\-link |
| your code. |
| .LP |
| \fBSLURM_PROTOCOL_SOCKET_IMPL_TIMEOUT\fR Timeout in communicating with |
| SLURM controller. |
| .SH "EXAMPLE" |
| .LP |
| #include <stdio.h> |
| .br |
| #include <slurm/slurm.h> |
| .br |
| #include <slurm/slurm_errno.h> |
| .LP |
| int main (int argc, char *argv[]) |
| .br |
| { |
| .br |
| int i, j, k; |
| .br |
| partition_info_msg_t *part_info_ptr = NULL; |
| .br |
| partition_info_t *part_ptr; |
| .br |
| node_info_msg_t *node_info_ptr = NULL; |
| .br |
| node_info_t *node_ptr; |
| .LP |
| /* get and dump some node information */ |
| .br |
| if ( slurm_load_node ((time_t) NULL, |
| .br |
| &node_buffer_ptr, SHOW_ALL) ) { |
| .br |
| slurm_perror ("slurm_load_node error"); |
| .br |
| exit (1); |
| .br |
| } |
| .LP |
| /* The easy way to print... */ |
| .br |
| slurm_print_node_info_msg (stdout, node_buffer_ptr); |
| .LP |
| /* A harder way.. */ |
| .br |
| for (i = 0; i < node_buffer_ptr\->record_count; i++) { |
| .br |
| node_ptr = &node_buffer_ptr\->node_array[i]; |
| .br |
| slurm_print_job_info(stdout, node_ptr); |
| .br |
| } |
| .LP |
| /* The hardest way. */ |
| .br |
| for (i = 0; i < node_buffer_ptr\->node_count; i++) { |
| .br |
| printf ("NodeName=%s CPUs=%u\\n", |
| .br |
| node_buffer_ptr\->node_array[i].name, |
| .br |
| node_buffer_ptr\->node_array[i].cpus); |
| .br |
| } |
| .LP |
| /* get and dump some partition information */ |
| .br |
| /* note that we use the node information loaded */ |
| .br |
| /* above and we assume the node table entries have */ |
| .br |
| /* not changed since */ |
| .br |
| if ( slurm_load_partitions ((time_t) NULL, |
| .br |
| &part_buffer_ptr) ) { |
| .br |
| slurm_perror ("slurm_load_partitions error"); |
| .br |
| exit (1); |
| .br |
| } |
| .br |
| for (i = 0; i < part_buffer_ptr\->record_count; i++) { |
| .br |
| part_ptr = &part_info_ptr\->partition_array[i]; |
| .br |
| printf ("PartitionName=%s Nodes=", |
| .br |
| part_ptr\->name); |
| .br |
| for (j = 0; part_ptr\->node_inx; j+=2) { |
| .br |
| if (part_ptr\->node_inx[j] == \-1) |
| .br |
| break; |
| .br |
| for (k = part_ptr\->node_inx[j]; |
| .br |
| k <= part_ptr\->node_inx[j+1]; |
| .br |
| k++) { |
| .br |
| printf ("%s ", node_buffer_ptr\-> |
| .br |
| node_array[k].name); |
| .br |
| } |
| .br |
| } |
| .br |
| printf("\\n\\n"); |
| .br |
| } |
| .br |
| slurm_free_node_info (node_buffer_ptr); |
| .br |
| slurm_free_partition_info (part_buffer_ptr); |
| .br |
| exit (0); |
| .br |
| } |
| |
| .SH "NOTES" |
| These functions are included in the libslurm library, |
| which must be linked to your process for use |
| (e.g. "cc \-lslurm myprog.c"). |
| .LP |
| Some data structures contain index values to cross\-reference each other. |
| If the \fIshow_flags\fP argument is not set to SHOW_ALL when getting this |
| data, these index values will be invalid. |
| |
| .SH "COPYING" |
| Copyright (C) 2002\-2006 The Regents of the University of California. |
| Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). |
| CODE\-OCEC\-09\-009. All rights reserved. |
| .LP |
| This file is part of SLURM, a resource management program. |
| For details, see <https://computing.llnl.gov/linux/slurm/>. |
| .LP |
| SLURM is free software; you can redistribute it and/or modify it under |
| the terms of the GNU General Public License as published by the Free |
| Software Foundation; either version 2 of the License, or (at your option) |
| any later version. |
| .LP |
| SLURM is distributed in the hope that it will be useful, but WITHOUT ANY |
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| details. |
| .SH "SEE ALSO" |
| .LP |
| \fBscontrol\fR(1), \fBsqueue\fR(1), \fBslurm_allocation_lookup\fR(3), |
| \fBslurm_get_errno\fR(3), \fBslurm_load_partitions\fR(3), |
| \fBslurm_perror\fR(3), \fBslurm_strerror\fR(3) |
| |