5 |
|
!! |
6 |
|
!! @author Charles F. Vardeman II |
7 |
|
!! @author Matthew Meineke |
8 |
< |
!! @version $Id: mpiSimulation_module.F90,v 1.6 2003-01-30 22:29:58 chuckv Exp $, $Date: 2003-01-30 22:29:58 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $ |
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 |
145 |
|
!! copy c component plan to fortran |
146 |
|
mpiSim = thisComponentPlan |
147 |
|
write(*,*) "Seting up simParallel" |
147 |
– |
if (mpiSim%myNode == 0) then |
148 |
– |
write(*,*) "SetupSimParallel: writing component plan" |
149 |
– |
|
150 |
– |
write(*,*) "nMolGlobal: ", mpiSim%nMolGlobal |
151 |
– |
write(*,*) "nAtomsGlobal: ", mpiSim%nAtomsGlobal |
152 |
– |
write(*,*) "nBondGlobal: ", mpiSim%nBondsGlobal |
153 |
– |
write(*,*) "nTorsionsGlobal: ", mpiSim%nTorsionsGlobal |
154 |
– |
write(*,*) "nSRIGlobal: ", mpiSim%nSRIGlobal |
155 |
– |
write(*,*) "myMolStart: ", mpiSim%myMolStart |
156 |
– |
write(*,*) "myMolEnd: ", mpiSim%myMolEnd |
157 |
– |
write(*,*) "myMol: ", mpiSim%myMol |
158 |
– |
write(*,*) "myNlocal: ", mpiSim%myNlocal |
159 |
– |
write(*,*) "myNode: ", mpiSim%myNode |
160 |
– |
write(*,*) "numberProcessors: ", mpiSim%numberProcessors |
161 |
– |
write(*,*) "rowComm: ", mpiSim%rowComm |
162 |
– |
write(*,*) "columnComm: ", mpiSim%columnComm |
163 |
– |
write(*,*) "numberRows: ", mpiSim%numberRows |
164 |
– |
write(*,*) "numberColumns: ", mpiSim%numberColumns |
165 |
– |
write(*,*) "nComponentsRow: ", mpiSim%nComponentsRow |
166 |
– |
write(*,*) "nComponentsColumn: ", mpiSim%nComponentsColumn |
167 |
– |
write(*,*) "rowIndex: ", mpiSim%rowIndex |
168 |
– |
write(*,*) "columnIndex: ", mpiSim%columnIndex |
169 |
– |
endif |
148 |
|
|
171 |
– |
|
149 |
|
call make_Force_Grid(mpiSim,localStatus) |
150 |
|
if (localStatus /= 0) then |
151 |
|
write(default_error,*) "Error creating force grid" |
162 |
|
|
163 |
|
|
164 |
|
!! initialize gather and scatter plans used in this simulation |
165 |
< |
call plan_gather_scatter(1,mpiSim%nComponentsRow,& |
165 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
166 |
|
mpiSim,mpiSim%rowComm,plan_row) |
167 |
< |
call plan_gather_scatter(nDim,mpiSim%nComponentsRow,& |
167 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
168 |
|
mpiSim,mpiSim%rowComm,plan_row3d) |
169 |
< |
call plan_gather_scatter(1,mpiSim%nComponentsColumn,& |
169 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
170 |
|
mpiSim,mpiSim%columnComm,plan_col) |
171 |
< |
call plan_gather_scatter(nDim,mpiSim%nComponentsColumn,& |
171 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
172 |
|
mpiSim,mpiSim%columnComm,plan_col3d) |
173 |
|
|
174 |
|
! Initialize tags |
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 |
|
|
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 |
|
|
642 |
– |
|
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 |
|
|