Blame test/mpi/group/glpid.c
|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include "mpiimpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int main(int argc, char *argv[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPIR_Group group, *group_ptr = &group;
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Init(&argc, &argv);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Setup a sample group */
|
|
Packit Service |
c5cf8c |
group.handle = 1;
|
|
Packit Service |
c5cf8c |
group.ref_count = 1;
|
|
Packit Service |
c5cf8c |
group.size = 4;
|
|
Packit Service |
c5cf8c |
group.rank = 0;
|
|
Packit Service |
c5cf8c |
group.idx_of_first_lpid = -1;
|
|
Packit Service |
c5cf8c |
group.lrank_to_lpid = (MPII_Group_pmap_t *)
|
|
Packit Service |
c5cf8c |
MPL_malloc(group.size * sizeof(MPII_Group_pmap_t), MPL_MEM_OTHER);
|
|
Packit Service |
c5cf8c |
for (i = 0; i < group.size; i++) {
|
|
Packit Service |
c5cf8c |
group.lrank_to_lpid[i].lrank = i;
|
|
Packit Service |
c5cf8c |
group.lrank_to_lpid[i].lpid = group.size - i - 1;
|
|
Packit Service |
c5cf8c |
group.lrank_to_lpid[i].next_lpid = -1;
|
|
Packit Service |
c5cf8c |
group.lrank_to_lpid[i].flag = 0;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Set up the group lpid list */
|
|
Packit Service |
c5cf8c |
MPII_Group_setup_lpid_list(group_ptr);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Print the group structure */
|
|
Packit Service |
c5cf8c |
printf("Index of first lpid = %d\n", group.idx_of_first_lpid);
|
|
Packit Service |
c5cf8c |
for (i = 0; i < group.size; i++) {
|
|
Packit Service |
c5cf8c |
printf("lrank_to_lpid[%d].next_lpid = %d, .lpid = %d\n",
|
|
Packit Service |
c5cf8c |
i, group.lrank_to_lpid[i].next_lpid, group.lrank_to_lpid[i].lpid);
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI_Finalize();
|
|
Packit Service |
c5cf8c |
return 0;
|
|
Packit Service |
c5cf8c |
}
|