--- libscotch/hdgraph_gather.c.orig 2012-11-27 00:31:49.000000000 +0100 +++ libscotch/hdgraph_gather.c 2014-05-13 13:02:55.509944000 +0200 @@ -100,9 +100,15 @@ Gnum reduglbtab[4]; int * restrict recvcnttab; /* Arrays for parametrizing gather operations */ int * restrict recvdsptab; + Gnum * restrict grecvdsptab; int cheklocval; int chekglbval; Gnum degrmax; +#ifdef NO_GLOBAL_GATHERV + int rank, nrank; + MPI_Comm_rank(dgrfptr->s.proccomm,&rank); + MPI_Comm_size(dgrfptr->s.proccomm,&nrank); +#endif if (cgrfptr != NULL) { /* If centralized graph provided */ reduloctab[0] = 1; /* This process is the root */ @@ -166,6 +172,13 @@ errorPrint ("hdgraphGather: out of memory (3)"); cheklocval = 1; } + else if (cgrfptr->s.edgetax -= dgrfptr->s.baseval, + memAllocGroup ((void **) (void *) + &recvcnttab, (size_t) (dgrfptr->s.procglbnbr * sizeof (Gnum)), + &grecvdsptab, (size_t) (dgrfptr->s.procglbnbr * sizeof (Gnum)), NULL) == NULL) { + errorPrint ("hdgraphGather: out of memory (3)"); + cheklocval = 1; + } else { cgrfptr->s.baseval = dgrfptr->s.baseval; cgrfptr->s.vertnbr = vertnbr; @@ -251,14 +264,29 @@ recvcnttab[procglbnum] = cgrfptr->s.verttax[dgrfptr->s.procdsptab[procglbnum + 1]] - cgrfptr->s.verttax[dgrfptr->s.procdsptab[procglbnum]]; /* verttax used twice since centralized graph is compact */ recvdsptab[procglbnum] = edgenum; + grecvdsptab[procglbnum] = edgenum; edgenum += recvcnttab[procglbnum]; } +#ifdef NO_GLOBAL_GATHERV + int i; + for (i=0; is.edgetax,dgrfptr->s.edgeloctax + dgrfptr->s.baseval,(int) (dgrfptr->s.edgelocnbr + dgrfptr->ehallocnbr)*sizeof(Gnum)); + continue; + } + if (MPI_Recv(cgrfptr->s.edgetax+grecvdsptab[i],recvcnttab[i],GNUM_MPI,i,i,dgrfptr->s.proccomm,MPI_STATUS_IGNORE) != MPI_SUCCESS) { + errorPrint ("hdgraphGather: communication error (5)"); + return (1); + } + } +#else if (MPI_Gatherv (dgrfptr->s.edgeloctax + dgrfptr->s.baseval, /* Gather edge arrays with global vertex indices */ (int) (dgrfptr->s.edgelocnbr + dgrfptr->ehallocnbr), GNUM_MPI, cgrfptr->s.edgetax, recvcnttab, recvdsptab, GNUM_MPI, rootnum, dgrfptr->s.proccomm) != MPI_SUCCESS) { errorPrint ("hdgraphGather: communication error (5)"); return (1); } +#endif } else { if (MPI_Gatherv (dgrfptr->s.vertloctax + 1 + dgrfptr->s.baseval, /* Do not send first index, it is always equal to baseval */ @@ -271,12 +299,20 @@ errorPrint ("hdgraphGather: communication error (7)"); return (1); } + +#ifdef NO_GLOBAL_GATHERV + if (MPI_Send(dgrfptr->s.edgeloctax + dgrfptr->s.baseval, (int) (dgrfptr->s.edgelocnbr + dgrfptr->ehallocnbr), GNUM_MPI, rootnum, rank, dgrfptr->s.proccomm) != MPI_SUCCESS) { + errorPrint ("hdgraphGather: communication error (8)"); + return (1); + } +#else if (MPI_Gatherv (dgrfptr->s.edgeloctax + dgrfptr->s.baseval, /* Gather edge arrays with global vertex indices */ (int) (dgrfptr->s.edgelocnbr + dgrfptr->ehallocnbr), GNUM_MPI, NULL, NULL, NULL, GNUM_MPI, rootnum, dgrfptr->s.proccomm) != MPI_SUCCESS) { errorPrint ("hdgraphGather: communication error (8)"); return (1); } +#endif } } else {