Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fprettify #72

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ extends:
INTEL_CONFIG: config/defaults/config.LINUX_INTEL_OPENMPI.mk
TAPENADE: true
TAPENADE_VERSION: "3.16"
FPRETTIFY: true
147 changes: 73 additions & 74 deletions src/IO/createGrid.F90
Original file line number Diff line number Diff line change
@@ -1,78 +1,77 @@
subroutine createCommonGrid(volNodes, nVolLocal)

! This routine create a few arrys that are the size of the "common"
! grid...that is the ordering that is given in the original grid
! file. Generally this will result in a dumb "nVol/nProc"
! distribution, while exact, does not result in proper load
! balancing since each volume node will take a different amount of
! time.

use gridData
use communication
implicit none

! Subroutine variables
integer(kind=intType), intent(in) :: nVolLocal
real(kind=realType), dimension(3, nVolLocal), intent(in) :: volNodes

! Working variables
integer(kind=intType) :: i, j, nVol, ierr, nSurface
integer(kind=intType), dimension(:), allocatable :: volNodesProc

! Gather the displacements
allocate(volNodesProc(0:nProc))
volNodesProc(:) = 0
call MPI_allgather(nVolLocal, 1, MPI_INTEGER, volNodesProc(1:), 1, MPI_INTEGER, &
warp_comm_world, ierr)
call EChk(ierr,__FILE__,__LINE__)

! Finish the displacment calc:
do i=2, nProc
volNodesProc(i) = volNodesProc(i) + volNodesProc(i-1)
end do
nVol = volNodesProc(nProc)

if (myid == 0) then
write(*,"(a)", advance="no") '#------------------------------#'
print "(1x)"
write(*,"(a)", advance="no") " Total Volume Nodes : "
write(*,"(I9,1x)",advance="no") nVol
print "(1x)"
write(*,"(a)", advance="no") '#------------------------------#'
print "(1x)"
end if

! Now create the master Xv array:
call VecCreate(warp_comm_world, commonGridVec, ierr)
call EChk(ierr,__FILE__,__LINE__)

! Set to be be blocked
call VecSetBlockSize(commonGridVec, 3, ierr)
call EChk(ierr,__FILE__,__LINE__)

! Type and size
call VecSetType(commonGridVec, "mpi", ierr)
call EChk(ierr,__FILE__,__LINE__)

call VecSetSizes(commonGridVec, nVolLocal*3, PETSC_DECIDE, ierr)
call EChk(ierr,__FILE__,__LINE__)

! Now each processor adds it's own nodes (It is possible only one proc does it)
do i=1, nVolLocal
call VecSetValuesBlocked(commonGridVec, 1, (/volNodesProc(myid) + i - 1/), volNodes(:, i), INSERT_VALUES, ierr)
call EChk(ierr,__FILE__,__LINE__)
end do

call VecAssemblyBegin(commonGridVec, ierr)
call EChk(ierr,__FILE__,__LINE__)

call VecAssemblyEnd(commonGridVec, ierr)
call EChk(ierr,__FILE__,__LINE__)


deallocate(volNodesProc)
commonGridVecSet = 1

commonMeshDOF = nVol*3
! This routine create a few arrys that are the size of the "common"
! grid...that is the ordering that is given in the original grid
! file. Generally this will result in a dumb "nVol/nProc"
! distribution, while exact, does not result in proper load
! balancing since each volume node will take a different amount of
! time.

use gridData
use communication
implicit none

! Subroutine variables
integer(kind=intType), intent(in) :: nVolLocal
real(kind=realType), dimension(3, nVolLocal), intent(in) :: volNodes

! Working variables
integer(kind=intType) :: i, j, nVol, ierr, nSurface
integer(kind=intType), dimension(:), allocatable :: volNodesProc

! Gather the displacements
allocate (volNodesProc(0:nProc))
volNodesProc(:) = 0
call MPI_allgather(nVolLocal, 1, MPI_INTEGER, volNodesProc(1:), 1, MPI_INTEGER, &
warp_comm_world, ierr)
call EChk(ierr, __FILE__, __LINE__)

! Finish the displacment calc:
do i = 2, nProc
volNodesProc(i) = volNodesProc(i) + volNodesProc(i - 1)
end do
nVol = volNodesProc(nProc)

if (myid == 0) then
write (*, "(a)", advance="no") '#------------------------------#'
print "(1x)"
write (*, "(a)", advance="no") " Total Volume Nodes : "
write (*, "(I9,1x)", advance="no") nVol
print "(1x)"
write (*, "(a)", advance="no") '#------------------------------#'
print "(1x)"
end if

! Now create the master Xv array:
call VecCreate(warp_comm_world, commonGridVec, ierr)
call EChk(ierr, __FILE__, __LINE__)

! Set to be be blocked
call VecSetBlockSize(commonGridVec, 3, ierr)
call EChk(ierr, __FILE__, __LINE__)

! Type and size
call VecSetType(commonGridVec, "mpi", ierr)
call EChk(ierr, __FILE__, __LINE__)

call VecSetSizes(commonGridVec, nVolLocal * 3, PETSC_DECIDE, ierr)
call EChk(ierr, __FILE__, __LINE__)

! Now each processor adds it's own nodes (It is possible only one proc does it)
do i = 1, nVolLocal
call VecSetValuesBlocked(commonGridVec, 1, (/volNodesProc(myid) + i - 1/), volNodes(:, i), INSERT_VALUES, ierr)
call EChk(ierr, __FILE__, __LINE__)
end do

call VecAssemblyBegin(commonGridVec, ierr)
call EChk(ierr, __FILE__, __LINE__)

call VecAssemblyEnd(commonGridVec, ierr)
call EChk(ierr, __FILE__, __LINE__)

deallocate (volNodesProc)
commonGridVecSet = 1

commonMeshDOF = nVol * 3

end subroutine createCommonGrid
Loading