Skip to content

Commit

Permalink
sentinel: fix 32 bits arch
Browse files Browse the repository at this point in the history
since a sentinel is only made from the current job, only store the
first 31 bits of the vpid into the sentinel.
  • Loading branch information
ggouaillardet committed Feb 10, 2016
1 parent b55b9e6 commit 96310f4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions ompi/proc/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ static inline bool ompi_proc_is_sentinel (ompi_proc_t *proc)
return (intptr_t) proc & 0x1;
}

#if OPAL_SIZEOF_PROCESS_NAME_T == SIZEOF_VOID_P
/*
* we assume an ompi_proc_t is at least aligned on two bytes,
* so if the LSB of a pointer to an ompi_proc_t is 1, we have to handle
Expand Down Expand Up @@ -407,6 +408,27 @@ static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel
name.vpid = vpid;
return name;
}
#elif 4 == SIZEOF_VOID_P
/*
* currently, a sentinel is only made from the current jobid aka OMPI_PROC_MY_NAME->jobid
* so we only store the first 31 bits of the vpid
*/
static inline uintptr_t ompi_proc_name_to_sentinel (opal_process_name_t name)
{
assert(OMPI_PROC_MY_NAME->jobid == name.jobid);
return (uintptr_t)((name.vpid <<1) | 0x1);
}

static inline opal_process_name_t ompi_proc_sentinel_to_name (uintptr_t sentinel)
{
opal_process_name_t name;
name.jobid = OMPI_PROC_MY_NAME->jobid;
name.vpid = sentinel >> 1;
return name;
}
#else
#error unsupported pointer size
#endif

END_C_DECLS

Expand Down
3 changes: 2 additions & 1 deletion opal/dss/dss_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -47,6 +47,7 @@ typedef struct {
opal_jobid_t jobid;
opal_vpid_t vpid;
} opal_process_name_t;
#define OPAL_SIZEOF_PROCESS_NAME_T 8

BEGIN_C_DECLS

Expand Down

0 comments on commit 96310f4

Please sign in to comment.