-
Notifications
You must be signed in to change notification settings - Fork 22
/
Chap_API_Struct.tex
2877 lines (2197 loc) · 92.5 KB
/
Chap_API_Struct.tex
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter: Data Structures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Data Structures and Types}
\label{chap:struct}
This chapter defines \ac{PMIx} standard data structures (along with macros for convenient use), types, and constants.
These apply to all consumers of the \ac{PMIx} interface.
Where necessary for clarification, the description of, for example, an attribute may be copied from this chapter into a section where it is used.
A PMIx implementation may define additional attributes beyond those specified in this document.
\adviceimplstart
Structures, types, and macros in the \ac{PMIx} Standard are defined in terms of the C-programming language. Implementers wishing to support other languages should provide the equivalent definitions in a language-appropriate manner.
If a PMIx implementation chooses to define additional attributes they should avoid using the \code{"PMIX"} prefix in their name or starting the attribute string with a \code{"pmix"} prefix.
This helps the end user distinguish between what is defined by the PMIx standard and what is specific to that PMIx implementation, and avoids potential conflicts with attributes defined by the Standard.
\adviceimplend
\adviceuserstart
Use of increment/decrement operations on indices inside \ac{PMIx} macros is discouraged due to unpredictable behavior as the index may be cited more than once in
the macro. The \ac{PMIx} standard only governs the existence and syntax of macros - it does not specify their implementation.
Users are also advised to use the macros and \acp{API} for creating, loading, and releasing
\ac{PMIx} structures to avoid potential issues with release of memory. For
example, pointing a \refstruct{pmix_envar_t} element at a static string
variable and then using \refmacro{PMIX_ENVAR_DESTRUCT} to clear it would
generate an error as the static string had not been allocated.
\adviceuserend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Constants}
\label{chap:struct:const}
\ac{PMIx} defines a few values that are used throughout the standard to set the size of fixed arrays or as a means of identifying values with special meaning.
The community makes every attempt to minimize the number of such definitions.
The constants defined in this section may be used before calling any \ac{PMIx} library initialization routine.
Additional constants associated with specific data structures or types are defined in the section describing that data structure or type.
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_MAX_NSLEN}{255}
Maximum namespace string length as an integer.
\end{constantdesc}
\adviceimplstart
Namespace arrays in \ac{PMIx} defined structures must reserve
a space of size \refconst{PMIX_MAX_NSLEN}+1 to allow room for the \code{NULL} terminator
\adviceimplend
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_MAX_KEYLEN}{511}
Maximum key string length as an integer.
\end{constantdesc}
\adviceimplstart
Key arrays in \ac{PMIx} defined structures must reserve
a space of size \refconst{PMIX_MAX_KEYLEN}+1 to allow room for the \code{NULL} terminator
\adviceimplend
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_APP_WILDCARD}{UINT32_MAX}
A value to indicate that the user wants the data for the given key from every application that posted that key, or that the given value applies to all applications within the given namespace.
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{PMIx Return Status Constants}
\label{api:struct:errors}
\declarestruct{pmix_status_t}
The \refstruct{pmix_status_t} type is an \code{int} compatible value for return status values.
\ac{PMIx} return values other than \refconst{PMIX_SUCCESS} are required to always be negative. The return status value for a successful operation is
\refconst{PMIX_SUCCESS}, which must have an integer value of 0:
\begin{constantdesc}
\declareconstitemvalue{PMIX_SUCCESS}{0}
Success.
\end{constantdesc}
\adviceimplstart
A \ac{PMIx} implementation must define all of the return status constants defined in the \ac{PMIx} standard, even if the implementation will never return the specific value to the caller.
\adviceimplend
\adviceuserstart
Other than \refconst{PMIX_SUCCESS} (which is required to be zero), the integer value of any \ac{PMIx} error constant are negative and of greater magnitude (i.e. of larger absolute value) than\refconst{PMIX_EXTERNAL_ERR_BASE}.
For compatibility with future versions, users are advised to always refer to constants by name, and not by their integer value which may be specific to an \ac{ABI} version.
\adviceuserend
The presentation of each \ac{API} in this document includes a list of return status constants which are either specific to that \ac{API} or are expected to be returned by the \ac{API} in normal use.
In addition, the following are general constants covering a variety of possible reasons an implementation of an \ac{API} may return a constant other than one of the constants presented with the \ac{API}. Although implementations can define and return additional error constants, implementations are encouraged to return one of the return constants listed with the \ac{API} or in the list presented here to encourage portability across implementations.
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_ERROR}{-1}
General Error.
%
\declareconstitemvalue{PMIX_ERR_EXISTS}{-11}
The requested operation would overwrite an existing value - typically returned
when an operation would overwrite an existing file or directory.
%
\declareconstitemvalue{PMIX_ERR_EXISTS_OUTSIDE_SCOPE}{-62}
The requested key exists, but was posted in a \emph{scope} (see Section \ref{api:nres:scope}) that does not include the requester
%
\declareconstitemvalue{PMIX_ERR_INVALID_CRED}{-12}
Invalid security credentials.
%
\declareconstitemvalue{PMIX_ERR_WOULD_BLOCK}{-15}
Operation would block.
%
\declareconstitemvalue{PMIX_ERR_UNKNOWN_DATA_TYPE}{-16}
The data type specified in an input to the \ac{PMIx} library is not recognized
by the implementation.
%
\declareconstitemvalue{PMIX_ERR_TYPE_MISMATCH}{-18}
The data type found in an object does not match the expected data type
as specified in the \ac{API} call - e.g., a request to unpack a
\refconst{PMIX_BOOL} value from a buffer that does not contain a value of
that type in the current unpack location.
%
\declareconstitemvalue{PMIX_ERR_UNPACK_INADEQUATE_SPACE}{-19}
Inadequate space to unpack data - the number of values in the buffer exceeds
the specified number to unpack.
%
\declareconstitemvalue{PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER}{-50}
Unpacking past the end of the provided buffer - the number of values in the
buffer is less than the specified number to unpack, or a request was made to
unpack a buffer beyond the buffer's end.
%
\declareconstitemvalue{PMIX_ERR_UNPACK_FAILURE}{-20}
The unpack operation failed for an unspecified reason.
%
\declareconstitemvalue{PMIX_ERR_PACK_FAILURE}{-21}
The pack operation failed for an unspecified reason.
%
\declareconstitemvalue{PMIX_ERR_NO_PERMISSIONS}{-23}
The user lacks permissions to execute the specified operation.
%
\declareconstitemvalue{PMIX_ERR_TIMEOUT}{-24}
Either a user-specified or system-internal timeout expired.
%
\declareconstitemvalue{PMIX_ERR_UNREACH}{-25}
The specified target server or client process is not reachable - i.e., a
suitable connection either has not been or can not be made.
%
\declareconstitemvalue{PMIX_ERR_BAD_PARAM}{-27}
One or more incorrect parameters (e.g., passing an attribute with a value of the wrong type), or multiple parameters containing conflicting directives (e.g., multiple instances of the same attribute with different values, or different attributes specifying conflicting behaviors), were passed to a \ac{PMIx} \ac{API}.
%
\declareconstitemvalue{PMIX_ERR_EMPTY}{-60}
An array or list was given that has no members in it - i.e., the object is empty.
%
\declareconstitemvalue{PMIX_ERR_RESOURCE_BUSY}{-28}
Resource busy - typically seen when an attempt to establish a connection
to another process (e.g., a \ac{PMIx} server) cannot be made due to a
communication failure.
%
\declareconstitemvalue{PMIX_ERR_OUT_OF_RESOURCE}{-29}
Resource exhausted.
%
\declareconstitemvalue{PMIX_ERR_INIT}{-31}
The requested operation requires that the \ac{PMIx} library be initialized prior to being called.
%
\declareconstitemvalue{PMIX_ERR_NOMEM}{-32}
Out of memory.
%
\declareconstitemvalue{PMIX_ERR_NOT_FOUND}{-46}
The requested information was not found.
%
\declareconstitemvalue{PMIX_ERR_NOT_SUPPORTED}{-47}
The requested operation is not supported by either the \ac{PMIx} implementation
or the host environment.
%
\declareconstitemvalue{PMIX_ERR_PARAM_VALUE_NOT_SUPPORTED}{-59}
The requested operation is supported by the \ac{PMIx} implementation and (if applicable) the host environment. However, at least one supplied parameter was given an unsupported value, and the operation cannot therefore be executed as requested.
%
\declareconstitemvalue{PMIX_ERR_COMM_FAILURE}{-49}
Communication failure - a message failed to be sent or received, but the
connection remains intact.
%
\declareconstitemvalue{PMIX_ERR_LOST_CONNECTION}{-61}
Lost connection between server and client or tool.
%
\declareconstitemvalue{PMIX_ERR_INVALID_OPERATION}{-158}
The requested operation is supported by the implementation and host environment, but fails to meet a requirement (e.g., requesting to \textit{disconnect} from processes without first \textit{connecting} to them, inclusion of conflicting directives, or a request to perform an operation that conflicts with an ongoing one).
%
\declareconstitemvalue{PMIX_OPERATION_IN_PROGRESS}{-156}
A requested operation is already in progress - the duplicate request
shall therefore be ignored.
%
\declareconstitemvalue{PMIX_OPERATION_SUCCEEDED}{-157}
The requested operation was performed atomically - no callback function will be executed.
%
\declareconstitemvalue{PMIX_ERR_PARTIAL_SUCCESS}{-52}
The operation is considered successful but not all elements of the operation were concluded (e.g., some members of a group construct operation chose not to participate).
%
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{User-Defined Error and Event Constants}
\label{api:struct:usererrors}
\ac{PMIx} establishes a boundary for constants defined in the \ac{PMIx} standard. Negative values larger (i.e., more negative) than this (and any positive values greater than zero) are guaranteed not to conflict with \ac{PMIx} values.
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_EXTERNAL_ERR_BASE}{-3000}
A starting point for user-level defined error and event constants.
Negative values that are more negative than the defined constant are guaranteed not to conflict with \ac{PMIx} values.
Definitions should always be based on the \refconst{PMIX_EXTERNAL_ERR_BASE} constant and not a specific value as the value of the constant may change.
%
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Data Types}
This section defines various data types used by the \ac{PMIx} APIs. The version of the standard in which a particular data type was introduced is shown in the margin.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Key Structure}
\declarestruct{pmix_key_t}
The \refstruct{pmix_key_t} structure is a statically defined character array of length \refconst{PMIX_MAX_KEYLEN}+1, thus supporting keys of maximum length \refconst{PMIX_MAX_KEYLEN} while preserving space for a mandatory \code{NULL} terminator.
\copySignature{pmix_key_t}{2.0}{
typedef char pmix_key_t[PMIX_MAX_KEYLEN+1];
}
Characters in the key must be standard alphanumeric values supported by common utilities such as \textit{strcmp}.
\adviceuserstart
References to keys in \ac{PMIx} v1 were defined simply as an array of characters of size \code{PMIX_MAX_KEYLEN+1}. The \refstruct{pmix_key_t} type definition was introduced in version 2 of the standard. The two definitions are code-compatible and thus do not represent a break in backward compatibility.
Passing a \refstruct{pmix_key_t} value to the standard \textit{sizeof} utility can result in compiler warnings of incorrect returned value. Users are advised to avoid using \textit{sizeof(pmix_key_t)} and instead rely on the \refconst{PMIX_MAX_KEYLEN} constant.
\adviceuserend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Key support macros}
The following macros are provided for convenience when working with \ac{PMIx} keys.
\littleheader{Check key macro}
\declaremacro{PMIX_CHECK_KEY}
Compare the key in a \refstruct{pmix_info_t} to a given value.
\copySignature{PMIX_CHECK_KEY}{3.0}{
PMIX_CHECK_KEY(a, b)
}
\begin{arglist}
\argin{a}{Pointer to the structure whose key is to be checked (pointer to \refstruct{pmix_info_t})}
\argin{b}{String value to be compared against (\code{char*})}
\end{arglist}
Returns \code{true} if the key matches the given value
\littleheader{Check reserved key macro}
\declaremacro{PMIX_CHECK_RESERVED_KEY}
Check if the given key is a \ac{PMIx} \emph{reserved} key as described in Chapter \ref{chap:api_rsvd_keys}.
\copySignature{PMIX_CHECK_RESERVED_KEY}{4.0}{
PMIX_CHECK_RESERVED_KEY(a)
}
\begin{arglist}
\argin{a}{String value to be checked (\code{char*})}
\end{arglist}
Returns \code{true} if the key is reserved by the Standard.
\littleheader{Load key macro}
\declaremacro{PMIX_LOAD_KEY}
Load a key into a \refstruct{pmix_info_t}.
\copySignature{PMIX_LOAD_KEY}{4.0}{
PMIX_LOAD_KEY(a, b)
}
\begin{arglist}
\argin{a}{Pointer to the structure whose key is to be loaded (pointer to \refstruct{pmix_info_t})}
\argin{b}{String value to be loaded (\code{char*})}
\end{arglist}
No return value.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Namespace Structure}
\declarestruct{pmix_nspace_t}
The \refstruct{pmix_nspace_t} structure is a statically defined character array of length \refconst{PMIX_MAX_NSLEN}+1, thus supporting namespaces of maximum length \refconst{PMIX_MAX_NSLEN} while preserving space for a mandatory \code{NULL} terminator.
\copySignature{pmix_nspace_t}{2.0}{
typedef char pmix_nspace_t[PMIX_MAX_NSLEN+1];
}
Characters in the namespace must be standard alphanumeric values supported by common utilities such as \textit{strcmp}.
\adviceuserstart
References to namespace values in \ac{PMIx} v1 were defined simply as an array of characters of size \code{PMIX_MAX_NSLEN+1}. The \refstruct{pmix_nspace_t} type definition was introduced in version 2 of the standard. The two definitions are code-compatible and thus do not represent a break in backward compatibility.
Passing a \refstruct{pmix_nspace_t} value to the standard \textit{sizeof} utility can result in compiler warnings of incorrect returned value. Users are advised to avoid using \textit{sizeof(pmix_nspace_t)} and instead rely on the \refconst{PMIX_MAX_NSLEN} constant.
\adviceuserend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Namespace support macros}
The following macros are provided for convenience when working with \ac{PMIx} namespace structures.
\littleheader{Check namespace macro}
\declaremacro{PMIX_CHECK_NSPACE}
Compare the string in a \refstruct{pmix_nspace_t} to a given value.
\copySignature{PMIX_CHECK_NSPACE}{3.0}{
PMIX_CHECK_NSPACE(a, b)
}
\begin{arglist}
\argin{a}{Pointer to the structure whose value is to be checked (pointer to \refstruct{pmix_nspace_t})}
\argin{b}{String value to be compared against (\code{char*})}
\end{arglist}
Returns \code{true} if the namespace matches the given value
\littleheader{Check invalid namespace macro}
\declaremacro{PMIX_NSPACE_INVALID}
Check if the provided \refstruct{pmix_nspace_t} is invalid.
\versionMarkerProvisional{4.1}
\cspecificstart
\begin{codepar}
PMIX_NSPACE_INVALID(a)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{a}{Pointer to the structure whose value is to be checked (pointer to \refstruct{pmix_nspace_t})}
\end{arglist}
Returns \code{true} if the namespace is invalid (i.e., starts with a \code{NULL} resulting in a zero-length string value)
\littleheader{Load namespace macro}
\declaremacro{PMIX_LOAD_NSPACE}
Load a namespace into a \refstruct{pmix_nspace_t}.
\copySignature{PMIX_LOAD_NSPACE}{4.0}{
PMIX_LOAD_NSPACE(a, b)
}
\begin{arglist}
\argin{a}{Pointer to the target structure (pointer to \refstruct{pmix_nspace_t})}
\argin{b}{String value to be loaded - if \code{NULL} is given, then the target structure will be initialized to zero's (\code{char*})}
\end{arglist}
No return value.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Rank Structure}
\declarestruct{pmix_rank_t}
The \refstruct{pmix_rank_t} structure is a \code{uint32_t} type for rank values.
\copySignature{pmix_rank_t}{1.0}{
typedef uint32_t pmix_rank_t;
}
The following constants can be used to set a variable of the type \refstruct{pmix_rank_t}. All definitions were introduced in version 1 of the standard unless otherwise marked. Valid rank values start at zero.
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_RANK_UNDEF}{UINT32_MAX}
A value to request job-level data where the information itself is not associated with any specific rank, or when passing a \refstruct{pmix_proc_t} identifier to an operation that only references the namespace field of that structure.
%
\declareconstitemvalue{PMIX_RANK_WILDCARD}{UINT32_MAX-1}
A value to indicate that the user wants the data for the given key from every rank that posted that key.
%
\declareconstitemvalue{PMIX_RANK_LOCAL_NODE}{UINT32_MAX-2}
Special rank value used to define groups of ranks.
This constant defines the group of all ranks on a local node.
%
\declareconstitemvalue{PMIX_RANK_LOCAL_PEERS}{UINT32_MAX-4}
Special rank value used to define groups of ranks.
This constant defines the group of all ranks on a local node within the same namespace as the current process.
%
\declareconstitemvalue{PMIX_RANK_INVALID}{UINT32_MAX-3}
An invalid rank value.
%
\declareconstitemvalue{PMIX_RANK_VALID}{UINT32_MAX-50}
Define an upper boundary for valid rank values.
%
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Rank support macros}
The following macros are provided for convenience when working with \ac{PMIx} ranks.
\littleheader{Check rank macro}
\declaremacro{PMIX_CHECK_RANK}
Check two ranks for equality, taking into account wildcard values
\versionMarker{4.0}
\cspecificstart
\begin{codepar}
PMIX_CHECK_RANK(a, b)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{a}{Rank to be checked (\refstruct{pmix_rank_t})}
\argin{b}{Rank to be checked (\refstruct{pmix_rank_t})}
\end{arglist}
Returns \code{true} if the ranks are equal, or at least one of the ranks is \refconst{PMIX_RANK_WILDCARD}
\littleheader{Check rank is valid macro}
\declaremacro{PMIX_RANK_IS_VALID}
Check if the given rank is a valid value
\versionMarkerProvisional{4.1}
\cspecificstart
\begin{codepar}
PMIX_RANK_IS_VALID(a)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{a}{Rank to be checked (\refstruct{pmix_rank_t})}
\end{arglist}
Returns \code{true} if the given rank is valid (i.e., less than \refconst{PMIX_RANK_VALID})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Process Structure}
\declarestruct{pmix_proc_t}
The \refstruct{pmix_proc_t} structure is used to identify a single process in the PMIx universe.
It contains a reference to the namespace and the \refstruct{pmix_rank_t} within that namespace.
\copySignature{pmix_proc_t}{1.0}{
typedef struct pmix_proc \{ \\
\hspace*{4\sigspace}pmix_nspace_t nspace; \\
\hspace*{4\sigspace}pmix_rank_t rank; \\
\} pmix_proc_t;
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Process structure support macros}
The following macros are provided to support the \refstruct{pmix_proc_t} structure.
%%%%
\littleheader{Static initializer for the proc structure}
\declaremacroProvisional{PMIX_PROC_STATIC_INIT}
Provide a static initializer for the \refstruct{pmix_proc_t} fields.
\versionMarker{5.0}
\cspecificstart
\begin{codepar}
PMIX_PROC_STATIC_INIT
\end{codepar}
\cspecificend
\littleheader{Initialize the proc structure}
\declaremacro{PMIX_PROC_CONSTRUCT}
Initialize the \refstruct{pmix_proc_t} fields.
\copySignature{PMIX_PROC_CONSTRUCT}{1.0}{
PMIX_PROC_CONSTRUCT(m)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be initialized (pointer to \refstruct{pmix_proc_t})}
\end{arglist}
\littleheader{Destruct the proc structure}
\declaremacro{PMIX_PROC_DESTRUCT}
Destruct the \refstruct{pmix_proc_t} fields.
\cspecificstart
\begin{codepar}
PMIX_PROC_DESTRUCT(m)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{m}{Pointer to the structure to be destructed (pointer to \refstruct{pmix_proc_t})}
\end{arglist}
There is nothing to release here as the fields in \refstruct{pmix_proc_t} are either a statically-declared array (the namespace) or a single value (the rank). However, the macro is provided for symmetry in the code and for future-proofing should some allocated field be included some day.
\littleheader{Create a proc array}
\declaremacro{PMIX_PROC_CREATE}
Allocate and initialize an array of \refstruct{pmix_proc_t} structures.
\copySignature{PMIX_PROC_CREATE}{1.0}{
PMIX_PROC_CREATE(m, n)
}
\begin{arglist}
\arginout{m}{Address where the pointer to the array of \refstruct{pmix_proc_t} structures shall be stored (handle)}
\argin{n}{Number of structures to be allocated (\code{size_t})}
\end{arglist}
\littleheader{Free a proc structure}
\declaremacro{PMIX_PROC_RELEASE}
Release a \refstruct{pmix_proc_t} structure.
\copySignature{PMIX_PROC_RELEASE}{4.0}{
PMIX_PROC_RELEASE(m)
}
\begin{arglist}
\argin{m}{Pointer to a \refstruct{pmix_proc_t} structure (handle)}
\end{arglist}
\littleheader{Free a proc array}
\declaremacro{PMIX_PROC_FREE}
Release an array of \refstruct{pmix_proc_t} structures.
\copySignature{PMIX_PROC_FREE}{1.0}{
PMIX_PROC_FREE(m, n)
}
\begin{arglist}
\argin{m}{Pointer to the array of \refstruct{pmix_proc_t} structures (handle)}
\argin{n}{Number of structures in the array (\code{size_t})}
\end{arglist}
\littleheader{Load a proc structure}
\declaremacro{PMIX_PROC_LOAD}
Load values into a \refstruct{pmix_proc_t}.
\copySignature{PMIX_PROC_LOAD}{2.0}{
PMIX_PROC_LOAD(m, n, r)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be loaded (pointer to \refstruct{pmix_proc_t})}
\argin{n}{Namespace to be loaded (\refstruct{pmix_nspace_t})}
\argin{r}{Rank to be assigned (\refstruct{pmix_rank_t})}
\end{arglist}
No return value. Deprecated in favor of \refmacro{PMIX_LOAD_PROCID}
\littleheader{Compare identifiers}
\declaremacro{PMIX_CHECK_PROCID}
Compare two \refstruct{pmix_proc_t} identifiers.
\copySignature{PMIX_CHECK_PROCID}{3.0}{
PMIX_CHECK_PROCID(a, b)
}
\begin{arglist}
\argin{a}{Pointer to a structure whose ID is to be compared (pointer to \refstruct{pmix_proc_t})}
\argin{b}{Pointer to a structure whose ID is to be compared (pointer to \refstruct{pmix_proc_t})}
\end{arglist}
Returns \code{true} if the two structures contain matching namespaces and:
\begin{itemize}
\item the ranks are the same value
\item one of the ranks is \refconst{PMIX_RANK_WILDCARD}
\end{itemize}
\littleheader{Check if a process identifier is valid}
\declaremacro{PMIX_PROCID_INVALID}
Check for invalid namespace or rank value
\versionMarkerProvisional{4.1}
\cspecificstart
\begin{codepar}
PMIX_PROCID_INVALID(a)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{a}{Pointer to a structure whose ID is to be checked (pointer to \refstruct{pmix_proc_t})}
\end{arglist}
Returns \code{true} if the process identifier contains either an empty (i.e., invalid) \refarg{nspace} field or a \refarg{rank} field of \refconst{PMIX_RANK_INVALID}
\littleheader{Load a procID structure}
\declaremacro{PMIX_LOAD_PROCID}
Load values into a \refstruct{pmix_proc_t}.
\copySignature{PMIX_LOAD_PROCID}{4.0}{
PMIX_LOAD_PROCID(m, n, r)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be loaded (pointer to \refstruct{pmix_proc_t})}
\argin{n}{Namespace to be loaded (\refstruct{pmix_nspace_t})}
\argin{r}{Rank to be assigned (\refstruct{pmix_rank_t})}
\end{arglist}
\littleheader{Transfer a procID structure}
\declaremacro{PMIX_PROCID_XFER}
Transfer contents of one \refstruct{pmix_proc_t} value to another \refstruct{pmix_proc_t}.
\versionMarkerProvisional{4.1}
\cspecificstart
\begin{codepar}
PMIX_PROCID_XFER(d, s)
\end{codepar}
\cspecificend
\begin{arglist}
\argin{d}{Pointer to the target structure (pointer to \refstruct{pmix_proc_t})}
\argin{s}{Pointer to the source structure (pointer to \refstruct{pmix_proc_t})}
\end{arglist}
\littleheader{Construct a multi-cluster namespace}
\declaremacro{PMIX_MULTICLUSTER_NSPACE_CONSTRUCT}
Construct a multi-cluster identifier containing a cluster ID and a namespace.
\copySignature{PMIX_MULTICLUSTER_NSPACE_CONSTRUCT}{4.0}{
PMIX_MULTICLUSTER_NSPACE_CONSTRUCT(m, n, r)
}
\begin{arglist}
\argin{m}{\refstruct{pmix_nspace_t} structure that will contain the multi-cluster identifier (\refstruct{pmix_nspace_t})}
\argin{n}{Cluster identifier (\code{char*})}
\argin{n}{Namespace to be loaded (\refstruct{pmix_nspace_t})}
\end{arglist}
Combined length of the cluster identifier and namespace must be less than \refconst{PMIX_MAX_NSLEN}-2.
\littleheader{Parse a multi-cluster namespace}
\declaremacro{PMIX_MULTICLUSTER_NSPACE_PARSE}
Parse a multi-cluster identifier into its cluster ID and namespace parts.
\copySignature{PMIX_MULTICLUSTER_NSPACE_PARSE}{4.0}{
PMIX_MULTICLUSTER_NSPACE_PARSE(m, n, r)
}
\begin{arglist}
\argin{m}{\refstruct{pmix_nspace_t} structure containing the multi-cluster identifier (pointer to \refstruct{pmix_nspace_t})}
\argin{n}{Location where the cluster ID is to be stored (\refstruct{pmix_nspace_t})}
\argin{n}{Location where the namespace is to be stored (\refstruct{pmix_nspace_t})}
\end{arglist}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Process State Structure}
\label{api:struct:processstate}
\declarestruct{pmix_proc_state_t}
\versionMarker{2.0}
The \refstruct{pmix_proc_state_t} structure is a \code{uint8_t} type for process state values. The following constants can be used to set a variable of the type \refstruct{pmix_proc_state_t}.
\adviceuserstart
The fine-grained nature of the following constants may exceed the ability of an \ac{RM} to provide updated process state values during the process lifetime. This is particularly true of states for short-lived processes.
\adviceuserend
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_PROC_STATE_UNDEF}{0}
Undefined process state.
%
\declareconstitemvalue{PMIX_PROC_STATE_PREPPED}{1}
Process is ready to be launched.
%
\declareconstitemvalue{PMIX_PROC_STATE_LAUNCH_UNDERWAY}{2}
Process launch is underway.
%
\declareconstitemvalue{PMIX_PROC_STATE_RESTART}{3}
Process is ready for restart.
%
\declareconstitemvalue{PMIX_PROC_STATE_TERMINATE}{4}
Process is marked for termination.
%
\declareconstitemvalue{PMIX_PROC_STATE_RUNNING}{5}
Process has been locally \code{fork}'ed by the \ac{RM}.
%
\declareconstitemvalue{PMIX_PROC_STATE_CONNECTED}{6}
Process has connected to PMIx server.
%
\declareconstitemvalue{PMIX_PROC_STATE_UNTERMINATED}{15}
Define a ``boundary'' between the terminated states and \refconst{PMIX_PROC_STATE_CONNECTED} so users can easily and quickly determine if a process is still running or not.
Any value less than this constant means that the process has not terminated.
%
\declareconstitemvalue{PMIX_PROC_STATE_TERMINATED}{20}
Process has terminated and is no longer running.
%
\declareconstitemvalue{PMIX_PROC_STATE_ERROR}{50}
Define a boundary so users can easily and quickly determine if a process abnormally terminated.
Any value above this constant means that the process has terminated abnormally.
%
\declareconstitemvalue{PMIX_PROC_STATE_KILLED_BY_CMD}{51}
Process was killed by a command.
%
\declareconstitemvalue{PMIX_PROC_STATE_ABORTED}{52}
Process was aborted by a call to \refapi{PMIx_Abort}.
%
\declareconstitemvalue{PMIX_PROC_STATE_FAILED_TO_START}{53}
Process failed to start.
%
\declareconstitemvalue{PMIX_PROC_STATE_ABORTED_BY_SIG}{54}
Process aborted by a signal.
%
\declareconstitemvalue{PMIX_PROC_STATE_TERM_WO_SYNC}{55}
Process exited without calling \refapi{PMIx_Finalize}.
%
\declareconstitemvalue{PMIX_PROC_STATE_COMM_FAILED}{56}
Process communication has failed.
%
\declareconstitemvalue{PMIX_PROC_STATE_SENSOR_BOUND_EXCEEDED}{57}
Process exceeded a specified sensor limit.
%
\declareconstitemvalue{PMIX_PROC_STATE_CALLED_ABORT}{58}
Process called \refapi{PMIx_Abort}.
%
\declareconstitemvalue{PMIX_PROC_STATE_HEARTBEAT_FAILED}{59}
Frocess failed to send heartbeat within specified time limit.
%
\declareconstitemvalue{PMIX_PROC_STATE_MIGRATING}{60}
Process failed and is waiting for resources before restarting.
%
\declareconstitemvalue{PMIX_PROC_STATE_CANNOT_RESTART}{61}
Process failed and cannot be restarted.
%
\declareconstitemvalue{PMIX_PROC_STATE_TERM_NON_ZERO}{62}
Process exited with a non-zero status.
%
\declareconstitemvalue{PMIX_PROC_STATE_FAILED_TO_LAUNCH}{63}
Unable to launch process.
%
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Process Information Structure}
\declarestruct{pmix_proc_info_t}
The \refstruct{pmix_proc_info_t} structure defines a set of information about a specific process including it's name, location, and state.
\copySignature{pmix_proc_info_t}{2.0}{
typedef struct pmix_proc_info \{ \\
\hspace*{4\sigspace}/** Process structure */ \\
\hspace*{4\sigspace}pmix_proc_t proc; \\
\hspace*{4\sigspace}/** Hostname where process resides */ \\
\hspace*{4\sigspace}char *hostname; \\
\hspace*{4\sigspace}/** Name of the executable */ \\
\hspace*{4\sigspace}char *executable_name; \\
\hspace*{4\sigspace}/** Process ID on the host */ \\
\hspace*{4\sigspace}pid_t pid; \\
\hspace*{4\sigspace}/** Exit code of the process. Default: 0 */ \\
\hspace*{4\sigspace}int exit_code; \\
\hspace*{4\sigspace}/** Current state of the process */ \\
\hspace*{4\sigspace}pmix_proc_state_t state; \\
\} pmix_proc_info_t;
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Process information structure support macros}
The following macros are provided to support the \refstruct{pmix_proc_info_t} structure.
%%%%
\littleheader{Static initializer for the proc info structure}
\declaremacroProvisional{PMIX_PROC_INFO_STATIC_INIT}
Provide a static initializer for the \refstruct{pmix_proc_info_t} fields.
\versionMarker{5.0}
\cspecificstart
\begin{codepar}
PMIX_PROC_INFO_STATIC_INIT
\end{codepar}
\cspecificend
%%%%
\littleheader{Initialize the process information structure}
\declaremacro{PMIX_PROC_INFO_CONSTRUCT}
Initialize the \refstruct{pmix_proc_info_t} fields.
\copySignature{PMIX_PROC_INFO_CONSTRUCT}{2.0}{
PMIX_PROC_INFO_CONSTRUCT(m)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be initialized (pointer to \refstruct{pmix_proc_info_t})}
\end{arglist}
%%%%
\littleheader{Destruct the process information structure}
\declaremacro{PMIX_PROC_INFO_DESTRUCT}
Destruct the \refstruct{pmix_proc_info_t} fields.
\copySignature{PMIX_PROC_INFO_DESTRUCT}{2.0}{
PMIX_PROC_INFO_DESTRUCT(m)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be destructed (pointer to \refstruct{pmix_proc_info_t})}
\end{arglist}
%%%%
\littleheader{Create a process information array}
\declaremacro{PMIX_PROC_INFO_CREATE}
Allocate and initialize a \refstruct{pmix_proc_info_t} array.
\copySignature{PMIX_PROC_INFO_CREATE}{2.0}{
PMIX_PROC_INFO_CREATE(m, n)
}
\begin{arglist}
\arginout{m}{Address where the pointer to the array of \refstruct{pmix_proc_info_t} structures shall be stored (handle)}
\argin{n}{Number of structures to be allocated (\code{size_t})}
\end{arglist}
%%%%
\littleheader{Free a process information structure}
\declaremacro{PMIX_PROC_INFO_RELEASE}
Release a \refstruct{pmix_proc_info_t} structure.
\copySignature{PMIX_PROC_INFO_RELEASE}{2.0}{
PMIX_PROC_INFO_RELEASE(m)
}
\begin{arglist}
\argin{m}{Pointer to a \refstruct{pmix_proc_info_t} structure (handle)}
\end{arglist}
%%%%
\littleheader{Free a process information array}
\declaremacro{PMIX_PROC_INFO_FREE}
Release an array of \refstruct{pmix_proc_info_t} structures.
\copySignature{PMIX_PROC_INFO_FREE}{2.0}{
PMIX_PROC_INFO_FREE(m, n)
}
\begin{arglist}
\argin{m}{Pointer to the array of \refstruct{pmix_proc_info_t} structures (handle)}
\argin{n}{Number of structures in the array (\code{size_t})}
\end{arglist}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Job State Structure}
\label{api:struct:jobstate}
\declarestruct{pmix_job_state_t}
\versionMarker{4.0}
The \refstruct{pmix_job_state_t} structure is a \code{uint8_t} type for job state values. The following constants can be used to set a variable of the type \refstruct{pmix_job_state_t}.
\adviceuserstart
The fine-grained nature of the following constants may exceed the ability of an \ac{RM} to provide updated job state values during the job lifetime. This is particularly true for short-lived jobs.
\adviceuserend
\begin{constantdesc}
%
\declareconstitemvalue{PMIX_JOB_STATE_UNDEF}{0}
Undefined job state.
%
\declareconstitemvalue{PMIX_JOB_STATE_AWAITING_ALLOC}{1}
Job is waiting for resources to be allocated to it.
%
\declareconstitemvalue{PMIX_JOB_STATE_LAUNCH_UNDERWAY}{2}
Job launch is underway.
%
\declareconstitemvalue{PMIX_JOB_STATE_RUNNING}{3}
All processes in the job have been spawned and are executing.
%
\declareconstitemvalue{PMIX_JOB_STATE_SUSPENDED}{4}
All processes in the job have been suspended.
%
\declareconstitemvalue{PMIX_JOB_STATE_CONNECTED}{5}
All processes in the job have connected to their \ac{PMIx} server.
%
\declareconstitemvalue{PMIX_JOB_STATE_UNTERMINATED}{15}
Define a ``boundary'' between the terminated states and \refconst{PMIX_JOB_STATE_TERMINATED} so users can easily and quickly determine if a job is still running or not.
Any value less than this constant means that the job has not terminated.
%
\declareconstitemvalue{PMIX_JOB_STATE_TERMINATED}{20}
All processes in the job have terminated and are no longer running - typically will be accompanied by the job exit status in response to a query.
%
\declareconstitemvalue{PMIX_JOB_STATE_TERMINATED_WITH_ERROR}{50}
Define a boundary so users can easily and quickly determine if a job abnormally terminated - typically will be accompanied by a job-related error code in response to a query
Any value above this constant means that the job terminated abnormally.
%
\end{constantdesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Value Structure}
\declarestruct{pmix_value_t}
The \refstruct{pmix_value_t} structure is used to represent the value passed to \refapi{PMIx_Put} and retrieved by \refapi{PMIx_Get}, as well as many of the other \ac{PMIx} functions.
A collection of values may be specified under a single key by passing a \refstruct{pmix_value_t} containing an array of type \refstruct{pmix_data_array_t}, with each array element containing its own object. All members shown below were introduced in version 1 of the standard unless otherwise marked.
\copySignature{pmix_value_t}{1.0}{
typedef struct pmix_value \{ \\
\hspace*{4\sigspace}pmix_data_type_t type; \\
\hspace*{4\sigspace}union \{ \\
\hspace*{8\sigspace}bool flag; \\
\hspace*{8\sigspace}uint8_t byte; \\
\hspace*{8\sigspace}char *string; \\
\hspace*{8\sigspace}size_t size; \\
\hspace*{8\sigspace}pid_t pid; \\
\hspace*{8\sigspace}int integer; \\
\hspace*{8\sigspace}int8_t int8; \\
\hspace*{8\sigspace}int16_t int16; \\
\hspace*{8\sigspace}int32_t int32; \\
\hspace*{8\sigspace}int64_t int64; \\
\hspace*{8\sigspace}unsigned int uint; \\
\hspace*{8\sigspace}uint8_t uint8; \\
\hspace*{8\sigspace}uint16_t uint16; \\
\hspace*{8\sigspace}uint32_t uint32; \\
\hspace*{8\sigspace}uint64_t uint64; \\
\hspace*{8\sigspace}float fval; \\
\hspace*{8\sigspace}double dval; \\
\hspace*{8\sigspace}struct timeval tv; \\
\hspace*{8\sigspace}time_t time; // version 2.0 \\
\hspace*{8\sigspace}pmix_status_t status; // version 2.0 \\
\hspace*{8\sigspace}pmix_rank_t rank; // version 2.0 \\
\hspace*{8\sigspace}pmix_proc_t *proc; // version 2.0 \\
\hspace*{8\sigspace}pmix_byte_object_t bo; \\
\hspace*{8\sigspace}pmix_persistence_t persist; // version 2.0 \\
\hspace*{8\sigspace}pmix_scope_t scope; // version 2.0 \\
\hspace*{8\sigspace}pmix_data_range_t range; // version 2.0 \\
\hspace*{8\sigspace}pmix_proc_state_t state; // version 2.0 \\
\hspace*{8\sigspace}pmix_proc_info_t *pinfo; // version 2.0 \\
\hspace*{8\sigspace}pmix_data_array_t *darray; // version 2.0 \\
\hspace*{8\sigspace}void *ptr; // version 2.0 \\
\hspace*{8\sigspace}pmix_alloc_directive_t adir; // version 2.0 \\
\hspace*{4\sigspace}\} data; \\
\} pmix_value_t;
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Value structure support}
The following macros and \acp{API} are provided to support the \refstruct{pmix_value_t} structure.
%%%%
\littleheader{Static initializer for the value structure}
\declaremacroProvisional{PMIX_VALUE_STATIC_INIT}
Provide a static initializer for the \refstruct{pmix_value_t} fields.
\versionMarker{5.0}
\cspecificstart
\begin{codepar}
PMIX_VALUE_STATIC_INIT
\end{codepar}
\cspecificend
\littleheader{Initialize the value structure}
\declaremacro{PMIX_VALUE_CONSTRUCT}
Initialize the \refstruct{pmix_value_t} fields.
\copySignature{PMIX_VALUE_CONSTRUCT}{1.0}{
PMIX_VALUE_CONSTRUCT(m)
}
\begin{arglist}
\argin{m}{Pointer to the structure to be initialized (pointer to \refstruct{pmix_value_t})}