Skip to content

Commit 96310f4

Browse files
committed
sentinel: fix 32 bits arch
since a sentinel is only made from the current job, only store the first 31 bits of the vpid into the sentinel.
1 parent b55b9e6 commit 96310f4

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ompi/proc/proc.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static inline bool ompi_proc_is_sentinel (ompi_proc_t *proc)
369369
return (intptr_t) proc & 0x1;
370370
}
371371

372+
#if OPAL_SIZEOF_PROCESS_NAME_T == SIZEOF_VOID_P
372373
/*
373374
* we assume an ompi_proc_t is at least aligned on two bytes,
374375
* so if the LSB of a pointer to an ompi_proc_t is 1, we have to handle
@@ -407,6 +408,27 @@ static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel
407408
name.vpid = vpid;
408409
return name;
409410
}
411+
#elif 4 == SIZEOF_VOID_P
412+
/*
413+
* currently, a sentinel is only made from the current jobid aka OMPI_PROC_MY_NAME->jobid
414+
* so we only store the first 31 bits of the vpid
415+
*/
416+
static inline uintptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
417+
{
418+
assert(OMPI_PROC_MY_NAME->jobid == name.jobid);
419+
return (uintptr_t)((name.vpid <<1) | 0x1);
420+
}
421+
422+
static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel)
423+
{
424+
opal_process_name_t name;
425+
name.jobid = OMPI_PROC_MY_NAME->jobid;
426+
name.vpid = sentinel >> 1;
427+
return name;
428+
}
429+
#else
430+
#error unsupported pointer size
431+
#endif
410432

411433
END_C_DECLS
412434

opal/dss/dss_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights
1515
* reserved.
1616
* Copyright (c) 2014 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2014 Research Organization for Information Science
17+
* Copyright (c) 2014-2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
2020
*
@@ -47,6 +47,7 @@ typedef struct {
4747
opal_jobid_t jobid;
4848
opal_vpid_t vpid;
4949
} opal_process_name_t;
50+
#define OPAL_SIZEOF_PROCESS_NAME_T 8
5051

5152
BEGIN_C_DECLS
5253

0 commit comments

Comments
 (0)