47 |
|
!! |
48 |
|
!! @author Charles F. Vardeman II |
49 |
|
!! @author Matthew Meineke |
50 |
< |
!! @version $Id: simParallel.F90,v 1.5 2005-09-07 22:23:20 chuckv Exp $, $Date: 2005-09-07 22:23:20 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $ |
50 |
> |
!! @version $Id: simParallel.F90,v 1.7 2006-05-17 19:54:27 gezelter Exp $, $Date: 2006-05-17 19:54:27 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $ |
51 |
|
|
52 |
|
module mpiSimulation |
53 |
|
use definitions |
54 |
+ |
use status |
55 |
|
#ifdef IS_MPI |
56 |
|
use oopseMPI |
57 |
|
implicit none |
87 |
|
public :: mpi_integer |
88 |
|
public :: mpi_lor |
89 |
|
public :: mpi_logical |
90 |
+ |
public :: mpi_real |
91 |
|
public :: mpi_double_precision |
92 |
|
public :: mpi_sum |
93 |
|
public :: mpi_max |
103 |
|
|
104 |
|
!! generic mpi error declaration. |
105 |
|
integer, public :: mpi_err |
106 |
+ |
character(len = statusMsgSize) :: errMsg |
107 |
|
|
108 |
|
#ifdef PROFILE |
109 |
|
public :: printCommTime |
210 |
|
|
211 |
|
!! copy c component plan to fortran |
212 |
|
mpiSim = thisComponentPlan |
213 |
< |
!write(*,*) "Seting up simParallel" |
213 |
> |
write(*,*) "Seting up simParallel" |
214 |
|
|
215 |
|
call make_Force_Grid(mpiSim, localStatus) |
216 |
|
if (localStatus /= 0) then |
217 |
< |
write(default_error,*) "Error creating force grid" |
217 |
> |
write(errMsg, *) 'An error in making the force grid has occurred' |
218 |
> |
call handleError("setupSimParallel", errMsg) |
219 |
|
status = -1 |
220 |
|
return |
221 |
|
endif |
222 |
|
|
223 |
|
call updateGridComponents(mpiSim, localStatus) |
224 |
|
if (localStatus /= 0) then |
225 |
< |
write(default_error,*) "Error updating grid components" |
225 |
> |
write(errMsg,*) "Error updating grid components" |
226 |
> |
call handleError("setupSimParallel", errMsg) |
227 |
|
status = -1 |
228 |
|
return |
229 |
|
endif |
255 |
|
|
256 |
|
call setAtomTags(atomTags,localStatus) |
257 |
|
if (localStatus /= 0) then |
258 |
+ |
write(errMsg, *) 'An error in setting Atom Tags has occured' |
259 |
+ |
call handleError("setupSimParallel", errMsg) |
260 |
|
status = -1 |
261 |
|
return |
262 |
|
endif |
264 |
|
|
265 |
|
call setGroupTags(groupTags,localStatus) |
266 |
|
if (localStatus /= 0) then |
267 |
+ |
write(errMsg, *) 'An error in setting Group Tags has occured' |
268 |
+ |
call handleError("setupSimParallel", errMsg) |
269 |
|
status = -1 |
270 |
|
return |
271 |
|
endif |
603 |
|
#ifdef PROFILE |
604 |
|
call cpu_time(commTimeInitial) |
605 |
|
#endif |
606 |
+ |
#ifdef SINGLE_PRECISION |
607 |
+ |
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_real, & |
608 |
+ |
rbuffer,this_plan%counts,this_plan%displs,mpi_real, & |
609 |
+ |
this_plan%myPlanComm, mpi_err) |
610 |
+ |
#else |
611 |
|
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, & |
612 |
|
rbuffer,this_plan%counts,this_plan%displs,mpi_double_precision, & |
613 |
|
this_plan%myPlanComm, mpi_err) |
614 |
+ |
#endif |
615 |
|
#ifdef PROFILE |
616 |
|
call cpu_time(commTimeFinal) |
617 |
|
commTime = commTime + commTimeFinal - commTimeInitial |
640 |
|
call cpu_time(commTimeInitial) |
641 |
|
#endif |
642 |
|
|
643 |
+ |
#ifdef SINGLE_PRECISION |
644 |
+ |
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_real, & |
645 |
+ |
rbuffer,this_plan%counts,this_plan%displs,mpi_real, & |
646 |
+ |
this_plan%myPlanComm, mpi_err) |
647 |
+ |
#else |
648 |
|
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, & |
649 |
|
rbuffer,this_plan%counts,this_plan%displs,mpi_double_precision, & |
650 |
|
this_plan%myPlanComm, mpi_err) |
651 |
+ |
#endif |
652 |
|
|
653 |
|
#ifdef PROFILE |
654 |
|
call cpu_time(commTimeFinal) |
674 |
|
#ifdef PROFILE |
675 |
|
call cpu_time(commTimeInitial) |
676 |
|
#endif |
677 |
+ |
#ifdef SINGLE_PRECISION |
678 |
|
call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, & |
679 |
+ |
mpi_real, MPI_SUM, this_plan%myPlanComm, mpi_err) |
680 |
+ |
#else |
681 |
+ |
call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, & |
682 |
|
mpi_double_precision, MPI_SUM, this_plan%myPlanComm, mpi_err) |
683 |
+ |
#endif |
684 |
|
#ifdef PROFILE |
685 |
|
call cpu_time(commTimeFinal) |
686 |
|
commTime = commTime + commTimeFinal - commTimeInitial |
704 |
|
#ifdef PROFILE |
705 |
|
call cpu_time(commTimeInitial) |
706 |
|
#endif |
707 |
< |
|
707 |
> |
#ifdef SINGLE_PRECISION |
708 |
|
call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, & |
709 |
+ |
mpi_real, MPI_SUM, this_plan%myPlanComm, mpi_err) |
710 |
+ |
#else |
711 |
+ |
call mpi_reduce_scatter(sbuffer,rbuffer, this_plan%counts, & |
712 |
|
mpi_double_precision, MPI_SUM, this_plan%myPlanComm, mpi_err) |
713 |
+ |
#endif |
714 |
|
#ifdef PROFILE |
715 |
|
call cpu_time(commTimeFinal) |
716 |
|
commTime = commTime + commTimeFinal - commTimeInitial |