| 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.8 2003-02-24 21:26:54 chuckv Exp $, $Date: 2003-02-24 21:26:54 $, $Name: not supported by cvs2svn $, $Revision: 1.8 $ |
| 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 |
| 94 |
|
type (gs_plan), public :: plan_row3d |
| 95 |
|
type (gs_plan), public :: plan_col |
| 96 |
|
type (gs_plan), public :: plan_col3d |
| 97 |
+ |
type(gs_plan), public :: plan_row_Rotation |
| 98 |
+ |
type(gs_plan), public :: plan_col_Rotation |
| 99 |
|
|
| 100 |
|
type (mpiComponentPlan), pointer :: simComponentPlan |
| 101 |
|
|
| 144 |
|
endif |
| 145 |
|
componentPlanSet = .true. |
| 146 |
|
|
| 147 |
< |
|
| 148 |
< |
call make_Force_Grid(thisComponentPlan,localStatus) |
| 147 |
> |
!! copy c component plan to fortran |
| 148 |
> |
mpiSim = thisComponentPlan |
| 149 |
> |
write(*,*) "Seting up simParallel" |
| 150 |
> |
|
| 151 |
> |
call make_Force_Grid(mpiSim,localStatus) |
| 152 |
|
if (localStatus /= 0) then |
| 153 |
|
write(default_error,*) "Error creating force grid" |
| 154 |
|
status = -1 |
| 155 |
|
return |
| 156 |
|
endif |
| 157 |
|
|
| 158 |
< |
call updateGridComponents(thisComponentPlan,localStatus) |
| 158 |
> |
call updateGridComponents(mpiSim,localStatus) |
| 159 |
|
if (localStatus /= 0) then |
| 160 |
|
write(default_error,*) "Error updating grid components" |
| 161 |
|
status = -1 |
| 164 |
|
|
| 165 |
|
|
| 166 |
|
!! initialize gather and scatter plans used in this simulation |
| 167 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsRow,& |
| 168 |
< |
thisComponentPlan,thisComponentPlan%rowComm,plan_row) |
| 169 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsRow,& |
| 170 |
< |
thisComponentPlan,thisComponentPlan%rowComm,plan_row3d) |
| 171 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsColumn,& |
| 172 |
< |
thisComponentPlan,thisComponentPlan%columnComm,plan_col) |
| 173 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsColumn,& |
| 174 |
< |
thisComponentPlan,thisComponentPlan%columnComm,plan_col3d) |
| 167 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
| 168 |
> |
mpiSim,mpiSim%rowComm,plan_row) |
| 169 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
| 170 |
> |
mpiSim,mpiSim%rowComm,plan_row3d) |
| 171 |
> |
call plan_gather_scatter(9,mpiSim%myNlocal,& |
| 172 |
> |
mpiSim,mpiSim%rowComm,plan_row_Rotation) |
| 173 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
| 174 |
> |
mpiSim,mpiSim%columnComm,plan_col) |
| 175 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
| 176 |
> |
mpiSim,mpiSim%columnComm,plan_col3d) |
| 177 |
> |
call plan_gather_scatter(9,mpiSim%myNlocal,& |
| 178 |
> |
mpiSim,mpiSim%columnComm,plan_col_Rotation) |
| 179 |
|
|
| 180 |
+ |
|
| 181 |
+ |
|
| 182 |
|
! Initialize tags |
| 183 |
|
call setTags(tags,localStatus) |
| 184 |
|
if (localStatus /= 0) then |
| 186 |
|
return |
| 187 |
|
endif |
| 188 |
|
isSimSet = .true. |
| 189 |
+ |
|
| 190 |
+ |
! call printComponentPlan(mpiSim,0) |
| 191 |
|
end subroutine setupSimParallel |
| 192 |
|
|
| 193 |
|
subroutine replanSimParallel(thisComponentPlan,status) |
| 208 |
|
!! Unplan Gather Scatter plans |
| 209 |
|
call unplan_gather_scatter(plan_row) |
| 210 |
|
call unplan_gather_scatter(plan_row3d) |
| 211 |
+ |
call unplan_gather_scatter(plan_row_Rotation) |
| 212 |
|
call unplan_gather_scatter(plan_col) |
| 213 |
|
call unplan_gather_scatter(plan_col3d) |
| 214 |
+ |
call unplan_gather_scatter(plan_col_Rotation) |
| 215 |
|
|
| 197 |
– |
|
| 216 |
|
!! initialize gather and scatter plans used in this simulation |
| 217 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsRow,& |
| 217 |
> |
call plan_gather_scatter(1,thisComponentPlan%myNlocal,& |
| 218 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_row) |
| 219 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsRow,& |
| 219 |
> |
call plan_gather_scatter(nDim,thisComponentPlan%myNlocal,& |
| 220 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_row3d) |
| 221 |
< |
call plan_gather_scatter(1,thisComponentPlan%nComponentsColumn,& |
| 221 |
> |
call plan_gather_scatter(9,thisComponentPlan%myNlocal,& |
| 222 |
> |
thisComponentPlan,thisComponentPlan%rowComm,plan_row_Rotation) |
| 223 |
> |
call plan_gather_scatter(1,thisComponentPlan%myNlocal,& |
| 224 |
|
thisComponentPlan,thisComponentPlan%columnComm,plan_col) |
| 225 |
< |
call plan_gather_scatter(nDim,thisComponentPlan%nComponentsColumn,& |
| 225 |
> |
call plan_gather_scatter(nDim,thisComponentPlan%myNlocal,& |
| 226 |
|
thisComponentPlan,thisComponentPlan%rowComm,plan_col3d) |
| 227 |
+ |
call plan_gather_scatter(9,thisComponentPlan%myNlocal,& |
| 228 |
+ |
thisComponentPlan,thisComponentPlan%rowComm,plan_col_Rotation) |
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
| 372 |
|
integer :: i,junk |
| 373 |
|
|
| 374 |
|
if (present(status)) status = 0 |
| 375 |
+ |
|
| 376 |
|
|
| 377 |
|
|
| 378 |
|
!! Set gsComponetPlan pointer |
| 438 |
|
this_plan%displs(i) = this_plan%displs(i-1) + this_plan%counts(i-1) |
| 439 |
|
end do |
| 440 |
|
|
| 441 |
+ |
|
| 442 |
|
end subroutine plan_gather_scatter |
| 443 |
|
|
| 444 |
|
|
| 461 |
|
integer, dimension(:), intent(in) :: rbuffer |
| 462 |
|
integer :: noffset |
| 463 |
|
integer, intent(out), optional :: status |
| 464 |
+ |
integer :: i |
| 465 |
|
|
| 466 |
+ |
|
| 467 |
+ |
|
| 468 |
|
if (present(status)) status = 0 |
| 469 |
|
noffset = this_plan%displs(this_plan%myPlanRank) |
| 470 |
+ |
|
| 471 |
+ |
! if (getmyNode() == 1) then |
| 472 |
+ |
! write(*,*) "Node 0 printing allgatherv vars" |
| 473 |
+ |
! write(*,*) "Noffset: ", noffset |
| 474 |
+ |
! write(*,*) "PlanSize: ", this_plan%gsPlanSize |
| 475 |
+ |
! write(*,*) "PlanComm: ", this_plan%myPlanComm |
| 476 |
+ |
! end if |
| 477 |
|
|
| 478 |
|
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_integer, & |
| 479 |
|
rbuffer,this_plan%counts,this_plan%displs,mpi_integer, & |
| 493 |
|
integer :: noffset |
| 494 |
|
integer, intent(out), optional :: status |
| 495 |
|
|
| 496 |
+ |
|
| 497 |
|
if (present(status)) status = 0 |
| 498 |
|
noffset = this_plan%displs(this_plan%myPlanRank) |
| 499 |
|
|
| 642 |
|
end function isMPISimSet |
| 643 |
|
|
| 644 |
|
|
| 645 |
< |
|
| 645 |
> |
|
| 646 |
> |
subroutine printComponentPlan(this_plan,printNode) |
| 647 |
> |
|
| 648 |
> |
type (mpiComponentPlan), intent(in) :: this_plan |
| 649 |
> |
integer, optional :: printNode |
| 650 |
> |
logical :: print_me = .false. |
| 651 |
> |
|
| 652 |
> |
if (present(printNode)) then |
| 653 |
> |
if (printNode == mpiSim%myNode) print_me = .true. |
| 654 |
> |
else |
| 655 |
> |
print_me = .true. |
| 656 |
> |
endif |
| 657 |
> |
|
| 658 |
> |
if (print_me) then |
| 659 |
> |
write(default_error,*) "SetupSimParallel: writing component plan" |
| 660 |
> |
|
| 661 |
> |
write(default_error,*) "nMolGlobal: ", mpiSim%nMolGlobal |
| 662 |
> |
write(default_error,*) "nAtomsGlobal: ", mpiSim%nAtomsGlobal |
| 663 |
> |
write(default_error,*) "nBondGlobal: ", mpiSim%nBondsGlobal |
| 664 |
> |
write(default_error,*) "nTorsionsGlobal: ", mpiSim%nTorsionsGlobal |
| 665 |
> |
write(default_error,*) "nSRIGlobal: ", mpiSim%nSRIGlobal |
| 666 |
> |
write(default_error,*) "myMolStart: ", mpiSim%myMolStart |
| 667 |
> |
write(default_error,*) "myMolEnd: ", mpiSim%myMolEnd |
| 668 |
> |
write(default_error,*) "myMol: ", mpiSim%myMol |
| 669 |
> |
write(default_error,*) "myNlocal: ", mpiSim%myNlocal |
| 670 |
> |
write(default_error,*) "myNode: ", mpiSim%myNode |
| 671 |
> |
write(default_error,*) "numberProcessors: ", mpiSim%numberProcessors |
| 672 |
> |
write(default_error,*) "rowComm: ", mpiSim%rowComm |
| 673 |
> |
write(default_error,*) "columnComm: ", mpiSim%columnComm |
| 674 |
> |
write(default_error,*) "numberRows: ", mpiSim%numberRows |
| 675 |
> |
write(default_error,*) "numberColumns: ", mpiSim%numberColumns |
| 676 |
> |
write(default_error,*) "nComponentsRow: ", mpiSim%nComponentsRow |
| 677 |
> |
write(default_error,*) "nComponentsColumn: ", mpiSim%nComponentsColumn |
| 678 |
> |
write(default_error,*) "rowIndex: ", mpiSim%rowIndex |
| 679 |
> |
write(default_error,*) "columnIndex: ", mpiSim%columnIndex |
| 680 |
> |
endif |
| 681 |
> |
end subroutine printComponentPlan |
| 682 |
|
|
| 683 |
+ |
function getMyNode() result(myNode) |
| 684 |
+ |
integer :: myNode |
| 685 |
+ |
myNode = mpiSim%myNode |
| 686 |
+ |
end function getMyNode |
| 687 |
+ |
|
| 688 |
+ |
|
| 689 |
|
end module mpiSimulation |
| 690 |
|
|