1
1
openmpi/ompi/group/group_set_rank.c
Nathan Hjelm 0bf06de3f1 group|comm: add initial support for group sentinel values
This commit modifies ompi's process list group object to support a
sentinel value for non-existant ompi_proc_t objects. The sentinel was
chosen to be the negative of the opal_process_name_t of the associated
ompi_proc_t. This takes advantage of the fact that on most (all?)
systems the top bit of a user-space pointer is never set. If this
changes then a new sentinel will be needed.

In addition this commit modifies the way ompi_mpi_comm_world is
initialized to fill in the group with sentinel values if the number of
processes exceeds the new add_procs behavior cutoff.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2015-09-10 08:55:54 -06:00

51 строка
1.7 KiB
C

/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/group/group.h"
#include "ompi/constants.h"
/*
* Set group rank in a group structure.
*/
void ompi_set_group_rank(ompi_group_t *group, struct ompi_proc_t *proc_pointer)
{
/* local variables */
int proc;
/* set the rank to MPI_UNDEFINED, just in case this process is not
* in this group
*/
group->grp_my_rank = MPI_UNDEFINED;
if (NULL != proc_pointer) {
/* loop over all procs in the group */
for (proc = 0; proc < group->grp_proc_count; proc++) {
/* check and see if this proc pointer matches proc_pointer
*/
if (ompi_group_peer_lookup_existing (group, proc) == proc_pointer) {
group->grp_my_rank = proc;
break;
}
} /* end proc loop */
}
}