Skip to content

Commit 4c5029c

Browse files
committed
sentinel: uses local jobid and family as uint32_t and fix abstraction
1 parent fe3941c commit 4c5029c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

ompi/mca/rte/orte/rte_orte.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All rights reserved.
44
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
6-
* Copyright (c) 2014 Research Organization for Information Science
6+
* Copyright (c) 2014-2016 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
88
* Copyright (c) 2015 Intel, Inc. All rights reserved.
99
* $COPYRIGHT$
@@ -59,6 +59,10 @@ typedef orte_ns_cmp_bitmask_t ompi_rte_cmp_bitmask_t;
5959
#define OMPI_RTE_CMP_JOBID ORTE_NS_CMP_JOBID
6060
#define OMPI_RTE_CMP_VPID ORTE_NS_CMP_VPID
6161
#define OMPI_RTE_CMP_ALL ORTE_NS_CMP_ALL
62+
#define OMPI_LOCAL_JOBID(jobid) ORTE_LOCAL_JOBID(jobid)
63+
#define OMPI_JOB_FAMILY(jobid) ORTE_JOB_FAMILY(jobid)
64+
#define OMPI_CONSTRUCT_JOBID(family,local) ORTE_CONSTRUCT_JOBID(family,local)
65+
6266
/* This is the DSS tag to serialize a proc name */
6367
#define OMPI_NAME ORTE_NAME
6468
#define OMPI_PROCESS_NAME_HTON ORTE_PROCESS_NAME_HTON

ompi/proc/proc.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,21 @@ static inline bool ompi_proc_is_sentinel (ompi_proc_t *proc)
373373
* we assume an ompi_proc_t is at least aligned on two bytes,
374374
* so if the LSB of a pointer to an ompi_proc_t is 1, we have to handle
375375
* this pointer as a sentinel instead of a pointer.
376-
* a sentinel can be seen as a 64 bits array with the following format :
376+
* a sentinel can be seen as an uint64_t with the following format :
377377
* - bit 0 : 1
378378
* - bits 1-15 : local jobid
379379
* - bits 16-31 : job family
380380
* - bits 32-63 : vpid
381381
*/
382382
static inline uintptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
383383
{
384-
uintptr_t tmp, sentinel = 0x1;
384+
uintptr_t tmp, sentinel = 0;
385385
/* local jobid must fit in 15 bits */
386-
assert(! (ORTE_LOCAL_JOBID(name.jobid) & 0x8000));
387-
tmp = (uintptr_t)ORTE_LOCAL_JOBID(name.jobid);
386+
assert(! (OMPI_LOCAL_JOBID(name.jobid) & 0x8000));
387+
sentinel |= 0x1;
388+
tmp = (uintptr_t)OMPI_LOCAL_JOBID(name.jobid);
388389
sentinel |= ((tmp << 1) & 0xfffe);
389-
tmp = (uintptr_t)ORTE_JOB_FAMILY(name.jobid);
390+
tmp = (uintptr_t)OMPI_JOB_FAMILY(name.jobid);
390391
sentinel |= ((tmp << 16) & 0xffff0000);
391392
tmp = (uintptr_t)name.vpid;
392393
sentinel |= ((tmp << 32) & 0xffffffff00000000);
@@ -396,13 +397,13 @@ static inline uintptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
396397
static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel)
397398
{
398399
opal_process_name_t name;
399-
uint16_t local, family;
400+
uint32_t local, family;
400401
uint32_t vpid;
401402
assert(sentinel & 0x1);
402403
local = (sentinel >> 1) & 0x7fff;
403404
family = (sentinel >> 16) & 0xffff;
404405
vpid = (sentinel >> 32) & 0xffffffff;
405-
name.jobid = ORTE_CONSTRUCT_JOBID(family,local);
406+
name.jobid = OMPI_CONSTRUCT_JOBID(family,local);
406407
name.vpid = vpid;
407408
return name;
408409
}

0 commit comments

Comments
 (0)