74 TYPE(t_region
),
POINTER :: regions(:)
80 CHARACTER(CHRLEN) :: rcsidentstring
82 INTEGER :: errorflag,ijk,ilev,ir,ireg,naiv,narv,nbuffrecvi,nbuffrecvr,&
83 nbuffsendi,nbuffsendr,ncv,ndimbuffi,ndimbuffr,ndv,ntv
84 INTEGER :: ibuffi,ibuffr
86 TYPE(t_level
),
POINTER :: plevel
87 TYPE(t_dcelltransf
),
POINTER :: psendeccell, precveccell
88 TYPE(t_plag),
POINTER :: pplag
95 rcsidentstring =
'$RCSfile: PLAG_CECellsSendRecvWrapper.F90,v $ $Revision: 1.5 $'
97 global => regions(1)%global
100 'PLAG_CECellsSendRecvWrapper.F90' )
106 DO ireg = 1, global%nRegions
107 IF ( regions(ireg)%procid==global%myProcid .AND. &
108 regions(ireg)%active==active .AND. &
109 global%plagUsed .EQV. .true. .AND. &
110 global%nProcAlloc > 1 )
THEN
112 DO ilev=1,regions(ireg)%nGridLevels
113 pplag => regions(ireg)%levels(ilev)%plag
119 pplag%nRequestsCECells = 0
129 ndimbuffr = 2*narv +4*ncv
135 DO ir=1,global%nRegions
136 psendeccell => regions(ireg)%levels(ilev)%sendEcCells(ir)
137 precveccell => regions(ireg)%levels(ilev)%recvEcCells(ir)
143 IF ( psendeccell%nCells > 0 ) psendeccell%nBuffSizePlag = 0
145 IF ( precveccell%nCells > 0 ) precveccell%nBuffSizePlag = 0
151 IF ( psendeccell%nCells > 0 ) &
152 pplag%nRequestsCECells = pplag%nRequestsCECells +1
154 psendeccell%iRequestPlag = pplag%nRequestsCECells
156 IF ( precveccell%nCells > 0 ) &
157 precveccell%iRequestPlag = -999999
165 ALLOCATE( pplag%requestsCECells(pplag%nRequestsCECells), &
167 global%error = errorflag
168 IF ( global%error /= err_none ) &
169 CALL
errorstop( global,err_allocate,__line__, &
170 'pPlag%requestsCECells' )
172 ALLOCATE( pplag%requestsCECellsI(pplag%nRequestsCECells), &
174 global%error = errorflag
175 IF ( global%error /= err_none ) &
176 CALL
errorstop( global,err_allocate,__line__, &
177 'pPlag%requestsCECellsI' )
179 ALLOCATE( pplag%requestsCECellsR(pplag%nRequestsCECells), &
181 global%error = errorflag
182 IF ( global%error /= err_none ) &
183 CALL
errorstop( global,err_allocate,__line__, &
184 'pPlag%requestsCECellsR' )
198 DO ireg = 1, global%nRegions
199 IF ( regions(ireg)%procid==global%myProcid .AND. &
200 regions(ireg)%active==active .AND. &
201 global%plagUsed .EQV. .true. .AND. &
202 global%nProcAlloc > 1 )
THEN
204 #ifdef PLAG_CECELLS_MPI_DEBUG
206 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
207 WRITE(*,*)
' Entering PLAG_CECellsSendSize: pid, iReg = ',global%myProcId, ireg
208 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
220 DO ireg = 1, global%nRegions
221 IF ( regions(ireg)%procid==global%myProcid .AND. &
222 regions(ireg)%active==active .AND. &
223 global%plagUsed .EQV. .true. .AND. &
224 global%nProcAlloc > 1 )
THEN
226 #ifdef PLAG_CECELLS_MPI_DEBUG
228 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
229 WRITE(*,*)
' Entering PLAG_CECellsRecvSize: pid, iReg = ',global%myProcId, ireg
230 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
242 DO ireg = 1, global%nRegions
243 IF ( regions(ireg)%procid==global%myProcid .AND. &
244 regions(ireg)%active==active .AND. &
245 global%plagUsed .EQV. .true. .AND. &
246 global%nProcAlloc > 1 )
THEN
248 #ifdef PLAG_CECELLS_MPI_DEBUG
250 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
251 WRITE(*,*)
' Entering PLAG_CECellsClearRequestsSize: pid, iReg = ',global%myProcId, ireg
252 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
264 DO ireg = 1, global%nRegions
265 IF ( regions(ireg)%procid==global%myProcid .AND. &
266 regions(ireg)%active==active .AND. &
267 global%plagUsed .EQV. .true. .AND. &
268 global%nProcAlloc > 1 )
THEN
270 DO ilev=1,regions(ireg)%nGridLevels
271 pplag => regions(ireg)%levels(ilev)%plag
272 DO ir=1,global%nRegions
273 psendeccell => regions(ireg)%levels(ilev)%sendEcCells(ir)
274 precveccell => regions(ireg)%levels(ilev)%recvEcCells(ir)
280 IF ( psendeccell%nCells > 0 )
THEN
281 nbuffsendi = ndimbuffi*psendeccell%nBuffSizePlag
282 nbuffsendr = ndimbuffr*psendeccell%nBuffSizePlag
284 IF ( psendeccell%nBuffSizePlag > 0 )
THEN
286 #ifdef PLAG_CECELLS_MPI_DEBUG
287 IF(ireg==1 .OR. ireg==10)
THEN
288 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
289 WRITE(*,*)
' Allocating Send Data Buffers: pid, iReg, ir, nBuffSizePlag, nBuffSendI, nBuffSendR = ', &
290 global%myProcId, ireg, ir, psendeccell%nBuffSizePlag, nbuffsendi, nbuffsendr
294 ALLOCATE( psendeccell%buffPlagI(nbuffsendi),stat=errorflag )
295 global%error = errorflag
296 IF ( global%error /= err_none ) &
297 CALL
errorstop( global,err_allocate,__line__, &
298 'pSendEcCell%buffPlagI' )
300 ALLOCATE( psendeccell%buffPlagR(nbuffsendr),stat=errorflag )
301 global%error = errorflag
302 IF ( global%error /= err_none ) &
303 CALL
errorstop( global,err_allocate,__line__, &
304 'pSendEcCell%buffPlagR' )
310 DO ibuffi = 1, nbuffsendi
311 psendeccell%buffPlagI(ibuffi) = 0
314 DO ibuffr= 1, nbuffsendr
315 psendeccell%buffPlagR(ibuffr) = 0.0_rfreal
325 IF ( precveccell%nCells > 0 )
THEN
326 nbuffrecvi = ndimbuffi*precveccell%nBuffSizePlag
327 nbuffrecvr = ndimbuffr*precveccell%nBuffSizePlag
329 IF ( precveccell%nBuffSizePlag > 0 )
THEN
331 #ifdef PLAG_CECELLS_MPI_DEBUG
332 IF (ireg==1 .OR. ireg==10)
THEN
333 WRITE(*,*)
' Allocating Receive Data Buffers: pid, iReg, ir, nBuffSizePlag, nBuffRecvI, nBuffRecvR = ', &
334 global%myProcId, ireg, ir, precveccell%nBuffSizePlag, nbuffrecvi, nbuffrecvr
335 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
339 ALLOCATE( precveccell%buffPlagI(nbuffrecvi),stat=errorflag )
340 global%error = errorflag
341 IF ( global%error /= err_none ) &
342 CALL
errorstop( global,err_allocate,__line__, &
343 'pRecvEcCell%buffPlagI' )
345 ALLOCATE( precveccell%buffPlagR(nbuffrecvr),stat=errorflag )
346 global%error = errorflag
347 IF ( global%error /= err_none ) &
348 CALL
errorstop( global,err_allocate,__line__, &
349 'pRecvEcCell%buffPlagR' )
355 DO ibuffi = 1, nbuffrecvi
356 precveccell%buffPlagI(ibuffi) = 0
359 DO ibuffr= 1, nbuffrecvr
360 precveccell%buffPlagR(ibuffr) = 0.0_rfreal
375 CALL mpi_barrier( global%mpiComm,global%mpierr )
376 IF ( global%mpierr /= err_none ) &
377 CALL
errorstop( global,err_mpi_trouble,__line__ )
388 DO ireg = 1, global%nRegions
389 IF ( regions(ireg)%procid==global%myProcid .AND. &
390 regions(ireg)%active==active .AND. &
391 global%plagUsed .EQV. .true. .AND. &
392 global%nProcAlloc > 1 )
THEN
394 #ifdef PLAG_CECELLS_MPI_DEBUG
396 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
397 WRITE(*,*)
' Entering PLAG_CECellsSendData: pid, iReg = ',global%myProcId, ireg
398 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
410 DO ireg = 1, global%nRegions
411 IF ( regions(ireg)%procid==global%myProcid .AND. &
412 regions(ireg)%active==active .AND. &
413 global%plagUsed .EQV. .true. .AND. &
414 global%nProcAlloc > 1 )
THEN
416 #ifdef PLAG_CECELLS_MPI_DEBUG
418 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
419 WRITE(*,*)
' Entering PLAG_CECellsRecvData: pid, iReg = ',global%myProcId, ireg
420 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
433 DO ireg = 1, global%nRegions
434 IF ( regions(ireg)%procid==global%myProcid .AND. &
435 regions(ireg)%active==active .AND. &
436 global%plagUsed .EQV. .true. .AND. &
437 global%nProcAlloc > 1 )
THEN
439 #ifdef PLAG_CECELLS_MPI_DEBUG
441 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
442 WRITE(*,*)
' Entering PLAG_CECellsClearRequestsData: pid, iReg = ',global%myProcId, ireg
443 WRITE(*,*)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
456 CALL mpi_barrier( global%mpiComm,global%mpierr )
457 IF ( global%mpierr /= err_none ) &
458 CALL
errorstop( global,err_mpi_trouble,__line__ )
465 DO ireg = 1, global%nRegions
466 IF ( regions(ireg)%procid==global%myProcid .AND. &
467 regions(ireg)%active==active .AND. &
468 global%plagUsed .EQV. .true. .AND. &
469 global%nProcAlloc > 1 )
THEN
471 DO ilev=1,regions(ireg)%nGridLevels
472 pplag => regions(ireg)%levels(ilev)%plag
474 DO ir=1,global%nRegions
475 psendeccell => regions(ireg)%levels(ilev)%sendEcCells(ir)
476 precveccell => regions(ireg)%levels(ilev)%recvEcCells(ir)
482 IF ( psendeccell%nCells > 0 )
THEN
483 IF ( psendeccell%nBuffSizePlag > 0 )
THEN
484 DEALLOCATE( psendeccell%buffPlagI, stat=errorflag )
485 global%error = errorflag
486 IF ( global%error /= err_none ) &
487 CALL
errorstop( global,err_deallocate,__line__, &
488 'pSendEcCell%buffCECellsPlagI' )
490 DEALLOCATE( psendeccell%buffPlagR, stat=errorflag )
491 global%error = errorflag
492 IF ( global%error /= err_none ) &
493 CALL
errorstop( global,err_deallocate,__line__, &
494 'pSendEcCell%buffCECellsPlagR' )
502 IF ( precveccell%nCells > 0 )
THEN
503 IF ( precveccell%nBuffSizePlag > 0 )
THEN
504 DEALLOCATE( precveccell%buffPlagI, stat=errorflag )
505 global%error = errorflag
506 IF ( global%error /= err_none ) &
507 CALL
errorstop( global,err_deallocate,__line__, &
508 'pRecvEcCell%buffPlagI' )
510 DEALLOCATE( precveccell%buffPlagR, stat=errorflag )
511 global%error = errorflag
512 IF ( global%error /= err_none ) &
513 CALL
errorstop( global,err_deallocate,__line__, &
514 'pRecvEcCell%buffPlagR' )
523 DEALLOCATE(pplag%requestsCECells, stat=errorflag )
524 global%error = errorflag
525 IF ( global%error /= err_none ) &
526 CALL
errorstop( global,err_deallocate,__line__ )
528 DEALLOCATE(pplag%requestsCECellsI, stat=errorflag )
529 global%error = errorflag
530 IF ( global%error /= err_none ) &
531 CALL
errorstop( global,err_deallocate,__line__ )
533 DEALLOCATE(pplag%requestsCECellsR, stat=errorflag )
534 global%error = errorflag
535 IF ( global%error /= err_none ) &
536 CALL
errorstop( global,err_deallocate,__line__ )
548 CALL mpi_barrier( global%mpiComm,global%mpierr )
549 IF ( global%mpierr /= err_none ) &
550 CALL
errorstop( global,err_mpi_trouble,__line__ )
subroutine registerfunction(global, funName, fileName)
subroutine plag_cecellsrecvdata(regions, iReg)
subroutine plag_cecellssenddata(regions, iReg)
subroutine plag_cecellsclearrequestssize(regions, iReg)
subroutine plag_cecellsrecvsize(regions, iReg)
subroutine plag_cecellssendrecvwrapper(regions)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine plag_cecellsclearrequestsdata(regions, iReg)
subroutine plag_cecellssendsize(regions, iReg)
subroutine deregisterfunction(global)