@@ -132,8 +132,8 @@ static void verbose_comm_errhandler(MPI_Comm* pcomm, int* err, ...){
132
132
MPI_Group group_c , group_f ;
133
133
comm = * pcomm ;
134
134
135
- memset (ranks_gf ,0 ,sizeof (int )* caf_num_images );
136
- memset (ranks_gc ,0 ,sizeof (int )* caf_num_images );
135
+ /* memset(ranks_gf,0,sizeof(int)*caf_num_images); */
136
+ /* memset(ranks_gc,0,sizeof(int)*caf_num_images); */
137
137
138
138
MPIX_Comm_failure_ack (comm );
139
139
MPIX_Comm_failure_get_acked (comm , & group_f );
@@ -144,15 +144,10 @@ static void verbose_comm_errhandler(MPI_Comm* pcomm, int* err, ...){
144
144
MPI_Group_translate_ranks (group_f , nf , ranks_gf ,
145
145
group_c , ranks_gc );
146
146
for (i = 0 ; i < nf ; i ++ )
147
- {
148
- ranks_gc [i ]++ ;
149
- /* printf("me: %d - ranks failed %d\n",caf_this_image,ranks_gc[i]); */
150
- }
147
+ ranks_gc [i ]++ ;
151
148
152
- n_failed_imgs = nf ;
149
+ n_failed_imgs + = nf ;
153
150
error_called = 1 ;
154
- /* used_comm++; */
155
- /* CAF_COMM_WORLD = communicators[used_comm]; */
156
151
}
157
152
158
153
/* For MPI interoperability, allow external initialization
@@ -500,21 +495,21 @@ PREFIX (init) (int *argc, char ***argv)
500
495
501
496
MPI_Win_create_errhandler (verbose_win_errhandler , & errh_w );
502
497
503
- ranks_gf = (int * )malloc (caf_num_images * sizeof (int ));
504
- ranks_gc = (int * )malloc (caf_num_images * sizeof (int ));
498
+ ranks_gf = (int * )calloc (caf_num_images , sizeof (int ));
499
+ ranks_gc = (int * )calloc (caf_num_images , sizeof (int ));
505
500
stopped_images = (int * )calloc (caf_num_images , sizeof (int ));
506
501
507
502
#if MPI_VERSION >= 3
508
503
MPI_Info_create (& mpi_info_same_size );
509
504
MPI_Info_set (mpi_info_same_size , "same_size" , "true" );
510
505
/* Setting img_status */
511
- MPI_Win_allocate (sizeof (int ), 1 , mpi_info_same_size , CAF_COMM_WORLD , & img_status , stat_tok );
506
+ MPI_Win_allocate (sizeof (int ), 1 , mpi_info_same_size , stopped_comm , & img_status , stat_tok );
512
507
# ifndef CAF_MPI_LOCK_UNLOCK
513
508
MPI_Win_lock_all (MPI_MODE_NOCHECK , * stat_tok );
514
509
# endif // CAF_MPI_LOCK_UNLOCK
515
510
#else
516
511
MPI_Alloc_mem (sizeof (int ), MPI_INFO_NULL , & img_status , stat_tok );
517
- MPI_Win_create (img_status , sizeof (int ), 1 , MPI_INFO_NULL , CAF_COMM_WORLD , stat_tok );
512
+ MPI_Win_create (img_status , sizeof (int ), 1 , MPI_INFO_NULL , stopped_comm , stat_tok );
518
513
#endif // MPI_VERSION
519
514
* img_status = 0 ;
520
515
MPI_Win_set_errhandler (* stat_tok ,errh_w );
@@ -539,7 +534,7 @@ PREFIX (finalize) (void)
539
534
communicator_shrink (& CAF_COMM_WORLD );
540
535
541
536
MPI_Barrier (stopped_comm );
542
-
537
+
543
538
while (caf_static_list != NULL )
544
539
{
545
540
caf_static_t * tmp = caf_static_list -> prev ;
@@ -643,6 +638,7 @@ void *
643
638
void * mem ;
644
639
size_t actual_size ;
645
640
int l_var = 0 , * init_array = NULL ,ierr = 0 ,flag = 0 ;
641
+ MPI_Win * stopped_win ;
646
642
647
643
if (unlikely (caf_is_finalized ))
648
644
goto error ;
@@ -658,6 +654,7 @@ void *
658
654
/* Token contains only a list of pointers. */
659
655
660
656
* token = malloc (sizeof (MPI_Win ));
657
+ stopped_win = (MPI_Win * )malloc (sizeof (MPI_Win ));
661
658
662
659
MPI_Win * p = * token ;
663
660
@@ -671,7 +668,7 @@ void *
671
668
else
672
669
actual_size = size ;
673
670
674
- MPI_Test ( & lock_req , & flag , MPI_STATUS_IGNORE );
671
+ MPI_Barrier ( CAF_COMM_WORLD );
675
672
676
673
if (error_called == 1 )
677
674
{
@@ -710,18 +707,21 @@ void *
710
707
/* PREFIX(sync_all) (NULL,NULL,0); */
711
708
}
712
709
713
- MPI_Barrier (CAF_COMM_WORLD );
710
+ /* MPI_Barrier(CAF_COMM_WORLD); */
714
711
715
- if (error_called == 1 )
716
- {
717
- communicator_shrink (& CAF_COMM_WORLD );
718
- error_called = 0 ;
719
- ierr = STAT_FAILED_IMAGE ;
720
- }
712
+ /* if(error_called == 1) */
713
+ /* { */
714
+ /* communicator_shrink(&CAF_COMM_WORLD); */
715
+ /* error_called = 0; */
716
+ /* ierr = STAT_FAILED_IMAGE; */
717
+ /* } */
721
718
719
+ /* MPI_Win_create_dynamic(MPI_INFO_NULL, stopped_comm, stopped_win); */
720
+
722
721
caf_static_t * tmp = malloc (sizeof (caf_static_t ));
723
722
tmp -> prev = caf_tot ;
724
723
tmp -> token = * token ;
724
+ tmp -> stopped_token = stopped_win ;
725
725
caf_tot = tmp ;
726
726
727
727
if (type == CAF_REGTYPE_COARRAY_STATIC )
0 commit comments