3 #if (INTFACE == C_CALL)
4 void Cblacs_gridmap(
int *ConTxt,
int *usermap,
int ldup,
int nprow0,
int npcol0)
11 MPI_Comm Cblacs2sys_handle(
int BlacsCtxt);
14 int info, i, j, Iam, *iptr;
15 int myrow, mycol, nprow, npcol, Ng;
36 nprow =
Mpval(nprow0);
37 npcol =
Mpval(npcol0);
39 if ( (Ng >
BI_Np) || (nprow < 1) || (npcol < 1) )
41 "Illegal grid (%d x %d), #procs=%d", nprow, npcol,
BI_Np);
47 iptr = (
int *) malloc(i*
sizeof(
int));
48 for (j=0; j < npcol; j++)
50 for (i=0; i < nprow; i++) iptr[i*npcol+j] = usermap[j*
Mpval(ldup)+i];
52 #if (INTFACE == C_CALL)
53 tcomm = Cblacs2sys_handle(*ConTxt);
54 MPI_Comm_group(tcomm, &grp);
55 MPI_Group_incl(grp, Ng, iptr, &tgrp);
56 MPI_Comm_create(tcomm, tgrp, &comm);
57 MPI_Group_free(&tgrp);
66 if (comm == MPI_COMM_NULL)
100 MPI_Comm_dup(comm, &ctxt->
pscp.
comm);
101 MPI_Comm_rank(comm, &Iam);
108 MPI_Comm_split(comm, myrow, mycol, &ctxt->
rscp.
comm);
112 MPI_Comm_split(comm, mycol, myrow, &ctxt->
cscp.
comm);