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.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 |
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 |
|
|
147 |
|
!! copy c component plan to fortran |
148 |
|
mpiSim = thisComponentPlan |
149 |
|
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 |
150 |
|
|
171 |
– |
|
151 |
|
call make_Force_Grid(mpiSim,localStatus) |
152 |
|
if (localStatus /= 0) then |
153 |
|
write(default_error,*) "Error creating force grid" |
164 |
|
|
165 |
|
|
166 |
|
!! initialize gather and scatter plans used in this simulation |
167 |
< |
call plan_gather_scatter(1,mpiSim%nComponentsRow,& |
167 |
> |
call plan_gather_scatter(1,mpiSim%myNlocal,& |
168 |
|
mpiSim,mpiSim%rowComm,plan_row) |
169 |
< |
call plan_gather_scatter(nDim,mpiSim%nComponentsRow,& |
169 |
> |
call plan_gather_scatter(nDim,mpiSim%myNlocal,& |
170 |
|
mpiSim,mpiSim%rowComm,plan_row3d) |
171 |
< |
call plan_gather_scatter(1,mpiSim%nComponentsColumn,& |
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%nComponentsColumn,& |
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 |
|
|
227 |
– |
|
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 |
|
|
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 |
|
|