This source file includes following definitions.
- orte_plm_base_set_hnp_name
- orte_plm_base_create_jobid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include "orte_config.h"
21 #include "orte/constants.h"
22
23 #include <stdio.h>
24
25 #include "opal/hash_string.h"
26
27 #include "orte/mca/errmgr/errmgr.h"
28 #include "orte/util/proc_info.h"
29 #include "orte/util/name_fns.h"
30 #include "orte/runtime/orte_globals.h"
31
32 #include "orte/mca/plm/base/plm_private.h"
33
34
35
36
37
38 int orte_plm_base_set_hnp_name(void)
39 {
40 uint16_t jobfam;
41 uint32_t hash32;
42 uint32_t bias;
43
44
45 OPAL_HASH_STR(orte_process_info.nodename, hash32);
46
47 bias = (uint32_t)orte_process_info.pid;
48
49 OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output,
50 "plm:base:set_hnp_name: initial bias %ld nodename hash %lu",
51 (long)bias, (unsigned long)hash32));
52
53
54 hash32 = hash32 ^ bias;
55
56
57 jobfam = (uint16_t)(((0x0000ffff & (0xffff0000 & hash32) >> 16)) ^ (0x0000ffff & hash32));
58
59 OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output,
60 "plm:base:set_hnp_name: final jobfam %lu",
61 (unsigned long)jobfam));
62
63
64 ORTE_PROC_MY_NAME->jobid = 0xffff0000 & ((uint32_t)jobfam << 16);
65 ORTE_PROC_MY_NAME->vpid = 0;
66
67
68 ORTE_PROC_MY_HNP->jobid = ORTE_PROC_MY_NAME->jobid;
69 ORTE_PROC_MY_HNP->vpid = ORTE_PROC_MY_NAME->vpid;
70
71
72 return ORTE_SUCCESS;
73 }
74
75
76
77
78 int orte_plm_base_create_jobid(orte_job_t *jdata)
79 {
80 if (ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_RESTART)) {
81
82
83
84 return ORTE_SUCCESS;
85 }
86
87 if (UINT16_MAX == orte_plm_globals.next_jobid) {
88
89 ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
90 jdata->jobid = ORTE_JOBID_INVALID;
91 return ORTE_ERR_OUT_OF_RESOURCE;
92 }
93
94
95 jdata->jobid = ORTE_CONSTRUCT_LOCAL_JOBID(ORTE_PROC_MY_NAME->jobid, orte_plm_globals.next_jobid);
96 orte_plm_globals.next_jobid++;
97 return ORTE_SUCCESS;
98 }