5 |
|
!! |
6 |
|
!! @author Charles F. Vardeman II |
7 |
|
!! @author Matthew Meineke |
8 |
< |
!! @version $Id: mpiSimulation_module.F90,v 1.3 2003-01-20 22:36:12 chuckv Exp $, $Date: 2003-01-20 22:36:12 $, $Name: not supported by cvs2svn $, $Revision: 1.3 $ |
8 |
> |
!! @version $Id: mpiSimulation_module.F90,v 1.4 2003-01-30 15:20:21 chuckv Exp $, $Date: 2003-01-30 15:20:21 $, $Name: not supported by cvs2svn $, $Revision: 1.4 $ |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
module mpiSimulation |
14 |
< |
#ifdef MPI |
14 |
> |
#ifdef IS_MPI |
15 |
|
use mpi |
16 |
|
implicit none |
17 |
|
PRIVATE |
70 |
|
integer ,public, allocatable, dimension(:) :: tagColumn |
71 |
|
|
72 |
|
!! Logical set true if mpiSimulation has been initialized |
73 |
< |
logical isSimSet = .false. |
73 |
> |
logical :: isSimSet = .false. |
74 |
|
|
75 |
|
!! gs_plan contains plans for gather and scatter routines |
76 |
|
type, public :: gs_plan |
174 |
|
!! mpiComponentPlan struct from C |
175 |
|
type (mpiComponentPlan), intent(inout) :: thisComponentPlan |
176 |
|
integer, intent(out) :: status |
177 |
< |
integer, intnet(out) :: localStatus |
177 |
> |
integer, intent(out) :: localStatus |
178 |
|
|
179 |
|
status = 0 |
180 |
|
|
286 |
|
|
287 |
|
else |
288 |
|
nWorldProcessors = thisComponentPlan%numberProcessors |
289 |
< |
myWorldRank = thisComponentPlan%myRank |
289 |
> |
myWorldRank = thisComponentPlan%myNode |
290 |
|
endif |
291 |
|
|
292 |
|
|
387 |
|
end if |
388 |
|
|
389 |
|
!! gather all the local sizes into a size # processors array. |
390 |
< |
call mpi_allgather(gs_plan%gsPlanSize,1,mpi_integer,this_plan%counts, & |
390 |
> |
call mpi_allgather(this_plan%gsPlanSize,1,mpi_integer,this_plan%counts, & |
391 |
|
1,mpi_integer,comm,mpi_err) |
392 |
|
|
393 |
|
if (mpi_err /= 0) then |
414 |
|
|
415 |
|
|
416 |
|
this_plan%gsComponentPlan => null() |
417 |
< |
call mpi_comm_free(this_plan%comm,mpi_err) |
417 |
> |
call mpi_comm_free(this_plan%myPlanComm,mpi_err) |
418 |
|
|
419 |
|
deallocate(this_plan%counts) |
420 |
|
deallocate(this_plan%displs) |
451 |
|
integer, intent(out), optional :: status |
452 |
|
|
453 |
|
if (present(status)) status = 0 |
454 |
< |
noffset = this_plan%displs(this_plan%me) |
454 |
> |
noffset = this_plan%displs(this_plan%myPlanRank) |
455 |
|
|
456 |
|
call mpi_allgatherv(sbuffer,this_plan%gsPlanSize, mpi_double_precision, & |
457 |
|
rbuffer,this_plan%counts,this_plan%displs,mpi_double_precision, & |
526 |
|
|
527 |
|
|
528 |
|
subroutine setTags(tags,status) |
529 |
< |
integer, dimension(:) tags |
529 |
> |
integer, dimension(:) :: tags |
530 |
|
integer :: status |
531 |
|
|
532 |
|
integer :: alloc_stat |
533 |
|
|
534 |
+ |
integer :: ncol |
535 |
+ |
integer :: nrow |
536 |
+ |
|
537 |
|
status = 0 |
538 |
|
! allocate row arrays |
539 |
+ |
nrow = getNrow(plan_row) |
540 |
+ |
ncol = getNcol(plan_col) |
541 |
+ |
|
542 |
|
if (.not. allocated(tagRow)) then |
543 |
< |
allocate(tagRow(getNrow(plan_row)),STAT=alloc_stat) |
543 |
> |
allocate(tagRow(nrow),STAT=alloc_stat) |
544 |
|
if (alloc_stat /= 0 ) then |
545 |
|
status = -1 |
546 |
|
return |
547 |
|
endif |
548 |
|
else |
549 |
|
deallocate(tagRow) |
550 |
< |
allocate(tagRow(getNrow(plan_row)),STAT=alloc_stat) |
550 |
> |
allocate(tagRow(nrow),STAT=alloc_stat) |
551 |
|
if (alloc_stat /= 0 ) then |
552 |
|
status = -1 |
553 |
|
return |
556 |
|
endif |
557 |
|
! allocate column arrays |
558 |
|
if (.not. allocated(tagCol)) then |
559 |
< |
allocate(tagCol(getNcol(plan_col)),STAT=alloc_stat) |
559 |
> |
allocate(tagColumn(ncol),STAT=alloc_stat) |
560 |
|
if (alloc_stat /= 0 ) then |
561 |
|
status = -1 |
562 |
|
return |
563 |
|
endif |
564 |
|
else |
565 |
< |
deallocate(tagCol) |
566 |
< |
allocate(tagCol(getNcol(plan_col)),STAT=alloc_stat) |
565 |
> |
deallocate(tagColumn) |
566 |
> |
allocate(tagColumn(ncol),STAT=alloc_stat) |
567 |
|
if (alloc_stat /= 0 ) then |
568 |
|
status = -1 |
569 |
|
return |
571 |
|
endif |
572 |
|
|
573 |
|
call gather(tags,tagRow,plan_row) |
574 |
< |
call gather(tags,tagCol,plan_col) |
574 |
> |
call gather(tags,tagColumn,plan_col) |
575 |
|
|
576 |
|
|
577 |
|
end subroutine setTags |
578 |
|
|
579 |
< |
function getNcol(thisplan) result(ncol) |
580 |
< |
type (gsPlan) :: thisplan |
579 |
> |
pure function getNcol(thisplan) result(ncol) |
580 |
> |
type (gs_plan), intent(in) :: thisplan |
581 |
|
integer :: ncol |
582 |
< |
ncol = thisplan%gsComponentPlan%nComponentsCol |
582 |
> |
ncol = thisplan%gsComponentPlan%nComponentsColumn |
583 |
|
end function getNcol |
584 |
|
|
585 |
< |
function getNrow(thisplan) result(ncol) |
586 |
< |
type (gsPlan) :: thisplan |
585 |
> |
pure function getNrow(thisplan) result(ncol) |
586 |
> |
type (gs_plan), intent(in) :: thisplan |
587 |
|
integer :: ncol |
588 |
|
ncol = thisplan%gsComponentPlan%nComponentsrow |
589 |
|
end function getNrow |
590 |
|
|
591 |
< |
logical function isMPISimSet() result(isthisSimSet) |
591 |
> |
function isMPISimSet() result(isthisSimSet) |
592 |
|
logical :: isthisSimSet |
593 |
|
if (isSimSet) then |
594 |
|
isthisSimSet = .true. |