2004-01-21 03:05:46 +03:00
|
|
|
/*
|
|
|
|
* $HEADERS$
|
|
|
|
*/
|
|
|
|
#include "lam_config.h"
|
|
|
|
#include <stdio.h>
|
2004-03-26 23:03:38 +03:00
|
|
|
#include <string.h>
|
2004-01-21 03:05:46 +03:00
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-03-26 23:03:38 +03:00
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "communicator/communicator.h"
|
|
|
|
|
2004-01-21 03:05:46 +03:00
|
|
|
|
|
|
|
#if LAM_HAVE_WEAK_SYMBOLS && LAM_PROFILING_DEFINES
|
|
|
|
#pragma weak MPI_Comm_remote_group = PMPI_Comm_remote_group
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group *group) {
|
2004-03-26 23:03:38 +03:00
|
|
|
|
|
|
|
lam_communicator_t *comp;
|
|
|
|
lam_group_t *group_p;
|
|
|
|
|
|
|
|
if ( MPI_PARAM_CHECK ) {
|
|
|
|
if ( lam_mpi_finalized )
|
|
|
|
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
|
|
|
|
"MPI_Comm_remote_group");
|
|
|
|
|
|
|
|
if (MPI_COMM_NULL == comm || lam_comm_invalid (comm))
|
|
|
|
return LAM_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
|
|
|
"MPI_Comm_remote_group");
|
|
|
|
|
|
|
|
if ( NULL == group )
|
|
|
|
return LAM_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
|
|
|
|
"MPI_Comm_remote_group");
|
|
|
|
}
|
|
|
|
|
|
|
|
comp = (lam_communicator_t *) comm;
|
|
|
|
if ( comp->c_flags & LAM_COMM_INTER ) {
|
|
|
|
/* get new group struct */
|
|
|
|
group_p=lam_group_allocate(comp->c_remote_group->grp_proc_count);
|
|
|
|
if( NULL == group_p ) {
|
|
|
|
return LAM_ERRHANDLER_INVOKE (comm, MPI_ERR_INTERN,
|
|
|
|
"MPI_Comm_remote_group");
|
|
|
|
}
|
|
|
|
|
|
|
|
group_p->grp_my_rank = MPI_UNDEFINED;
|
|
|
|
memcpy ( group_p->grp_proc_pointers,
|
|
|
|
comp->c_remote_group->grp_proc_pointers,
|
|
|
|
group_p->grp_proc_count * sizeof ( lam_proc_t *));
|
|
|
|
/* increment proc reference counters */
|
|
|
|
lam_group_increment_proc_count(group_p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return LAM_ERRHANDLER_INVOKE (comm, MPI_ERR_COMM,
|
|
|
|
"MPI_Comm_remote_group");
|
|
|
|
|
|
|
|
*group = (MPI_Group) group_p;
|
2004-01-21 03:05:46 +03:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|