69 CHARACTER(CHRLEN) :: &
70 RCSIdentString =
'$RCSfile: RFLU_ModMPI.F90,v $ $Revision: 1.17 $'
112 INTEGER,
INTENT(INOUT) :: request
120 INTEGER ::
status(mpi_status_size)
133 CALL mpi_wait(request,
status,errorflag)
134 global%error = errorflag
135 IF ( global%error /= err_none )
THEN
136 CALL
errorstop(global,err_mpi_output,__line__)
182 TYPE(t_region
),
POINTER :: pregion
188 INTEGER :: errorflag,iborder
191 TYPE(t_grid),
POINTER :: pgrid
197 global => pregion%global
203 CALL fprofiler_begins(
"RFLU::ClearRequestWrapper")
210 pgrid => pregion%grid
216 DO iborder = 1,pgrid%nBorders
217 pborder => pgrid%borders(iborder)
223 IF ( pborder%iProc /= global%myProcid )
THEN
224 IF ( pborder%nCellsSend > 0 )
THEN
237 IF ( global%specUsed .EQV. .true. )
THEN
250 CALL fprofiler_ends(
"RFLU::ClearRequestWrapper")
291 REAL(RFREAL),
DIMENSION(:,:),
INTENT(IN) :: celldata
292 REAL(RFREAL),
DIMENSION(:,:),
INTENT(OUT) :: celldata2
293 TYPE(t_border),
POINTER :: pborder,pborder2
300 INTEGER :: errorflag,icg,icg2,icl,ivar,nvars
313 nvars =
SIZE(celldata,1)
315 IF ( nvars /=
SIZE(celldata2,1) )
THEN
316 CALL
errorstop(global,err_datadim_mismatch,__line__)
323 DO icl = 1,pborder%nCellsSend
324 icg = pborder%icgSend(icl)
325 icg2 = pborder2%icgRecv(icl)
328 celldata2(ivar,icg2) = celldata(ivar,icg)
375 TYPE(t_region
),
DIMENSION(:),
POINTER :: regions
381 INTEGER :: errorflag,iborder,iborder2,ireg,ireg2
382 TYPE(t_border),
POINTER :: pborder,pborder2
384 TYPE(t_grid),
POINTER :: pgrid
385 TYPE(t_region
),
POINTER :: pregion,pregion2
391 global => regions(0)%global
397 CALL fprofiler_begins(
"RFLU::CopyWrapper")
408 DO ireg = 1,global%nRegionsLocal
409 pregion => regions(ireg)
410 pgrid => pregion%grid
412 DO iborder = 1,pgrid%nBorders
413 pborder => pgrid%borders(iborder)
419 IF ( pborder%iProc == global%myProcid )
THEN
420 ireg2 = pborder%iRegionLocal
421 iborder2 = pborder%iBorder
423 pregion2 => regions(ireg2)
424 pborder2 => pregion2%grid%borders(iborder2)
430 IF ( pborder%nCellsSend /= pborder2%nCellsRecv )
THEN
431 CALL
errorstop(global,err_bufferdim_mismatch,__line__)
439 pregion%mixt%cv,pregion2%mixt%cv)
446 IF ( global%specUsed .EQV. .true. )
THEN
448 pregion%spec%cv,pregion2%spec%cv)
461 CALL fprofiler_ends(
"RFLU::CopyWrapper")
503 TYPE(t_border),
POINTER,
OPTIONAL :: pborder
504 TYPE(t_region
),
POINTER :: pregion
510 INTEGER :: errorflag,iborder,nvars
512 TYPE(t_grid),
POINTER :: pgrid
519 global => pregion%global
528 pgrid => pregion%grid
536 IF ( present(pborder) )
THEN
537 nvars =
SIZE(pborder%iPclSend,1)
539 ALLOCATE(pborder%iPclSend(nvars,pborder%nPclsSendMax),stat=errorflag)
540 global%error = errorflag
541 IF ( global%error /= err_none )
THEN
542 CALL
errorstop(global,err_allocate,__line__,
'pBorder%iPclSend')
546 DO iborder = 1,pgrid%nBorders
547 pborder2 => pgrid%borders(iborder)
550 pborder2%nPclsSendMax = 1000
552 ALLOCATE(pborder2%iPclSend(nvars,pborder2%nPclsSendMax),stat=errorflag)
553 global%error = errorflag
554 IF ( global%error /= err_none )
THEN
555 CALL
errorstop(global,err_allocate,__line__,
'pBorder%iPclSend')
606 INTEGER,
INTENT(IN) :: nvars
628 ALLOCATE(borderdata%sendBuff(nvars,pborder%nCellsSend),stat=errorflag)
629 global%error = errorflag
630 IF ( global%error /= err_none )
THEN
631 CALL
errorstop(global,err_allocate,__line__,
'borderData%sendBuff')
634 ALLOCATE(borderdata%recvBuff(nvars,pborder%nCellsRecv),stat=errorflag)
635 global%error = errorflag
636 IF ( global%error /= err_none )
THEN
637 CALL
errorstop(global,err_allocate,__line__,
'borderData%recvBuff')
681 TYPE(t_region
),
POINTER :: pregion
687 INTEGER :: errorflag,iborder
690 TYPE(t_grid),
POINTER :: pgrid
696 global => pregion%global
701 IF ( global%myProcid == masterproc .AND. &
702 global%verbLevel >= verbose_high )
THEN
703 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating buffers...'
710 pgrid => pregion%grid
716 DO iborder = 1,pgrid%nBorders
717 pborder => pgrid%borders(iborder)
723 IF ( pborder%iProc /= global%myProcid )
THEN
730 pregion%mixtInput%nCv)
737 IF ( global%specUsed .EQV. .true. )
THEN
739 pregion%specInput%nSpecies)
752 IF ( global%myProcid == masterproc .AND. &
753 global%verbLevel >= verbose_high )
THEN
754 WRITE(stdout,
'(A,1X,A)') solver_name,
'Creating buffers done.'
794 TYPE(t_border),
POINTER,
OPTIONAL :: pborder
795 TYPE(t_region
),
POINTER :: pregion
801 INTEGER :: errorflag,iborder
803 TYPE(t_grid),
POINTER :: pgrid
810 global => pregion%global
819 pgrid => pregion%grid
827 IF ( present(pborder) )
THEN
828 DEALLOCATE(pborder%iPclSend,stat=errorflag)
829 global%error = errorflag
830 IF ( global%error /= err_none )
THEN
831 CALL
errorstop(global,err_deallocate,__line__,
'pBorder%iPclSend')
835 DO iborder = 1,pgrid%nBorders
836 pborder2 => pgrid%borders(iborder)
838 DEALLOCATE(pborder2%iPclSend,stat=errorflag)
839 global%error = errorflag
840 IF ( global%error /= err_none )
THEN
841 CALL
errorstop(global,err_deallocate,__line__,
'pBorder%iPclSend')
912 DEALLOCATE(borderdata%sendBuff,stat=errorflag)
913 global%error = errorflag
914 IF ( global%error /= err_none )
THEN
915 CALL
errorstop(global,err_deallocate,__line__,
'borderData%sendBuff')
918 DEALLOCATE(borderdata%recvBuff,stat=errorflag)
919 global%error = errorflag
920 IF ( global%error /= err_none )
THEN
921 CALL
errorstop(global,err_deallocate,__line__,
'borderData%recvBuff')
965 TYPE(t_region
),
POINTER :: pregion
971 INTEGER :: errorflag,iborder
974 TYPE(t_grid),
POINTER :: pgrid
980 global => pregion%global
985 IF ( global%myProcid == masterproc .AND. &
986 global%verbLevel >= verbose_high )
THEN
987 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying buffers...'
994 pgrid => pregion%grid
1000 DO iborder = 1,pgrid%nBorders
1001 pborder => pgrid%borders(iborder)
1007 IF ( pborder%iProc /= global%myProcid )
THEN
1020 IF ( global%specUsed .EQV. .true. )
THEN
1033 IF ( global%myProcid == masterproc .AND. &
1034 global%verbLevel >= verbose_high )
THEN
1035 WRITE(stdout,
'(A,1X,A)') solver_name,
'Destroying buffers done.'
1081 INTEGER,
INTENT(IN) ::
tag
1082 INTEGER,
INTENT(OUT) :: request
1083 REAL(RFREAL),
DIMENSION(:,:),
INTENT(IN) :: celldata
1084 REAL(RFREAL),
DIMENSION(:,:),
INTENT(OUT) :: celldatabuff
1092 INTEGER :: errorflag,icg,icl,ivar,nvars
1105 nvars =
SIZE(celldata,1)
1111 DO icl = 1,pborder%nCellsSend
1112 icg = pborder%icgSend(icl)
1115 celldatabuff(ivar,icl) = celldata(ivar,icg)
1123 IF ( pborder%nCellsSend > 0 )
THEN
1124 CALL mpi_isend(celldatabuff,pborder%nCellsSend*nvars,mpi_rfreal, &
1125 pborder%iProc,
tag,global%mpiComm,request,errorflag)
1126 global%error = errorflag
1127 IF ( global%error /= err_none )
THEN
1128 CALL
errorstop(global,err_mpi_output,__line__)
1175 TYPE(t_border),
POINTER,
OPTIONAL :: pborder
1176 TYPE(t_region
),
POINTER :: pregion
1182 INTEGER :: errorflag,ipcl,ivar,npclssendmax,npclssendmaxold,nvars
1183 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: ipclsendtemp
1185 TYPE(t_grid),
POINTER :: pgrid
1191 global => pregion%global
1200 pgrid => pregion%grid
1207 nvars =
SIZE(pborder%iPclSend,1)
1208 npclssendmaxold =
SIZE(pborder%iPclSend,2)
1210 pborder%nPclsSendMax = &
1211 nint(1.20_rfreal*
REAL(pborder%npclssend,kind=rfreal))
1217 ALLOCATE(ipclsendtemp(nvars,pborder%nPclsSendMax),stat=errorflag)
1218 global%error = errorflag
1219 IF ( global%error /= err_none )
THEN
1220 CALL
errorstop(global,err_allocate,__line__,
'iPclSendTemp')
1227 DO ipcl = 1,npclssendmaxold
1229 ipclsendtemp(ivar,ipcl) = pborder%iPclSend(ivar,ipcl)
1249 DO ipcl = 1,pborder%nPclsSend
1251 pborder%iPclSend(ivar,ipcl) = ipclsendtemp(ivar,ipcl)
1259 DEALLOCATE(ipclsendtemp,stat=errorflag)
1260 global%error = errorflag
1261 IF ( global%error /= err_none )
THEN
1262 CALL
errorstop(global,err_deallocate,__line__,
'iPclSendTemp')
1307 TYPE(t_region
),
POINTER :: pregion
1313 INTEGER :: errorflag,iborder
1316 TYPE(t_grid),
POINTER :: pgrid
1322 global => pregion%global
1328 CALL fprofiler_begins(
"RFLU::ISendWrapper")
1335 pgrid => pregion%grid
1341 DO iborder = 1,pgrid%nBorders
1342 pborder => pgrid%borders(iborder)
1348 IF ( pborder%iProc /= global%myProcid )
THEN
1355 pregion%mixt%cv,pborder%mixt%tag, &
1356 pborder%mixt%sendRequest)
1363 IF ( global%specUsed .EQV. .true. )
THEN
1365 pregion%spec%cv,pborder%spec%tag, &
1366 pborder%spec%sendRequest)
1377 CALL fprofiler_ends(
"RFLU::ISendWrapper")
1422 INTEGER,
INTENT(IN) ::
tag
1423 REAL(RFREAL),
DIMENSION(:,:),
INTENT(IN) :: celldatabuff
1424 REAL(RFREAL),
DIMENSION(:,:),
INTENT(OUT) :: celldata
1432 INTEGER :: errorflag,icg,icl,ivar,nvars
1433 INTEGER ::
status(mpi_status_size)
1446 nvars =
SIZE(celldata,1)
1452 IF ( pborder%nCellsRecv > 0 )
THEN
1453 CALL mpi_recv(celldatabuff,pborder%nCellsRecv*nvars,mpi_rfreal, &
1454 pborder%iProc,
tag,global%mpiComm,
status,errorflag)
1455 global%error = errorflag
1456 IF ( global%error /= err_none )
THEN
1457 CALL
errorstop(global,err_mpi_output,__line__)
1465 DO icl = 1,pborder%nCellsRecv
1466 icg = pborder%icgRecv(icl)
1469 celldata(ivar,icg) = celldatabuff(ivar,icl)
1514 TYPE(t_region
),
POINTER :: pregion
1520 INTEGER :: errorflag,iborder
1523 TYPE(t_grid),
POINTER :: pgrid
1529 global => pregion%global
1535 CALL fprofiler_begins(
"RFLU::RecvWrapper")
1542 pgrid => pregion%grid
1548 DO iborder = 1,pgrid%nBorders
1549 pborder => pgrid%borders(iborder)
1555 IF ( pborder%iProc /= global%myProcid )
THEN
1562 pregion%mixt%cv,pborder%mixt%tag)
1569 IF ( global%specUsed .EQV. .true. )
THEN
1571 pregion%spec%cv,pborder%spec%tag)
1582 CALL fprofiler_ends(
"RFLU::RecvWrapper")
1624 INTEGER,
INTENT(IN) :: imsg,ireg1,ireg2,tagmax
1631 INTEGER :: iregmax,iregmin
1644 iregmax =
max(ireg1,ireg2)
1645 iregmin =
min(ireg1,ireg2)
1648 + (iregmax-1)*(imsg-1)*global%nRegions*global%nRegions
1651 CALL
errorstop(global,err_mpi_tagmax,__line__)
1698 TYPE(t_region
),
POINTER :: pregion
1704 LOGICAL :: dummylogical
1705 INTEGER :: errorflag,iborder,imsg,tagmax
1708 TYPE(t_grid),
POINTER :: pgrid
1714 global => pregion%global
1723 pgrid => pregion%grid
1731 CALL mpi_attr_get(mpi_comm_world,mpi_tag_ub,tagmax,dummylogical,errorflag)
1732 global%error = errorflag
1733 IF ( global%error /= err_none )
THEN
1734 CALL
errorstop(global,err_mpi_output,__line__)
1741 DO iborder = 1,pgrid%nBorders
1742 pborder => pgrid%borders(iborder)
1751 pborder%iRegionGlobal,imsg,tagmax)
1761 pborder%iRegionGlobal,imsg,tagmax)
1767 pborder%plag%tagCount =
rflu_mpi_settag(global,pregion%iRegionGlobal, &
1768 pborder%iRegionGlobal,imsg,tagmax)
1772 pborder%iRegionGlobal,imsg,tagmax)
1776 pborder%iRegionGlobal,imsg,tagmax)
subroutine, public rflu_mpi_destroybufferipclsend(pRegion, pBorder)
subroutine rflu_mpi_createbuffers(global, pBorder, borderData, nVars)
subroutine, public rflu_mpi_createbufferipclsend(pRegion, pBorder)
subroutine rflu_mpi_copycelldata(global, pBorder, pBorder2, cellData, cellData2)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine, public rflu_mpi_isendwrapper(pRegion)
subroutine registerfunction(global, funName, fileName)
int status() const
Obtain the status of the attribute.
INTEGER function rflu_mpi_settag(global, iReg1, iReg2, iMsg, tagMax)
subroutine, public rflu_mpi_clearrequestwrapper(pRegion)
subroutine rflu_mpi_recvcelldata(global, pBorder, cellDataBuff, cellData, tag)
subroutine, public rflu_mpi_recvwrapper(pRegion)
subroutine, public rflu_mpi_settagswrapper(pRegion)
subroutine, public rflu_mpi_createbufferswrapper(pRegion)
subroutine, public rflu_mpi_destroybufferswrapper(pRegion)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine, public rflu_mpi_copywrapper(regions)
subroutine rflu_mpi_destroybuffers(global, pBorder, borderData)
subroutine rflu_mpi_clearrequest(global, request)
subroutine deregisterfunction(global)
subroutine rflu_mpi_isendcelldata(global, pBorder, cellDataBuff, cellData, tag, request)
subroutine, public rflu_mpi_recreatebufferipclsend(pRegion, pBorder)