Skip to content

Commit d0d8a1e

Browse files
Fix issues in vector3d side exchange and 3d mpi gpu comms
1 parent 2228ec7 commit d0d8a1e

File tree

54 files changed

+425
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+425
-236
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90)
6868
# Fortran compiler flags
6969
if( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" )
7070
set( CMAKE_Fortran_FLAGS "${CMAKE_FORTRAN_FLAGS} -cpp -ffree-line-length-512" )
71-
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -C -Wall -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" )
71+
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -C -Wall -fbounds-check -fbacktrace" )
72+
#set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -C -Wall -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" )
7273
set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} --coverage")
7374
set( CMAKE_Fortran_FLAGS_PROFILE "-pg -O3")
7475
set( CMAKE_Fortran_FLAGS_RELEASE "-O3" )

src/SELF_DomainDecomposition_t.f90

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ subroutine Init_DomainDecomposition_t(this,enableMPI)
6666
#undef __FUNC__
6767
#define __FUNC__ "Init_DomainDecomposition_t"
6868
implicit none
69-
class(DomainDecomposition_t),intent(out) :: this
69+
class(DomainDecomposition_t),intent(inout) :: this
7070
logical,intent(in) :: enableMPI
7171
! Local
7272
integer :: ierror
@@ -81,9 +81,9 @@ subroutine Init_DomainDecomposition_t(this,enableMPI)
8181
if(enableMPI) then
8282
this%mpiComm = MPI_COMM_WORLD
8383
print*,__FILE__," : Initializing MPI"
84-
call MPI_INIT(ierror)
85-
call MPI_COMM_RANK(this%mpiComm,this%rankId,ierror)
86-
call MPI_COMM_SIZE(this%mpiComm,this%nRanks,ierror)
84+
call mpi_init(ierror)
85+
call mpi_comm_rank(this%mpiComm,this%rankId,ierror)
86+
call mpi_comm_size(this%mpiComm,this%nRanks,ierror)
8787
print*,__FILE__," : Rank ",this%rankId+1,"/",this%nRanks," checking in."
8888
else
8989
print*,__FILE__," : MPI not initialized. No domain decomposition used."

src/SELF_MappedScalar_3D_t.f90

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ subroutine SideExchange_MappedScalar3D_t(this,mesh)
334334
if(r2 == rankId) then
335335

336336
e2 = e2Global-offset
337+
337338
if(flip == 0) then
338339

339340
do j = 1,this%interp%N+1

src/SELF_MappedVector_3D_t.f90

+56-29
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ subroutine SideExchange_MappedVector3D_t(this,mesh)
316316
! Local
317317
integer :: e1,e2,s1,s2,e2Global
318318
integer :: flip
319-
integer :: i1,i2,j1,j2,ivar
319+
integer :: i,i2,j,j2,ivar
320320
integer :: r2
321321
integer :: rankId,offset
322322
integer :: idir
@@ -333,7 +333,6 @@ subroutine SideExchange_MappedVector3D_t(this,mesh)
333333
do concurrent(s1=1:6,e1=1:mesh%nElem,ivar=1:this%nvar,idir=1:3)
334334

335335
e2Global = mesh%sideInfo(3,s1,e1)
336-
e2 = e2Global-offset
337336
s2 = mesh%sideInfo(4,s1,e1)/10
338337
flip = mesh%sideInfo(4,s1,e1)-s2*10
339338

@@ -343,58 +342,86 @@ subroutine SideExchange_MappedVector3D_t(this,mesh)
343342

344343
if(r2 == rankId) then
345344

345+
e2 = e2Global-offset
346+
346347
if(flip == 0) then
347348

348-
do j1 = 1,this%interp%N+1
349-
do i1 = 1,this%interp%N+1
350-
this%extBoundary(i1,j1,s1,e1,ivar,idir) = &
351-
this%boundary(i1,j1,s2,e2,ivar,idir)
349+
do j = 1,this%interp%N+1
350+
do i = 1,this%interp%N+1
351+
this%extBoundary(i,j,s1,e1,ivar,idir) = &
352+
this%boundary(i,j,s2,e2,ivar,idir)
352353
enddo
353354
enddo
354355

355356
else if(flip == 1) then
356357

357-
do j1 = 1,this%interp%N+1
358-
do i1 = 1,this%interp%N+1
359-
360-
i2 = j1
361-
j2 = this%interp%N+2-i1
362-
this%extBoundary(i1,j1,s1,e1,ivar,idir) = &
358+
do j = 1,this%interp%N+1
359+
do i = 1,this%interp%N+1
360+
i2 = this%interp%N+2-i
361+
j2 = j
362+
this%extBoundary(i,j,s1,e1,ivar,idir) = &
363363
this%boundary(i2,j2,s2,e2,ivar,idir)
364-
365364
enddo
366365
enddo
367366

368367
else if(flip == 2) then
369368

370-
do j1 = 1,this%interp%N+1
371-
do i1 = 1,this%interp%N+1
372-
i2 = this%interp%N+2-i1
373-
j2 = this%interp%N+2-j1
374-
this%extBoundary(i1,j1,s1,e1,ivar,idir) = &
369+
do j = 1,this%interp%N+1
370+
do i = 1,this%interp%N+1
371+
i2 = this%interp%N+2-i
372+
j2 = this%interp%N+2-j
373+
this%extBoundary(i,j,s1,e1,ivar,idir) = &
375374
this%boundary(i2,j2,s2,e2,ivar,idir)
376375
enddo
377376
enddo
378377

379378
else if(flip == 3) then
380379

381-
do j1 = 1,this%interp%N+1
382-
do i1 = 1,this%interp%N+1
383-
i2 = this%interp%N+2-j1
384-
j2 = i1
385-
this%extBoundary(i1,j1,s1,e1,ivar,idir) = &
380+
do j = 1,this%interp%N+1
381+
do i = 1,this%interp%N+1
382+
i2 = i
383+
j2 = this%interp%N+2-j
384+
this%extBoundary(i,j,s1,e1,ivar,idir) = &
386385
this%boundary(i2,j2,s2,e2,ivar,idir)
387386
enddo
388387
enddo
389388

390389
else if(flip == 4) then
391390

392-
do j1 = 1,this%interp%N+1
393-
do i1 = 1,this%interp%N+1
394-
i2 = j1
395-
j2 = i1
396-
this%extBoundary(i1,j1,s1,e1,ivar,idir) = &
397-
this%boundary(i2,j2,s2,e2,ivar,idir)
391+
do j = 1,this%interp%N+1
392+
do i = 1,this%interp%N+1
393+
this%extBoundary(i,j,s1,e1,ivar,idir) = &
394+
this%boundary(j,i,s2,e2,ivar,idir)
395+
enddo
396+
enddo
397+
398+
else if(flip == 5) then
399+
400+
do j = 1,this%interp%N+1
401+
do i = 1,this%interp%N+1
402+
i2 = this%interp%N+2-j
403+
j2 = i
404+
this%extBoundary(i,j,s1,e1,ivar,idir) = this%boundary(i2,j2,s2,e2,ivar,idir)
405+
enddo
406+
enddo
407+
408+
else if(flip == 6) then
409+
410+
do j = 1,this%interp%N+1
411+
do i = 1,this%interp%N+1
412+
i2 = this%interp%N+2-j
413+
j2 = this%interp%N+2-i
414+
this%extBoundary(i,j,s1,e1,ivar,idir) = this%boundary(i2,j2,s2,e2,ivar,idir)
415+
enddo
416+
enddo
417+
418+
else if(flip == 7) then
419+
420+
do j = 1,this%interp%N+1
421+
do i = 1,this%interp%N+1
422+
i2 = j
423+
j2 = this%interp%N+2-i
424+
this%extBoundary(i,j,s1,e1,ivar,idir) = this%boundary(i2,j2,s2,e2,ivar,idir)
398425
enddo
399426
enddo
400427

src/gpu/SELF_DomainDecomposition.f90

-50
Original file line numberDiff line numberDiff line change
@@ -37,64 +37,14 @@ module SELF_DomainDecomposition
3737

3838
contains
3939

40-
procedure :: Init => Init_DomainDecomposition
4140
procedure :: Free => Free_DomainDecomposition
4241

4342
procedure :: SetElemToRank => SetElemToRank_DomainDecomposition
4443

4544
endtype DomainDecomposition
4645

47-
interface
48-
function check_gpu_aware_support() bind(c,name="check_gpu_aware_support")
49-
use iso_c_binding
50-
integer(c_int) :: check_gpu_aware_support
51-
endfunction check_gpu_aware_support
52-
endinterface
5346
contains
5447

55-
subroutine Init_DomainDecomposition(this,enableMPI)
56-
implicit none
57-
class(DomainDecomposition),intent(out) :: this
58-
logical,intent(in) :: enableMPI
59-
! Local
60-
integer :: ierror
61-
integer(c_int) :: gpuaware
62-
63-
this%mpiComm = 0
64-
this%mpiPrec = prec
65-
this%rankId = 0
66-
this%nRanks = 1
67-
this%nElem = 0
68-
this%mpiEnabled = enableMPI
69-
70-
if(enableMPI) then
71-
this%mpiComm = MPI_COMM_WORLD
72-
print*,__FILE__," : Initializing MPI"
73-
call MPI_INIT(ierror)
74-
75-
if(check_gpu_aware_support() == 0) then
76-
print*,__FILE__" : Error! GPU Aware support is not detected. Stopping."
77-
call MPI_FINALIZE(ierror)
78-
stop 1
79-
endif
80-
81-
call MPI_COMM_RANK(this%mpiComm,this%rankId,ierror)
82-
call MPI_COMM_SIZE(this%mpiComm,this%nRanks,ierror)
83-
print*,__FILE__," : Rank ",this%rankId+1,"/",this%nRanks," checking in."
84-
else
85-
print*,__FILE__," : MPI not initialized. No domain decomposition used."
86-
endif
87-
88-
if(prec == real32) then
89-
this%mpiPrec = MPI_FLOAT
90-
else
91-
this%mpiPrec = MPI_DOUBLE
92-
endif
93-
94-
allocate(this%offsetElem(1:this%nRanks+1))
95-
96-
endsubroutine Init_DomainDecomposition
97-
9848
subroutine Free_DomainDecomposition(this)
9949
implicit none
10050
class(DomainDecomposition),intent(inout) :: this

0 commit comments

Comments
 (0)