/
slurm.h.in
3624 lines (3264 loc) · 142 KB
/
slurm.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************\
* slurm.h - Definitions for all of the SLURM RPCs
*****************************************************************************
* Copyright (C) 2002-2007 The Regents of the University of California.
* Copyright (C) 2008-2010 Lawrence Livermore National Security.
* Portions Copyright (C) 2010 SchedMD <http://www.schedmd.com>.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Morris Jette <jette1@llnl.gov>, et. al.
* CODE-OCEC-09-009. All rights reserved.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.schedmd.com/slurmdocs/>.
* Please also read the included file: DISCLAIMER.
*
* 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.
*
* In addition, as a special exception, the copyright holders give permission
* to link the code of portions of this program with the OpenSSL library under
* certain conditions as described in each individual source file, and
* distribute linked combinations including the two. You must obey the GNU
* General Public License in all respects for all of the code used other than
* OpenSSL. If you modify file(s) with this exception, you may extend this
* exception to your version of the file(s), but you are not obligated to do
* so. If you do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source files in
* the program, then also delete it here.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\*****************************************************************************/
#ifndef _SLURM_H
#define _SLURM_H
/* BEGIN_C_DECLS should be used at the beginning of your declarations,
so that C++ compilers don't mangle their names. Use END_C_DECLS at
the end of C declarations. */
#undef BEGIN_C_DECLS
#undef END_C_DECLS
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS }
#else
# define BEGIN_C_DECLS /* empty */
# define END_C_DECLS /* empty */
#endif
/* PARAMS is a macro used to wrap function prototypes, so that compilers
that don't understand ANSI C prototypes still work, and ANSI C
compilers can issue warnings about type mismatches. */
#undef PARAMS
#if defined (__STDC__) || defined (_AIX) \
|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
|| defined(WIN32) || defined(__cplusplus)
# define PARAMS(protos) protos
#else
# define PARAMS(protos) ()
#endif
/* Define to 1 if you have Blue Gene system support. */
#undef HAVE_BG
/* Define to 1 if emulating or running on Blue Gene/L system */
#undef HAVE_BGL
/* Define to 1 if emulating or running on Blue Gene/P system */
#undef HAVE_BGP
/* Define to 1 if emulating or running on Blue Gene/L-P system */
#undef HAVE_BG_L_P
/* Define to 1 if emulating or running on Blue Gene/Q system */
#undef HAVE_BGQ
/* Number of dimensions the system has */
#define SYSTEM_DIMENSIONS 1
#define HIGHEST_DIMENSIONS 5
/* Define to 1 if you have the `elan3' library (-lelan3). */
#undef HAVE_ELAN
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Default value for job's --wait-all-nodes option */
#ifndef DEFAULT_WAIT_ALL_NODES
#define DEFAULT_WAIT_ALL_NODES 0 /* don't wait */
#endif
BEGIN_C_DECLS
#include <slurm/slurm_errno.h>
#if HAVE_STDINT_H
# include <stdint.h> /* for uint16_t, uint32_t definitions */
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h> /* for uint16_t, uint32_t definitions */
#endif
#include <stdbool.h>
#include <stdio.h> /* for FILE definitions */
#include <sys/types.h> /* for uid_t definition */
#include <time.h> /* for time_t definitions */
#include <unistd.h>
#ifdef CRAPPY_COMPILER
/*
* 'bool' can be implemented in a variety of ways.
* C++ may define it one way.
* <stdbool.h> may declare 'bool' to be a different type, such as
* an enum which is not necessarily compatible with C++.
*
* If your compiler can't resolve 'bool', just define
* CRAPPY_COMPILER at build time in order for SLURM to
* define it's own version of bool.
*/
#undef TRUE
#define TRUE 1
#undef FALSE
#define FALSE 0
typedef unsigned char SLURM_BOOL;
#undef bool
#define bool SLURM_BOOL
#endif
/* Define slurm_addr_t below to avoid including extraneous slurm headers */
#ifdef HAVE_SYS_SOCKET_H
# ifndef __slurm_addr_t_defined
# include <netinet/in.h>
# define __slurm_addr_t_defined
typedef struct sockaddr_in slurm_addr_t;
# endif
#endif
/* Just incase we don't have a c99 compatible system. This should be
* defined in inttypes.h.
*/
#ifndef PRIu64
# define PRIu64 "llu"
#endif
#ifndef __slurm_cred_t_defined
# define __slurm_cred_t_defined
typedef struct slurm_job_credential slurm_cred_t;
#endif
/* Define switch_jobinfo_t below to avoid including extraneous slurm headers */
#ifndef __switch_jobinfo_t_defined
# define __switch_jobinfo_t_defined
typedef struct switch_jobinfo switch_jobinfo_t; /* opaque data type */
#endif
/* Define job_resources_t below
* to avoid including extraneous slurm headers */
#ifndef __job_resources_t_defined
# define __job_resources_t_defined /* Opaque data for select plugins */
typedef struct job_resources job_resources_t;
#endif
/* Define select_jobinfo_t, select_nodeinfo_t below
* to avoid including extraneous slurm headers */
#ifndef __select_jobinfo_t_defined
# define __select_jobinfo_t_defined /* Opaque data for select plugins */
typedef struct select_jobinfo select_jobinfo_t; /* for BlueGene */
typedef struct select_nodeinfo select_nodeinfo_t; /* for BlueGene */
#endif
/* Define jobacctinfo_t below to avoid including extraneous slurm headers */
#ifndef __jobacctinfo_t_defined
# define __jobacctinfo_t_defined
typedef struct jobacctinfo jobacctinfo_t; /* opaque data type */
#endif
/* Define allocation_msg_thread_t below to avoid including extraneous
* slurm headers */
#ifndef __allocation_msg_thread_t_defined
# define __allocation_msg_thread_t_defined
typedef struct allocation_msg_thread allocation_msg_thread_t;
#endif
#ifndef __sbcast_cred_t_defined
# define __sbcast_cred_t_defined
typedef struct sbcast_cred sbcast_cred_t; /* opaque data type */
#endif
/*****************************************************************************\
* DEFINITIONS FOR VERSION MANAGEMENT
\*****************************************************************************/
/* Define SLURM version number.
* High-order byte is major version.
* Middle byte is minor version.
* Low-order byte is micro version (NOTE: excludes "-pre#" component
# of micro version used in pre-releases).
* Use SLURM_VERSION_NUM macro to compare versions, for example
* #if SLURM_VERSION_NUMBER > SLURM_VERSION_NUM(2,1,0)
*/
#undef SLURM_VERSION_NUMBER
#define SLURM_VERSION_NUM(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define SLURM_VERSION_MAJOR(a) (((a) >> 16) & 0xff)
#define SLURM_VERSION_MINOR(a) (((a) >> 8) & 0xff)
#define SLURM_VERSION_MICRO(a) ((a) & 0xff)
/*****************************************************************************\
* DEFINITIONS FOR INPUT VALUES
\*****************************************************************************/
/* INFINITE is used to identify unlimited configurations, */
/* eg. the maximum count of nodes any job may use in some partition */
#define INFINITE (0xffffffff)
#define NO_VAL (0xfffffffe)
#define MAX_TASKS_PER_NODE 128
/* Job step ID of batch scripts */
#define SLURM_BATCH_SCRIPT (0xfffffffe)
/* last entry must be JOB_END, keep in sync with job_state_string and
* job_state_string_compact. values may be ORed with JOB_STATE_FLAGS
* below. */
enum job_states {
JOB_PENDING, /* queued waiting for initiation */
JOB_RUNNING, /* allocated resources and executing */
JOB_SUSPENDED, /* allocated resources, execution suspended */
JOB_COMPLETE, /* completed execution successfully */
JOB_CANCELLED, /* cancelled by user */
JOB_FAILED, /* completed execution unsuccessfully */
JOB_TIMEOUT, /* terminated on reaching time limit */
JOB_NODE_FAIL, /* terminated on node failure */
JOB_PREEMPTED, /* terminated due to preemption */
JOB_END /* not a real state, last entry in table */
};
#define JOB_STATE_BASE 0x00ff /* Used for job_states above */
#define JOB_STATE_FLAGS 0xff00 /* Used for state flags below */
#define JOB_COMPLETING 0x8000 /* Waiting for epilog completion */
#define JOB_CONFIGURING 0x4000 /* Allocated nodes booting */
#define JOB_RESIZING 0x2000 /* Size of job about to change, flag set
* before calling accounting functions
* immediately before job changes size */
#define READY_JOB_FATAL -2 /* fatal error */
#define READY_JOB_ERROR -1 /* ordinary error */
#define READY_NODE_STATE 0x01 /* node is ready */
#define READY_JOB_STATE 0x02 /* job is ready to execute */
#define MAIL_JOB_BEGIN 0x0001 /* notify when job begins */
#define MAIL_JOB_END 0x0002 /* notify when job ends */
#define MAIL_JOB_FAIL 0x0004 /* notify if job fails */
#define MAIL_JOB_REQUEUE 0x0008 /* notify if job requeued */
#define NICE_OFFSET 10000 /* offset for job's nice value */
/* Reason for job to be pending rather than executing or reason for job
* failure. If multiple reasons exists, only one is given for the sake of
* system efficiency */
enum job_state_reason {
/* Reasons for job to be pending */
WAIT_NO_REASON = 0, /* not set or job not pending */
WAIT_PRIORITY, /* higher priority jobs exist */
WAIT_DEPENDENCY, /* dependent job has not completed */
WAIT_RESOURCES, /* required resources not available */
WAIT_PART_NODE_LIMIT, /* request exceeds partition node limit */
WAIT_PART_TIME_LIMIT, /* request exceeds partition time limit */
WAIT_PART_DOWN, /* requested partition is down */
WAIT_PART_INACTIVE, /* requested partition is inactive */
WAIT_HELD, /* job is held by administrator */
WAIT_TIME, /* job waiting for specific begin time */
WAIT_LICENSES, /* job is waiting for licenses */
WAIT_ASSOC_JOB_LIMIT, /* user/bank job limit reached */
WAIT_ASSOC_RESOURCE_LIMIT,/* user/bank resource limit reached */
WAIT_ASSOC_TIME_LIMIT, /* user/bank time limit reached */
WAIT_RESERVATION, /* reservation not available */
WAIT_NODE_NOT_AVAIL, /* required node is DOWN or DRAINED */
WAIT_HELD_USER, /* job is held by user */
WAIT_FRONT_END, /* Front end nodes are DOWN */
FAIL_DOWN_PARTITION, /* partition for job is DOWN */
FAIL_DOWN_NODE, /* some node in the allocation failed */
FAIL_BAD_CONSTRAINTS, /* constraints can not be satisfied */
FAIL_SYSTEM, /* slurm system failure */
FAIL_LAUNCH, /* unable to launch job */
FAIL_EXIT_CODE, /* exit code was non-zero */
FAIL_TIMEOUT, /* reached end of time limit */
FAIL_INACTIVE_LIMIT, /* reached slurm InactiveLimit */
FAIL_ACCOUNT, /* invalid account */
FAIL_QOS, /* invalid QOS */
WAIT_QOS_THRES, /* required QOS threshold has been breached */
WAIT_QOS_JOB_LIMIT, /* QOS job limit reached */
WAIT_QOS_RESOURCE_LIMIT,/* QOS resource limit reached */
WAIT_QOS_TIME_LIMIT /* QOS time limit reached */
};
enum job_acct_types {
JOB_START,
JOB_STEP,
JOB_SUSPEND,
JOB_TERMINATED
};
/* Partition state flags */
#define PARTITION_SUBMIT 0x01 /* Allow job submission to partition */
#define PARTITION_SCHED 0x02 /* Allow job startup from partition */
/* Actual partition states based upon state flags */
#define PARTITION_DOWN (PARTITION_SUBMIT)
#define PARTITION_UP (PARTITION_SUBMIT | PARTITION_SCHED)
#define PARTITION_DRAIN (PARTITION_SCHED)
#define PARTITION_INACTIVE 0x00
enum connection_type {
SELECT_MESH, /* nodes wired in mesh */
SELECT_TORUS, /* nodes wired in torus */
SELECT_NAV, /* nodes wired in torus else mesh */
SELECT_SMALL, /* nodes in a small partition */
SELECT_HTC_S, /* nodes in a htc running SMP mode */
SELECT_HTC_D, /* nodes in a htc running Dual mode */
SELECT_HTC_V, /* nodes in a htc running VN mode */
SELECT_HTC_L /* nodes in a htc running in Linux mode */
};
enum node_use_type {
SELECT_COPROCESSOR_MODE,/* use extra processor for communications */
SELECT_VIRTUAL_NODE_MODE,/* application uses both processors */
SELECT_NAV_MODE /* either mode is acceptable */
};
enum select_jobdata_type {
SELECT_JOBDATA_GEOMETRY,/* data-> uint16_t geometry[SYSTEM_DIMENSIONS] */
SELECT_JOBDATA_ROTATE, /* data-> uint16_t rotate */
SELECT_JOBDATA_CONN_TYPE, /* data-> uint16_t connection_type */
SELECT_JOBDATA_BLOCK_ID, /* data-> char *bg_block_id */
SELECT_JOBDATA_NODES, /* data-> char *nodes */
SELECT_JOBDATA_IONODES, /* data-> char *ionodes */
SELECT_JOBDATA_NODE_CNT, /* data-> uint32_t cnode_cnt */
SELECT_JOBDATA_ALTERED, /* data-> uint16_t altered */
SELECT_JOBDATA_BLRTS_IMAGE,/* data-> char *blrtsimage */
SELECT_JOBDATA_LINUX_IMAGE,/* data-> char *linuximage */
SELECT_JOBDATA_MLOADER_IMAGE,/* data-> char *mloaderimage */
SELECT_JOBDATA_RAMDISK_IMAGE,/* data-> char *ramdiskimage */
SELECT_JOBDATA_REBOOT, /* data-> uint16_t reboot */
SELECT_JOBDATA_RESV_ID, /* data-> uint32_t reservation_id */
SELECT_JOBDATA_PAGG_ID, /* data-> uint64_t job container ID */
SELECT_JOBDATA_PTR, /* data-> select_jobinfo_t *jobinfo */
SELECT_JOBDATA_BLOCK_PTR, /* data-> bg_record_t *bg_record */
SELECT_JOBDATA_DIM_CNT, /* data-> uint16_t dim_cnt */
SELECT_JOBDATA_BLOCK_NODE_CNT, /* data-> uint32_t block_cnode_cnt */
SELECT_JOBDATA_START_LOC, /* data-> uint16_t
* start_loc[SYSTEM_DIMENSIONS] */
SELECT_JOBDATA_USER_NAME, /* data-> char * user_name */
SELECT_JOBDATA_CONFIRMED, /* data-> uint8_t ALPS reservation confirmed */
};
enum select_nodedata_type {
SELECT_NODEDATA_BITMAP_SIZE, /* data-> uint16_t */
SELECT_NODEDATA_SUBGRP_SIZE, /* data-> uint16_t */
SELECT_NODEDATA_SUBCNT, /* data-> uint16_t */
SELECT_NODEDATA_BITMAP, /* data-> bitstr_t * needs to be
* freed with FREE_NULL_BITMAP */
SELECT_NODEDATA_STR, /* data-> char * needs to be
* freed with xfree */
SELECT_NODEDATA_PTR, /* data-> select_nodeinfo_t *nodeinfo */
SELECT_NODEDATA_EXTRA_INFO, /* data-> char * needs to be
* freed with xfree */
SELECT_NODEDATA_RACK_MP, /* data-> char * needs to be
* freed with xfree */
};
enum select_print_mode {
SELECT_PRINT_HEAD, /* Print just the header */
SELECT_PRINT_DATA, /* Print just the data */
SELECT_PRINT_MIXED, /* Print "field=value" */
SELECT_PRINT_MIXED_SHORT,/* Print less "field=value" */
SELECT_PRINT_BG_ID, /* Print just the BG_ID */
SELECT_PRINT_NODES, /* Print the nodelist */
SELECT_PRINT_CONNECTION,/* Print just the CONNECTION type */
SELECT_PRINT_ROTATE, /* Print just the ROTATE */
SELECT_PRINT_GEOMETRY, /* Print just the GEO */
SELECT_PRINT_START, /* Print just the START location */
SELECT_PRINT_BLRTS_IMAGE,/* Print just the BLRTS IMAGE */
SELECT_PRINT_LINUX_IMAGE,/* Print just the LINUX IMAGE */
SELECT_PRINT_MLOADER_IMAGE,/* Print just the MLOADER IMAGE */
SELECT_PRINT_RAMDISK_IMAGE,/* Print just the RAMDISK IMAGE */
SELECT_PRINT_REBOOT, /* Print just the REBOOT */
SELECT_PRINT_RESV_ID, /* Print just Cray/BASIL reservation ID */
SELECT_PRINT_START_LOC, /* Print just the start location */
};
enum select_node_cnt {
SELECT_GET_NODE_SCALING, /* Give scaling factor for node count */
SELECT_GET_NODE_CPU_CNT, /* Give how many cpus are on a node */
SELECT_GET_MP_CPU_CNT, /* Give how many cpus are on a
* base partition */
SELECT_APPLY_NODE_MIN_OFFSET, /* Apply min offset to variable */
SELECT_APPLY_NODE_MAX_OFFSET, /* Apply max offset to variable */
SELECT_SET_NODE_CNT, /* Set altered node cnt */
SELECT_SET_MP_CNT /* Given a node cnt return the
* base partition count */
};
/* jobacct data types */
enum jobacct_data_type {
JOBACCT_DATA_TOTAL, /* data-> jobacctinfo_t * */
JOBACCT_DATA_PIPE, /* data-> file descriptor */
JOBACCT_DATA_RUSAGE, /* data-> rusage set user_cpu_sec,
* user_cpu_usec, sys_cpu_sec, sys_cpu_usec */
JOBACCT_DATA_MAX_VSIZE, /* data-> uint32_t vsize */
JOBACCT_DATA_MAX_VSIZE_ID, /* data-> jobacct_id_t vsize */
JOBACCT_DATA_TOT_VSIZE, /* data-> uint32_t vsize */
JOBACCT_DATA_MAX_RSS, /* data-> uint32_t psize */
JOBACCT_DATA_MAX_RSS_ID, /* data-> jobacct_id_t psize */
JOBACCT_DATA_TOT_RSS, /* data-> uint32_t psize */
JOBACCT_DATA_MAX_PAGES, /* data-> uint32_t psize */
JOBACCT_DATA_MAX_PAGES_ID, /* data-> jobacct_id_t psize */
JOBACCT_DATA_TOT_PAGES, /* data-> uint32_t psize */
JOBACCT_DATA_MIN_CPU, /* data-> uint32_t psize */
JOBACCT_DATA_MIN_CPU_ID, /* data-> jobacct_id_t psize */
JOBACCT_DATA_TOT_CPU, /* data-> uint32_t psize */
JOBACCT_DATA_ACT_CPUFREQ, /* data-> uint32_t psize hb*/
JOBACCT_DATA_CONSUMED_ENERGY /* data-> uint32_t psize hb*/
};
enum acct_energy_type {
ENERGY_DATA_JOULES_TASK,
ENERGY_DATA_STRUCT,
ENERGY_DATA_RECONFIG,
};
/* Possible task distributions across the nodes */
typedef enum task_dist_states {
/* NOTE: start SLURM_DIST_CYCLIC at 1 for HP MPI */
SLURM_DIST_CYCLIC = 1, /* distribute tasks 1 per node, round robin */
SLURM_DIST_BLOCK, /* distribute tasks filling node by node */
SLURM_DIST_ARBITRARY, /* arbitrary task distribution */
SLURM_DIST_PLANE, /* distribute tasks by filling up
planes of lllp first and then by
going across the nodes See
documentation for more
information */
SLURM_DIST_CYCLIC_CYCLIC,/* distribute tasks 1 per node,
round robin, same for lowest
level of logical processor (lllp) */
SLURM_DIST_CYCLIC_BLOCK, /* cyclic for node and block for lllp */
SLURM_DIST_BLOCK_CYCLIC, /* block for node and cyclic for lllp */
SLURM_DIST_BLOCK_BLOCK, /* block for node and block for lllp */
SLURM_NO_LLLP_DIST, /* No distribution specified for lllp */
SLURM_DIST_UNKNOWN /* unknown dist */
} task_dist_states_t;
/* Open stdout/err file mode, 0 for system default (JobFileAppend) */
#define OPEN_MODE_APPEND 1
#define OPEN_MODE_TRUNCATE 2
typedef enum cpu_bind_type { /* cpu binding type from --cpu_bind=... */
/* verbose can be set with any other flag */
CPU_BIND_VERBOSE = 0x01, /* =v, */
/* the following auto-binding flags are mutually exclusive */
CPU_BIND_TO_THREADS= 0x02, /* =threads */
CPU_BIND_TO_CORES = 0x04, /* =cores */
CPU_BIND_TO_SOCKETS= 0x08, /* =sockets */
CPU_BIND_TO_LDOMS = 0x10, /* locality domains */
CPU_BIND_TO_BOARDS = 0x1000, /* =boards */
/* the following manual binding flags are mutually exclusive */
/* CPU_BIND_NONE needs to be the lowest value among manual bindings */
CPU_BIND_NONE = 0x20, /* =no */
CPU_BIND_RANK = 0x40, /* =rank */
CPU_BIND_MAP = 0x80, /* =map_cpu:<list of CPU IDs> */
CPU_BIND_MASK = 0x100,/* =mask_cpu:<list of CPU masks> */
CPU_BIND_LDRANK = 0x200,/* =locality domain rank */
CPU_BIND_LDMAP = 0x400,/* =map_ldom:<list of locality domains> */
CPU_BIND_LDMASK = 0x800,/* =mask_ldom:<list of ldom masks> */
/* the following is used only as a flag for expressing
* the contents of TaskPluginParams */
CPU_BIND_CPUSETS = 0x8000
} cpu_bind_type_t;
/* Flag to indicate that cpu_freq is a range: low,medium,high
* instead of an integer value in kilohertz */
#define CPU_FREQ_RANGE_FLAG 0x80000000
#define CPU_FREQ_LOW 0x80000001
#define CPU_FREQ_MEDIUM 0x80000002
#define CPU_FREQ_HIGH 0x80000003
typedef enum mem_bind_type { /* memory binding type from --mem_bind=... */
/* verbose can be set with any other flag */
MEM_BIND_VERBOSE= 0x01, /* =v, */
/* the following manual binding flags are mutually exclusive */
/* MEM_BIND_NONE needs to be the first in this sub-list */
MEM_BIND_NONE = 0x02, /* =no */
MEM_BIND_RANK = 0x04, /* =rank */
MEM_BIND_MAP = 0x08, /* =map_mem:<list of CPU IDs> */
MEM_BIND_MASK = 0x10, /* =mask_mem:<list of CPU masks> */
MEM_BIND_LOCAL = 0x20 /* =local */
} mem_bind_type_t;
/* The last entry in node_states must be STATE_END, keep in sync with
* node_state_string. values may be ORed with NODE_STATE_FLAGS below.
* Node states typically alternate between NODE_STATE_IDLE and
* NODE_STATE_ALLOCATED. The NODE_STATE_COMPLETING flag will be set
* when jobs are in the process of terminating. */
enum node_states {
NODE_STATE_UNKNOWN, /* node's initial state, unknown */
NODE_STATE_DOWN, /* node in non-usable state */
NODE_STATE_IDLE, /* node idle and available for use */
NODE_STATE_ALLOCATED, /* node has been allocated to a job */
NODE_STATE_ERROR, /* node is in an error state */
NODE_STATE_MIXED, /* node has a mixed state */
NODE_STATE_FUTURE, /* node slot reserved for future use */
NODE_STATE_END /* last entry in table */
};
#define NODE_STATE_BASE 0x000f
#define NODE_STATE_FLAGS 0xfff0
#define NODE_STATE_CLOUD 0x0080 /* node comes from cloud */
#define NODE_RESUME 0x0100 /* Restore a DRAINED, DRAINING, DOWN
* or FAILING node to service (e.g.
* IDLE or ALLOCATED). Used in
* slurm_update_node() request */
#define NODE_STATE_DRAIN 0x0200 /* node do not new allocated work */
#define NODE_STATE_COMPLETING 0x0400 /* node is completing allocated job */
#define NODE_STATE_NO_RESPOND 0x0800 /* node is not responding */
#define NODE_STATE_POWER_SAVE 0x1000 /* node in power save mode */
#define NODE_STATE_FAIL 0x2000 /* node is failing, do not allocate
* new work */
#define NODE_STATE_POWER_UP 0x4000 /* restore power or otherwise
* configure a node */
#define NODE_STATE_MAINT 0x8000 /* node in maintenance reservation */
/* used to define the size of the credential.signature size
* used to define the key size of the io_stream_header_t
*/
#define SLURM_SSL_SIGNATURE_LENGTH 128
/* Used as show_flags for slurm_get_ and slurm_load_ function calls.
* Values can be can be ORed */
#define SHOW_ALL 0x0001 /* Show info for "hidden" partitions */
#define SHOW_DETAIL 0x0002 /* Show detailed resource information */
#define SHOW_DETAIL2 0x0004 /* Show batch script listing */
/* Define keys for ctx_key argument of slurm_step_ctx_get() */
enum ctx_keys {
SLURM_STEP_CTX_STEPID, /* get the created job step id */
SLURM_STEP_CTX_TASKS, /* get array of task count on each node */
SLURM_STEP_CTX_TID, /* get array of task IDs for specified node */
SLURM_STEP_CTX_RESP, /* get job step create response message */
SLURM_STEP_CTX_CRED,
SLURM_STEP_CTX_SWITCH_JOB,
SLURM_STEP_CTX_NUM_HOSTS,
SLURM_STEP_CTX_HOST,
SLURM_STEP_CTX_JOBID,
SLURM_STEP_CTX_USER_MANAGED_SOCKETS
};
/* CR_CPU, CR_SOCKET and CR_CORE are mututally exclusive
* CR_MEMORY may be added to any of the above values or used by itself
* CR_ONE_TASK_PER_CORE may also be added to any of the above values */
#define CR_CPU 0x0001 /* Resources are shared down to the level of
* logical processors which can be socket,
* core, or thread depending on the system. */
#define CR_SOCKET 0x0002 /* Resources are shared down to the socket
* level. Jobs will not be co-allocated
* within a socket. */
#define CR_CORE 0x0004 /* Resources are shared down to the core level.
* Jobs will not be co-allocated within a
* core. */
#define CR_BOARD 0x0008 /* Resources are shared down to the board
* level. Jobs will not be co-allocated
* within a board. */
#define CR_MEMORY 0x0010 /* Memory as consumable resources. Memory is
* not over-commited when selected as a CR. */
#define CR_ONE_TASK_PER_CORE 0x0100
/* By default, schedule only one task per core.
* Without this option, tasks would be
* allocated threads. */
#define CR_CORE_DEFAULT_DIST_BLOCK 0x1000
/* By default, distribute cores using a block
* approach inside the nodes */
#define MEM_PER_CPU 0x80000000
#define SHARED_FORCE 0x8000
#define PRIVATE_DATA_JOBS 0x0001 /* job/step data is private */
#define PRIVATE_DATA_NODES 0x0002 /* node data is private */
#define PRIVATE_DATA_PARTITIONS 0x0004 /* partition data is private */
#define PRIVATE_DATA_USAGE 0x0008 /* accounting usage data is private */
#define PRIVATE_DATA_USERS 0x0010 /* accounting user data is private */
#define PRIVATE_DATA_ACCOUNTS 0x0020 /* accounting account data is private*/
#define PRIVATE_DATA_RESERVATIONS 0x0040 /* reservation data is private */
#define PRIORITY_RESET_NONE 0x0000 /* never clear */
#define PRIORITY_RESET_NOW 0x0001 /* clear now (when slurmctld restarts) */
#define PRIORITY_RESET_DAILY 0x0002 /* clear daily at midnight */
#define PRIORITY_RESET_WEEKLY 0x0003 /* clear weekly at Sunday 00:00 */
#define PRIORITY_RESET_MONTHLY 0x0004 /* clear monthly on first at 00:00 */
#define PRIORITY_RESET_QUARTERLY 0x0005 /* clear quarterly on first at 00:00 */
#define PRIORITY_RESET_YEARLY 0x0006 /* clear yearly on first at 00:00 */
#define PROP_PRIO_OFF 0x0000 /* Do not propagage user nice value */
#define PROP_PRIO_ON 0x0001 /* Propagate user nice value */
#define PROP_PRIO_NICER 0x0002 /* Insure that user tasks have a nice
* value that is higher than slurmd */
#define PRIORITY_FLAGS_ACCRUE_ALWAYS 0x0001 /* Flag to always accrue age
* priority to pending jobs ignoring
* dependencies or holds */
/*****************************************************************************\
* SLURM HOSTLIST FUNCTIONS
\*****************************************************************************/
/* The hostlist opaque data type
*
* A hostlist is a list of hostnames optimized for a prefixXXXX style
* naming convention, where XXXX is a decimal, numeric suffix.
*/
#ifndef __hostlist_t_defined
# define __hostlist_t_defined
typedef struct hostlist * hostlist_t;
#endif
/*
* slurm_hostlist_create():
*
* Create a new hostlist from a string representation.
*
* The string representation (str) may contain one or more hostnames or
* bracketed hostlists separated by either `,' or whitespace. A bracketed
* hostlist is denoted by a common prefix followed by a list of numeric
* ranges contained within brackets: e.g. "tux[0-5,12,20-25]"
*
* To support systems with 3-D topography, a rectangular prism may
* be described using two three digit numbers separated by "x": e.g.
* "bgl[123x456]". This selects all nodes between 1 and 4 inclusive
* in the first dimension, between 2 and 5 in the second, and between
* 3 and 6 in the third dimension for a total of 4*4*4=64 nodes
*
* Note: if this module is compiled with WANT_RECKLESS_HOSTRANGE_EXPANSION
* defined, a much more loose interpretation of host ranges is used.
* Reckless hostrange expansion allows all of the following (in addition to
* bracketed hostlists):
*
* o tux0-5,tux12,tux20-25
* o tux0-tux5,tux12,tux20-tux25
* o tux0-5,12,20-25
*
* If str is NULL, and empty hostlist is created and returned.
*
* If the create fails, hostlist_create() returns NULL.
*
* The returned hostlist must be freed with hostlist_destroy()
*
*/
extern hostlist_t slurm_hostlist_create PARAMS((const char *hostlist));
/* slurm_hostlist_count():
*
* Return the number of hosts in hostlist hl.
*/
extern int slurm_hostlist_count PARAMS((hostlist_t hl));
/*
* slurm_hostlist_destroy():
*
* Destroy a hostlist object. Frees all memory allocated to the hostlist.
*/
extern void slurm_hostlist_destroy PARAMS((hostlist_t hl));
/* slurm_hostlist_find():
*
* Searches hostlist hl for the first host matching hostname
* and returns position in list if found.
*
* Returns -1 if host is not found.
*
*/
extern int slurm_hostlist_find PARAMS((hostlist_t hl, const char *hostname));
/* slurm_hostlist_push():
*
* push a string representation of hostnames onto a hostlist.
*
* The hosts argument may take the same form as in slurm_hostlist_create()
*
* Returns the number of hostnames inserted into the list,
* or 0 on failure.
*/
extern int slurm_hostlist_push PARAMS((hostlist_t hl, const char *hosts));
/* slurm_hostlist_push_host():
*
* Push a single host onto the hostlist hl.
* This function is more efficient than slurm_hostlist_push() for a single
* hostname, since the argument does not need to be checked for ranges.
*
* return value is 1 for success, 0 for failure.
*/
extern int slurm_hostlist_push_host PARAMS((hostlist_t hl, const char *host));
/* slurm_hostlist_ranged_string():
*
* Write the string representation of the hostlist hl into buf,
* writing at most n chars. Returns the number of bytes written,
* or -1 if truncation occurred.
*
* The result will be NULL terminated.
*
* slurm_hostlist_ranged_string() will write a bracketed hostlist representation
* where possible.
*/
extern ssize_t slurm_hostlist_ranged_string PARAMS((hostlist_t hl,
size_t n, char *buf));
/* slurm_hostlist_ranged_string_malloc():
*
* Return the string representation of the hostlist hl.
*
* The result must be released using free();
*/
extern char *slurm_hostlist_ranged_string_malloc PARAMS((hostlist_t hl));
/* hostlist_ranged_string_xmalloc():
*
* Wrapper of hostlist_ranged_string(), with result buffer dynamically
* allocated using xmalloc().
* The result will be NULL on failure (out of memory).
*
* Caller should free the result string using xfree().
*/
extern char *slurm_hostlist_ranged_string_xmalloc PARAMS((hostlist_t hl));
/*
* slurm_hostlist_shift():
*
* Returns the string representation of the first host in the hostlist
* or NULL if the hostlist is empty or there was an error allocating memory.
* The host is removed from the hostlist.
*
* Note: Caller is responsible for freeing the returned memory.
*/
extern char * slurm_hostlist_shift PARAMS((hostlist_t hl));
/* slurm_hostlist_uniq():
*
* Sort the hostlist hl and remove duplicate entries.
*
*/
extern void slurm_hostlist_uniq PARAMS((hostlist_t hl));
/*****************************************************************************\
* SLURM LIST FUNCTIONS
\*****************************************************************************/
#ifndef __list_datatypes_defined
# define __list_datatypes_defined
typedef struct list * List;
/*
* List opaque data type.
*/
typedef struct listIterator * ListIterator;
/*
* List Iterator opaque data type.
*/
typedef void (*ListDelF) (void *x);
/*
* Function prototype to deallocate data stored in a list.
* This function is responsible for freeing all memory associated
* with an item, including all subordinate items (if applicable).
*/
typedef int (*ListCmpF) (void *x, void *y);
/*
* Function prototype for comparing two items in a list.
* Returns less-than-zero if (x<y), zero if (x==y), and
* greather-than-zero if (x>y).
*/
typedef int (*ListFindF) (void *x, void *key);
/*
* Function prototype for matching items in a list.
* Returns non-zero if (x==key); o/w returns zero.
*/
typedef int (*ListForF) (void *x, void *arg);
/*
* Function prototype for operating on each item in a list.
* Returns less-than-zero on error.
*/
#endif
/* slurm_list_append():
*
* Inserts data [x] at the end of list [l].
* Returns the data's ptr, or lsd_nomem_error() if insertion failed.
*/
extern void * slurm_list_append PARAMS((List l, void *x));
/* slurm_list_count():
*
* Returns the number of items in list [l].
*/
extern int slurm_list_count PARAMS((List l));
/* slurm_list_create():
*
* Creates and returns a new empty list, or lsd_nomem_error() on failure.
* The deletion function [f] is used to deallocate memory used by items
* in the list; if this is NULL, memory associated with these items
* will not be freed when the list is destroyed.
* Note: Abandoning a list without calling slurm_list_destroy() will result
* in a memory leak.
*/
extern List slurm_list_create PARAMS((ListDelF f));
/* slurm_list_destroy():
*
* Destroys list [l], freeing memory used for list iterators and the
* list itself; if a deletion function was specified when the list
* was created, it will be called for each item in the list.
*/
extern void slurm_list_destroy PARAMS((List l));
/* slurm_list_find():
*
* Traverses the list from the point of the list iterator [i]
* using [f] to match each item with [key].
* Returns a ptr to the next item for which the function [f]
* returns non-zero, or NULL once the end of the list is reached.
* Example: i=slurm_list_iterator_reset(i);
* while ((x=slurm_list_find(i,f,k))) {...}
*/
extern void * slurm_list_find PARAMS((ListIterator i, ListFindF f, void *key));
/* slurm_list_is_empty():
*
* Returns non-zero if list [l] is empty; o/w returns zero.
*/
extern int slurm_list_is_empty PARAMS((List l));
/*
* Creates and returns a list iterator for non-destructively traversing
* list [l], or lsd_nomem_error() on failure.
*/
extern ListIterator slurm_list_iterator_create PARAMS((List l));
/* slurm_list_iterator_reset():
*
* Resets the list iterator [i] to start traversal at the beginning
* of the list.
*/
extern void slurm_list_iterator_reset PARAMS((ListIterator i));
/*
* Destroys the list iterator [i]; list iterators not explicitly destroyed
* in this manner will be destroyed when the list is deallocated via
* list_destroy().
*/
extern void slurm_list_iterator_destroy PARAMS((ListIterator i));
/* slurm_list_next():
*
* Returns a ptr to the next item's data,
* or NULL once the end of the list is reached.
* Example: i=slurm_list_iterator_create(i);
* while ((x=slurm_list_next(i))) {...}
*/
extern void * slurm_list_next PARAMS((ListIterator i));
/* slurm_list_sort():
*
* Sorts list [l] into ascending order according to the function [f].
* Note: Sorting a list resets all iterators associated with the list.
* Note: The sort algorithm is stable.
*/
extern void slurm_list_sort PARAMS((List l, ListCmpF f));
/*****************************************************************************\
* SLURM BITSTR FUNCTIONS
\*****************************************************************************/
#ifndef __bitstr_datatypes_defined
# define __bitstr_datatypes_defined
#ifdef USE_64BIT_BITSTR
typedef int64_t bitstr_t;
#define BITSTR_SHIFT BITSTR_SHIFT_WORD64
#else
typedef int32_t bitstr_t;
#define BITSTR_SHIFT BITSTR_SHIFT_WORD32
#endif
typedef bitstr_t bitoff_t;
#endif
#define ALLOC_SID_ADMIN_HOLD 0x00000001 /* admin job hold */
#define ALLOC_SID_USER_HOLD 0x00000002 /* user job hold */
/*****************************************************************************\
* PROTOCOL DATA STRUCTURE DEFINITIONS
\*****************************************************************************/
typedef struct dynamic_plugin_data {
void *data;
uint32_t plugin_id;
} dynamic_plugin_data_t;
typedef struct acct_gather_energy {
uint32_t previous_consumed_energy;
uint32_t base_consumed_energy;
uint32_t base_watts; /* lowest power consump of node, in watts */
uint32_t consumed_energy; /* total energy consumed by node, in joules */
uint32_t current_watts; /* current power consump of node, in watts */
} acct_gather_energy_t;
typedef struct job_descriptor { /* For submit, allocate, and update requests */
char *account; /* charge to specified account */
uint16_t acctg_freq; /* accounting polling interval (seconds) */
char *alloc_node; /* node making resource allocation request
* NOTE: Normally set by slurm_submit* or
* slurm_allocate* function */
uint16_t alloc_resp_port; /* port to send allocation confirmation to */
uint32_t alloc_sid; /* local sid making resource allocation request
* NOTE: Normally set by slurm_submit* or
* slurm_allocate* function
* NOTE: Also used for update flags, see
* ALLOC_SID_* flags */
uint32_t argc; /* number of arguments to the script */
char **argv; /* arguments to the script */
time_t begin_time; /* delay initiation until this time */
uint16_t ckpt_interval; /* periodically checkpoint this job */
char *ckpt_dir; /* directory to store checkpoint images */
char *comment; /* arbitrary comment (used by Moab scheduler) */
uint16_t contiguous; /* 1 if job requires contiguous nodes,
* 0 otherwise,default=0 */
char *cpu_bind; /* binding map for map/mask_cpu */
uint16_t cpu_bind_type; /* see cpu_bind_type_t */
char *dependency; /* synchronize job execution with other jobs */
time_t end_time; /* time by which job must complete, used for
* job update only now, possible deadline
* scheduling in the future */
char **environment; /* environment variables to set for job,
* name=value pairs, one per line */
uint32_t env_size; /* element count in environment */
char *exc_nodes; /* comma separated list of nodes excluded
* from job's allocation, default NONE */
char *features; /* comma separated list of required features,
* default NONE */
char *gres; /* comma separated list of required generic
* resources, default NONE */
uint32_t group_id; /* group to assume, if run as root. */
uint16_t immediate; /* 1 if allocate to run or fail immediately,
* 0 if to be queued awaiting resources */
uint32_t job_id; /* job ID, default set by SLURM */
uint16_t kill_on_node_fail; /* 1 if node failure to kill job,
* 0 otherwise,default=1 */
char *licenses; /* licenses required by the job */
uint16_t mail_type; /* see MAIL_JOB_ definitions above */
char *mail_user; /* user to receive notification */
char *mem_bind; /* binding map for map/mask_cpu */
uint16_t mem_bind_type; /* see mem_bind_type_t */
char *name; /* name of the job, default "" */
char *network; /* network use spec */
uint16_t nice; /* requested priority change,
* NICE_OFFSET == no change */
uint32_t num_tasks; /* number of tasks to be started,
* for batch only */
uint8_t open_mode; /* out/err open mode truncate or append,
* see OPEN_MODE_* */
uint16_t other_port; /* port to send various notification msg to */
uint8_t overcommit; /* over subscribe resources, for batch only */
char *partition; /* name of requested partition,
* default in SLURM config */
uint16_t plane_size; /* plane size when task_dist =
SLURM_DIST_PLANE */
uint32_t priority; /* relative priority of the job,
* explicitly set only for user root,
* 0 == held (don't initiate) */
char *qos; /* Quality of Service */
char *resp_host; /* NOTE: Set by slurmctld */
char *req_nodes; /* comma separated list of required nodes
* default NONE */
uint16_t requeue; /* enable or disable job requeue option */
char *reservation; /* name of reservation to use */
char *script; /* the actual job script, default NONE */
uint16_t shared; /* 1 if job can share nodes with other jobs,
* 0 if job needs exclusive access to the node,
* or NO_VAL to accept the system default.
* SHARED_FORCE to eliminate user control. */
char **spank_job_env; /* environment variables for job prolog/epilog