2015-05-06 12:46:55 -06:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2004-02-27 19:22:14 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* 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.
|
2015-06-23 20:59:57 -07:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 20:09:25 +00:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2007-08-04 00:41:26 +00:00
|
|
|
* Copyright (c) 2006-2007 University of Houston. All rights reserved.
|
2015-05-06 12:46:55 -06:00
|
|
|
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2004-02-27 19:22:14 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 01:03:09 +00:00
|
|
|
#include "ompi_config.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "ompi/group/group.h"
|
|
|
|
#include "ompi/constants.h"
|
2004-02-27 19:22:14 +00:00
|
|
|
|
2004-04-13 23:42:31 +00:00
|
|
|
/*
|
|
|
|
* Set group rank in a group structure.
|
|
|
|
*/
|
2004-11-05 07:52:30 +00:00
|
|
|
void ompi_set_group_rank(ompi_group_t *group, struct ompi_proc_t *proc_pointer)
|
2004-02-27 19:22:14 +00:00
|
|
|
{
|
|
|
|
/* local variables */
|
|
|
|
int proc;
|
|
|
|
|
2004-06-15 00:08:57 +00:00
|
|
|
/* set the rank to MPI_UNDEFINED, just in case this process is not
|
2004-02-27 19:22:14 +00:00
|
|
|
* in this group
|
|
|
|
*/
|
2004-06-15 00:08:57 +00:00
|
|
|
group->grp_my_rank = MPI_UNDEFINED;
|
2004-04-13 23:42:31 +00:00
|
|
|
if (NULL != proc_pointer) {
|
2004-02-27 19:22:14 +00:00
|
|
|
/* loop over all procs in the group */
|
2004-04-13 23:42:31 +00:00
|
|
|
for (proc = 0; proc < group->grp_proc_count; proc++) {
|
2004-02-27 19:22:14 +00:00
|
|
|
/* check and see if this proc pointer matches proc_pointer
|
|
|
|
*/
|
2015-05-06 12:46:55 -06:00
|
|
|
if (ompi_group_peer_lookup_existing (group, proc) == proc_pointer) {
|
2004-02-27 19:22:14 +00:00
|
|
|
group->grp_my_rank = proc;
|
2015-05-06 12:46:55 -06:00
|
|
|
break;
|
|
|
|
}
|
2004-04-13 23:42:31 +00:00
|
|
|
} /* end proc loop */
|
2004-02-27 19:22:14 +00:00
|
|
|
}
|
|
|
|
}
|