Skip to content

Commit 8765f6b

Browse files
author
Alessandro Fanfarillo
committed
First Aurelien patch
1 parent 5737bca commit 8765f6b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/mpi/mpi_caf.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,9 @@ PREFIX (num_images)(int distance __attribute__ ((unused)),
639639
int communicator_shrink(MPI_Comm *comm)
640640
{
641641
int ns,srank,crank,rc,flag,i,drank,nc,nd;
642-
MPI_Comm shrunk, *newcomm;
642+
MPI_Comm shrunk, newcomm;
643643
MPI_Group cgrp, sgrp, dgrp;
644644

645-
newcomm = (MPI_Comm *)calloc(1,sizeof(MPI_Comm));
646645
redo:
647646
MPIX_Comm_shrink(*comm, &shrunk);
648647
MPI_Comm_set_errhandler( shrunk, errh );
@@ -654,7 +653,7 @@ int communicator_shrink(MPI_Comm *comm)
654653
* so that all surviving processes remain at their former place */
655654
if (img_status == STAT_STOPPED_IMAGE)
656655
crank = -1;
657-
rc = MPI_Comm_split(shrunk, crank<0?MPI_UNDEFINED:1, crank, newcomm);
656+
rc = MPI_Comm_split(shrunk, crank<0?MPI_UNDEFINED:1, crank, &newcomm);
658657
flag = (rc == MPI_SUCCESS);
659658
/* Split or some of the communications above may have failed if
660659
* new failures have disrupted the process: we need to
@@ -663,10 +662,10 @@ int communicator_shrink(MPI_Comm *comm)
663662

664663
MPI_Comm_free(&shrunk);
665664
if( MPI_SUCCESS != flag ) {
666-
if( MPI_SUCCESS == rc ) MPI_Comm_free(*newcomm);
665+
if( MPI_SUCCESS == rc ) MPI_Comm_free(newcomm);
667666
goto redo;
668667
}
669-
*comm = *newcomm;
668+
*comm = newcomm;
670669
return MPI_SUCCESS;
671670
}
672671

0 commit comments

Comments
 (0)