Skip to content

Commit aa4a61a

Browse files
author
Alessandro Fanfarillo
committed
Sorting failed images
1 parent b3d2f9e commit aa4a61a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/mpi/mpi_caf.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ int *ranks_gc,*ranks_gf; //to be returned by failed images
114114
MPI_Errhandler errh,errh_w;
115115
int completed = 0,tmp_lock;
116116

117+
static int cmpfunc (const void *a, const void *b)
118+
{
119+
return ( *(int*)a - *(int*)b );
120+
}
121+
117122
static void verbose_win_errhandler(MPI_Win* win, int* err, ...) {
118123
/* printf("in win err handler\n"); */
119124
/* used_comm++; */
@@ -278,13 +283,6 @@ void mutex_lock(MPI_Win win, int image_index, int index, int *stat,
278283

279284
MPI_Test(&lock_req,&flag,MPI_STATUS_IGNORE);
280285

281-
/* if(error_called == 1) */
282-
/* { */
283-
/* /\* MPIX_Comm_agree( CAF_COMM_WORLD, &completed ); *\/ */
284-
/* communicator_shrink(&CAF_COMM_WORLD); */
285-
/* error_called = 0; */
286-
/* } */
287-
288286
if(error_called == 1)
289287
{
290288
/* communicator_shrink(&lock_comm); */
@@ -318,7 +316,7 @@ void mutex_lock(MPI_Win win, int image_index, int index, int *stat,
318316

319317
if(error_called == 1)
320318
{
321-
//communicator_shrink(&lock_comm);
319+
/* communicator_shrink(&lock_comm); */
322320
communicator_shrink(&CAF_COMM_WORLD);
323321
error_called = 0;
324322
}
@@ -2728,6 +2726,7 @@ PREFIX (failed_images) (gfc_descriptor_t *array, int team __attribute__ ((unused
27282726
int *mem = (int *)calloc(n_failed_imgs,sizeof(int));
27292727
array->base_addr = mem;
27302728
memcpy(mem,ranks_gc,n_failed_imgs*sizeof(int));
2729+
qsort(mem,n_failed_imgs,sizeof(int),cmpfunc);
27312730
array->dtype = 265;
27322731
array->dim[0].lower_bound = 1;
27332732
array->dim[0]._ubound = n_failed_imgs;

0 commit comments

Comments
 (0)