35 #ifdef __INTEL_COMPILER
37 use ifcore,
only: tracebackqq
39 integer,
intent(in) :: errortype
40 character(len=*),
intent(in),
optional :: errormsg
41 character(len=512) :: text, text_errortype
44 if( .NOT.module_is_initialized )
call abort()
46 select case( errortype )
48 text_errortype =
'NOTE'
50 text_errortype =
'WARNING'
52 text_errortype =
'FATAL'
54 text_errortype =
'WARNING: non-existent errortype (must be NOTE|WARNING|FATAL)'
58 write( text,
'(a,i6)' ) trim(text_errortype) //
' from PE', pe
62 if(
PRESENT(errormsg) )text = trim(text) //
': ' // trim(errormsg)
64 select case( errortype )
67 write( out_unit,
'(a)' )trim(text)
68 write( warn_unit,
'(a)' )trim(text)
72 write( errunit,
'(/a/)' )trim(text)
74 write( out_unit,
'(/a/)' )trim(text)
75 write( warn_unit,
'(/a/)' )trim(text)
77 if( errortype.EQ.fatal .OR. warnings_are_fatal )
then
81 #ifdef __INTEL_COMPILER
83 call tracebackqq(user_exit_code=-1)
87 call mpi_abort( mpi_comm_world, 1, error )
91 error_state = errortype
102 function get_peset(pelist)
104 integer,
intent(in),
optional :: pelist(:)
107 integer,
allocatable :: pelist_tmp(:)
109 if( .NOT.
PRESENT(pelist) )
then
110 get_peset = current_peset_num;
return
114 if (
size(pelist(:)) .GT. 1)
then
115 do n = 2,
size(pelist(:))
116 if(pelist(n) <= pelist(n-1))
call mpp_error(fatal,
"GET_PESET: pelist is not monotonically increasing")
121 if( debug )
write( errunit,* )
'pelist=', pelist
125 if( debug )
write( errunit,
'(a,3i6)' )
'pe, i, peset_num=', pe, i, peset_num
126 if(
size(pelist(:)).EQ.
size(peset(i)%list(:)) )
then
127 if( all(pelist.EQ.peset(i)%list) )
then
128 get_peset = i;
return
133 peset_num = peset_num + 1
137 allocate( peset(i)%list(
size(pelist(:))) )
138 peset(i)%list(:) = pelist(:)
139 peset(i)%count =
size(pelist(:))
141 allocate(pelist_tmp(
size(pelist(:))))
142 pelist_tmp = pelist - mpp_root_pe()
143 call mpi_group_incl( peset(current_peset_num)%group,
size(pelist(:)), pelist_tmp, peset(i)%group, error )
144 call mpi_comm_create_group(peset(current_peset_num)%comm, peset(i)%group, &
145 default_tag, peset(i)%comm, error )
147 deallocate(pelist_tmp)
150 end function get_peset
155 integer,
intent(in),
optional :: pelist(:)
156 logical,
intent(in),
optional :: do_self
160 dself=.true.;
if(
PRESENT(do_self))dself=do_self
163 n = get_peset(pelist);
if( peset(n)%count.EQ.1 )
return
165 if( debug .and. (current_clock.NE.0) )
call system_clock(start_tick)
166 call mpi_barrier( peset(n)%comm, error )
168 if( debug .and. (current_clock.NE.0) )
call increment_current_clock(event_wait)
178 integer,
intent(in),
optional :: pelist(:)
179 integer,
intent(in),
optional :: check
180 type(mpi_request),
intent(inout),
optional :: request(:)
181 integer,
intent(in ),
optional :: msg_size(:)
182 type(mpi_datatype),
intent(in ),
optional :: msg_type(:)
184 integer :: m, my_check, rsize
186 if( debug .and. (current_clock.NE.0) )
call system_clock(start_tick)
187 my_check = event_send
188 if(
present(check)) my_check = check
189 if( my_check .NE. event_send .AND. my_check .NE. event_recv )
then
190 call mpp_error( fatal,
'mpp_sync_self: The value of optional argument check should be EVENT_SEND or EVENT_RECV')
193 if(
PRESENT(request))
then
194 if( .not.
present(check) )
then
195 call mpp_error(fatal,
'mpp_sync_self: check is not present when request is present')
197 if( my_check == event_recv )
then
198 if( .not.
present(msg_size) )
then
199 call mpp_error(fatal,
'mpp_sync_self: msg_size is not present when request is present and it is EVENT_RECV')
201 if( .not.
present(msg_type) )
then
202 call mpp_error(fatal,
'mpp_sync_self: msg_type is not present when request is present and it is EVENT_RECV')
204 if(
size(msg_size) .NE.
size(request))
then
205 call mpp_error(fatal,
'mpp_sync_self: dimension mismatch between msg_size and request')
207 if(
size(msg_type) .NE.
size(request))
then
208 call mpp_error(fatal,
'mpp_sync_self: dimension mismatch between msg_type and request')
211 do m = 1,
size(request(:))
212 if( request(m) == mpi_request_null ) cycle
213 call mpi_wait(request(m), stat, error )
214 call mpi_get_count(stat, msg_type(m), rsize, error)
215 if(msg_size(m) .NE. rsize)
then
216 call mpp_error(fatal,
"mpp_sync_self: msg_size does not match size of data received")
220 do m = 1,
size(request(:))
221 if(request(m) .NE.mpi_request_null )
call mpi_wait(request(m), stat, error )
225 select case(my_check)
227 do m = 1,cur_send_request
228 if( request_send(m).NE.mpi_request_null )
call mpi_wait( request_send(m), stat, error )
232 do m = 1,cur_recv_request
233 call mpi_wait( request_recv(m), stat, error )
234 call mpi_get_count(stat, type_recv(m), rsize, error)
235 if(size_recv(m) .NE. rsize)
then
236 call mpp_error(fatal,
"mpp_sync_self: size_recv does not match of data received")
243 if( debug .and. (current_clock.NE.0) )
call increment_current_clock(event_wait)
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...
subroutine mpp_error_basic(errortype, errormsg)
A very basic error handler uses ABORT and FLUSH calls, may need to use cpp to rename.
integer function stderr()
This function returns the current standard fortran unit numbers for error messages.
subroutine mpp_sync(pelist, do_self)
Synchronize PEs in list.
subroutine expand_peset()
This routine will double the size of peset and copy the original peset data into the expanded one....