43 integer,
private,
parameter :: fpm_manager_master = 0
45 integer,
private :: fpm_universal_comm
46 integer,
private :: fpm_unv_myproc
47 integer,
private :: fpm_unv_nprocs
48 integer,
private :: fpm_global_comm
49 integer,
private :: fpm_glb_myproc
50 integer,
private :: fpm_glb_nprocs
51 integer,
private :: fpm_local_comm
52 integer,
private :: fpm_local_master
53 integer,
private :: fpm_lcl_myproc
54 integer,
private :: fpm_lcl_nprocs
56 integer,
private :: fpm_manager_comm
57 integer,
private :: fpm_num_member
59 logical,
private :: fpm_master
60 logical,
private :: fpm_manager
61 logical,
private,
allocatable :: fpm_running(:)
62 logical,
private,
allocatable :: fpm_lcl_running(:)
80 integer,
intent(in) :: max_failure
81 integer,
intent(in) :: polling_freq
82 integer,
intent(in) :: universal_comm
83 integer,
intent(in) :: global_comm
84 integer,
intent(in) :: local_comm
85 integer,
intent(in) :: num_member
86 integer,
intent(in) :: global_root(:)
87 logical,
intent(in) :: use_fpm
89 integer,
allocatable :: manager_list(:)
90 integer,
allocatable :: exclude_list(:)
91 integer :: num_exclude
93 integer :: group_manager
101 fpm_manager = .false.
102 fpm_num_member = num_member
107 fpm_universal_comm = universal_comm
108 call mpi_comm_rank( fpm_universal_comm, fpm_unv_myproc, ierr )
109 call mpi_comm_size( fpm_universal_comm, fpm_unv_nprocs, ierr )
110 fpm_global_comm = global_comm
111 call mpi_comm_rank( fpm_global_comm, fpm_glb_myproc, ierr )
112 call mpi_comm_size( fpm_global_comm, fpm_glb_nprocs, ierr )
113 fpm_local_comm = local_comm
115 call mpi_comm_rank( fpm_local_comm, fpm_lcl_myproc, ierr )
116 call mpi_comm_size( fpm_local_comm, fpm_lcl_nprocs, ierr )
118 if ( fpm_unv_myproc == fpm_manager_master ) fpm_master = .true.
119 if ( fpm_master )
write(*,*)
''
120 if ( fpm_master )
write(*,*)
'*** Failure Procs Manager: available'
121 if ( fpm_master )
write(*,*)
'*** Threshold of Failure Procs = ',
fpm_max_failure
122 if ( fpm_master )
then
126 write(*,*)
'*** FPM: NO Polling'
131 allocate( manager_list(fpm_num_member) )
132 do i=1, fpm_num_member
133 manager_list(i) = global_root(i)
134 if ( fpm_unv_myproc == manager_list(i) ) fpm_manager = .true.
137 num_exclude = fpm_unv_nprocs - fpm_num_member
138 allocate( exclude_list(num_exclude) )
141 do i=0, fpm_unv_nprocs-1
142 if ( i == manager_list(j) )
then
143 if ( j < fpm_num_member ) j = j + 1
146 if ( k < num_exclude ) k = k + 1
150 call mpi_comm_group( fpm_universal_comm, &
153 call mpi_group_excl( group_univ, &
158 call mpi_comm_create( fpm_universal_comm, &
163 allocate( fpm_running(fpm_num_member) )
164 allocate( fpm_lcl_running(fpm_lcl_nprocs) )
165 fpm_running(:) = .true.
166 fpm_lcl_running(:) = .true.
177 logical,
intent(in ) :: run_stat
178 logical,
intent(out) :: stop_signal
180 integer :: sendcounts, recvcounts
185 logical :: local_stat
191 stop_signal = .false.
196 call mpi_gather( sendbuff, &
199 fpm_lcl_running(:), &
208 if ( fpm_manager )
then
209 do i=1, fpm_lcl_nprocs
210 if ( .NOT. fpm_lcl_running(i) )
then
217 sendbuff = local_stat
218 call mpi_gather( sendbuff, &
224 fpm_manager_master, &
230 if ( fpm_master )
then
232 do i=1, fpm_num_member
233 if ( .NOT. fpm_running(i) )
then
234 failcount = failcount + 1
241 stop_signal = .false.
249 call mpi_bcast( stop_signal, &
252 fpm_manager_master, &
253 fpm_universal_comm, &