| 5 |
|
!! |
| 6 |
|
!! @author Charles F. Vardeman II |
| 7 |
|
!! @author Matthew Meineke |
| 8 |
< |
!! @version $Id: mpiSimulation_module.F90,v 1.5 2003-01-30 20:03:37 chuckv Exp $, $Date: 2003-01-30 20:03:37 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $ |
| 8 |
> |
!! @version $Id: mpiSimulation_module.F90,v 1.7 2003-01-31 21:04:27 chuckv Exp $, $Date: 2003-01-31 21:04:27 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $ |
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 26 |
|
public :: getNcol |
| 27 |
|
public :: getNrow |
| 28 |
|
public :: isMPISimSet |
| 29 |
+ |
public :: printComponentPlan |
| 30 |
+ |
public :: getMyNode |
| 31 |
|
|
| 30 |
– |
|
| 32 |
|
!! PUBLIC Subroutines contained in MPI module |
| 33 |
|
public :: mpi_bcast |
| 34 |
|
public :: mpi_allreduce |
| 56 |
|
!! generic mpi error declaration. |
| 57 |
|
integer,public :: mpi_err |
| 58 |
|
|
| 59 |
+ |
|
| 60 |
|
|
| 59 |
– |
|
| 61 |
|
!! Include mpiComponentPlan type. mpiComponentPlan is a |
| 62 |
|
!! dual header file for both c and fortran. |
| 63 |
|
#define __FORTRAN90 |
| 73 |
|
!! Logical set true if mpiSimulation has been initialized |
| 74 |
|
logical :: isSimSet = .false. |
| 75 |
|
|
| 76 |
+ |
|
| 77 |
+ |
type (mpiComponentPlan) :: mpiSim |
| 78 |
+ |
|
| 79 |
|
!! gs_plan contains plans for gather and scatter routines |
| 80 |
|
type, public :: gs_plan |
| 81 |
|
private |
| 142 |
|
endif |
| 143 |
|
componentPlanSet = .true. |
| 144 |
|
|
| 145 |
< |
|
| 146 |
< |
call make_Force_Grid(thisComponentPlan,localStatus) |
| 145 |
> |
!! copy c component plan to fortran |
| 146 |
> |
mpiSim = thisComponentPlan |
| 147 |
> |
write(*,*) "Seting up simParallel" |
| 148 |
> |
|
| 149 |
> |
call make_Force_Grid(mpiSim,localStatus) |
| 150 |
|
if (localStatus /= 0) then |
| 151 |
|
write(default_error,*) "Error creating force grid" |
| 152 |
|
status = -1 |
| 153 |
|
return |
| 154 |
|
endif |
| 155 |
|
|
| 156 |
< |
call updateGridComponents(thisComponentPlan,localStatus) |
| 156 |
> |
call updateGridComponents(mpiSim,localStatus) |
| 157 |
|
if (localStatus /= 0) then |
| 158 |
|
write(default_error,*) "Error updating grid components" |
| 159 |
|
status = -1 |
| 162 |
|
|
| 163 |
|
|
| 164 |
|
!! initialize gather and scatter plans used in this simulation |
| 165 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsRow,& |
| 166 |
< |
thisComponentPlan,thisComponentPlan%rowComm,plan_row) |
| 167 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsRow,& |
| 168 |
< |
thisComponentPlan,thisComponentPlan%rowComm,plan_row3d) |
| 169 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsColumn,& |
| 170 |
< |
thisComponentPlan,thisComponentPlan%columnComm,plan_col) |
| 171 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsColumn,& |
| 172 |
< |
thisComponentPlan,thisComponentPlan%columnComm,plan_col3d) |
| 165 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
| 166 |
> |
mpiSim,mpiSim%rowComm,plan_row) |
| 167 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
| 168 |
> |
mpiSim,mpiSim%rowComm,plan_row3d) |
| 169 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
| 170 |
> |
mpiSim,mpiSim%columnComm,plan_col) |
| 171 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
| 172 |
> |
mpiSim,mpiSim%columnComm,plan_col3d) |
| 173 |
|
|
| 174 |
|
! Initialize tags |
| 175 |
|
call setTags(tags,localStatus) |
| 178 |
|
return |
| 179 |
|
endif |
| 180 |
|
isSimSet = .true. |
| 181 |
+ |
|
| 182 |
+ |
! call printComponentPlan(mpiSim,0) |
| 183 |
|
end subroutine setupSimParallel |
| 184 |
|
|
| 185 |
|
subroutine replanSimParallel(thisComponentPlan,status) |
| 205 |
|
|
| 206 |
|
|
| 207 |
|
!! initialize gather and scatter plans used in this simulation |
| 208 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsRow,& |
| 208 |
> |
call plan_gather_scatter(1,thisComponentPlan%myNlocal,& |
| 209 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_row) |
| 210 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsRow,& |
| 210 |
> |
call plan_gather_scatter(nDim,thisComponentPlan%myNlocal,& |
| 211 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_row3d) |
| 212 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsColumn,& |
| 212 |
> |
call plan_gather_scatter(1,thisComponentPlan%myNlocal,& |
| 213 |
|
thisComponentPlan,thisComponentPlan%columnComm,plan_col) |
| 214 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsColumn,& |
| 214 |
> |
call plan_gather_scatter(nDim,thisComponentPlan%myNlocal,& |
| 215 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_col3d) |
| 216 |
|
|
| 217 |
|
|
| 359 |
|
integer :: i,junk |
| 360 |
|
|
| 361 |
|
if (present(status)) status = 0 |
| 362 |
+ |
|
| 363 |
|
|
| 364 |
|
|
| 365 |
|
!! Set gsComponetPlan pointer |
| 425 |
|
this_plan%displs(i) = this_plan%displs(i-1) + this_plan%counts(i-1) |
| 426 |
|
end do |
| 427 |
|
|
| 428 |
+ |
|
| 429 |
|
end subroutine plan_gather_scatter |
| 430 |
|
|
| 431 |
|
|
| 448 |
|
integer, dimension(:), intent(in) :: rbuffer |
| 449 |
|
integer :: noffset |
| 450 |
|
integer, intent(out), optional :: status |
| 451 |
+ |
integer :: i |
| 452 |
|
|
| 453 |
+ |
|
| 454 |
+ |
|
| 455 |
|
if (present(status)) status = 0 |
| 456 |
|
noffset = this_plan%displs(this_plan%myPlanRank) |
| 457 |
+ |
|
| 458 |
+ |
! if (getmyNode() == 1) then |
| 459 |
+ |
! write(*,*) "Node 0 printing allgatherv vars" |
| 460 |
+ |
! write(*,*) "Noffset: ", noffset |
| 461 |
+ |
! write(*,*) "PlanSize: ", this_plan%gsPlanSize |
| 462 |
+ |
! write(*,*) "PlanComm: ", this_plan%myPlanComm |
| 463 |
+ |
! end if |
| 464 |
|
|
| 465 |
|
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_integer, & |
| 466 |
|
rbuffer,this_plan%counts,this_plan%displs,mpi_integer, & |
| 480 |
|
integer :: noffset |
| 481 |
|
integer, intent(out), optional :: status |
| 482 |
|
|
| 483 |
+ |
|
| 484 |
|
if (present(status)) status = 0 |
| 485 |
|
noffset = this_plan%displs(this_plan%myPlanRank) |
| 486 |
|
|
| 629 |
|
end function isMPISimSet |
| 630 |
|
|
| 631 |
|
|
| 610 |
– |
|
| 632 |
|
|
| 633 |
+ |
subroutine printComponentPlan(this_plan,printNode) |
| 634 |
+ |
|
| 635 |
+ |
type (mpiComponentPlan), intent(in) :: this_plan |
| 636 |
+ |
integer, optional :: printNode |
| 637 |
+ |
logical :: print_me = .false. |
| 638 |
+ |
|
| 639 |
+ |
if (present(printNode)) then |
| 640 |
+ |
if (printNode == mpiSim%myNode) print_me = .true. |
| 641 |
+ |
else |
| 642 |
+ |
print_me = .true. |
| 643 |
+ |
endif |
| 644 |
+ |
|
| 645 |
+ |
if (print_me) then |
| 646 |
+ |
write(default_error,*) "SetupSimParallel: writing component plan" |
| 647 |
+ |
|
| 648 |
+ |
write(default_error,*) "nMolGlobal: ", mpiSim%nMolGlobal |
| 649 |
+ |
write(default_error,*) "nAtomsGlobal: ", mpiSim%nAtomsGlobal |
| 650 |
+ |
write(default_error,*) "nBondGlobal: ", mpiSim%nBondsGlobal |
| 651 |
+ |
write(default_error,*) "nTorsionsGlobal: ", mpiSim%nTorsionsGlobal |
| 652 |
+ |
write(default_error,*) "nSRIGlobal: ", mpiSim%nSRIGlobal |
| 653 |
+ |
write(default_error,*) "myMolStart: ", mpiSim%myMolStart |
| 654 |
+ |
write(default_error,*) "myMolEnd: ", mpiSim%myMolEnd |
| 655 |
+ |
write(default_error,*) "myMol: ", mpiSim%myMol |
| 656 |
+ |
write(default_error,*) "myNlocal: ", mpiSim%myNlocal |
| 657 |
+ |
write(default_error,*) "myNode: ", mpiSim%myNode |
| 658 |
+ |
write(default_error,*) "numberProcessors: ", mpiSim%numberProcessors |
| 659 |
+ |
write(default_error,*) "rowComm: ", mpiSim%rowComm |
| 660 |
+ |
write(default_error,*) "columnComm: ", mpiSim%columnComm |
| 661 |
+ |
write(default_error,*) "numberRows: ", mpiSim%numberRows |
| 662 |
+ |
write(default_error,*) "numberColumns: ", mpiSim%numberColumns |
| 663 |
+ |
write(default_error,*) "nComponentsRow: ", mpiSim%nComponentsRow |
| 664 |
+ |
write(default_error,*) "nComponentsColumn: ", mpiSim%nComponentsColumn |
| 665 |
+ |
write(default_error,*) "rowIndex: ", mpiSim%rowIndex |
| 666 |
+ |
write(default_error,*) "columnIndex: ", mpiSim%columnIndex |
| 667 |
+ |
endif |
| 668 |
+ |
end subroutine printComponentPlan |
| 669 |
+ |
|
| 670 |
+ |
function getMyNode() result(myNode) |
| 671 |
+ |
integer :: myNode |
| 672 |
+ |
myNode = mpiSim%myNode |
| 673 |
+ |
end function getMyNode |
| 674 |
+ |
|
| 675 |
+ |
|
| 676 |
|
end module mpiSimulation |
| 677 |
|
|