Skip to content

Commit

Permalink
Remove redundant dirps argument in tds_solve.
Browse files Browse the repository at this point in the history
  • Loading branch information
semi-h committed Aug 29, 2024
1 parent 00a3d54 commit 30fb35e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
13 changes: 6 additions & 7 deletions src/backend.f90
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ end subroutine transeq_ders
end interface

abstract interface
subroutine tds_solve(self, du, u, dirps, tdsops)
!! transeq equation obtains the derivatives direction by
!! direction, and the exact algorithm used to obtain these
!! derivatives are decided at runtime. Backend implementations
!! are responsible from directing calls to transeq_ders into
!! the correct algorithm.
subroutine tds_solve(self, du, u, tdsops)
!! transeq equation obtains the derivatives direction by
!! direction, and the exact algorithm used to obtain these
!! derivatives are decided at runtime. Backend implementations
!! are responsible from directing calls to transeq_ders into
!! the correct algorithm.
import :: base_backend_t
import :: field_t
import :: dirps_t
Expand All @@ -82,7 +82,6 @@ subroutine tds_solve(self, du, u, dirps, tdsops)
class(base_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
type(dirps_t), intent(in) :: dirps
class(tdsops_t), intent(in) :: tdsops
end subroutine tds_solve
end interface
Expand Down
12 changes: 5 additions & 7 deletions src/cuda/backend.f90
Original file line number Diff line number Diff line change
Expand Up @@ -352,35 +352,33 @@ subroutine transeq_cuda_thom(self, du, dv, dw, u, v, w, dirps)

end subroutine transeq_cuda_thom

subroutine tds_solve_cuda(self, du, u, dirps, tdsops)
subroutine tds_solve_cuda(self, du, u, tdsops)
implicit none

class(cuda_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
type(dirps_t), intent(in) :: dirps
class(tdsops_t), intent(in) :: tdsops

type(dim3) :: blocks, threads

! Check if direction matches for both in/out fields and dirps
if (dirps%dir /= du%dir .or. u%dir /= du%dir) then
error stop 'DIR mismatch between fields and dirps in tds_solve.'
if (u%dir /= du%dir) then
error stop 'DIR mismatch between fields in tds_solve.'
end if

blocks = dim3(self%mesh%get_n_groups(u), 1, 1); threads = dim3(SZ, 1, 1)

call tds_solve_dist(self, du, u, dirps, tdsops, blocks, threads)
call tds_solve_dist(self, du, u, tdsops, blocks, threads)

end subroutine tds_solve_cuda

subroutine tds_solve_dist(self, du, u, dirps, tdsops, blocks, threads)
subroutine tds_solve_dist(self, du, u, tdsops, blocks, threads)
implicit none

class(cuda_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
type(dirps_t), intent(in) :: dirps
class(tdsops_t), intent(in) :: tdsops
type(dim3), intent(in) :: blocks, threads

Expand Down
14 changes: 6 additions & 8 deletions src/omp/backend.f90
Original file line number Diff line number Diff line change
Expand Up @@ -270,31 +270,29 @@ subroutine transeq_dist_component(self, rhs, u, conv, &

end subroutine transeq_dist_component

subroutine tds_solve_omp(self, du, u, dirps, tdsops)
subroutine tds_solve_omp(self, du, u, tdsops)
implicit none

class(omp_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
type(dirps_t), intent(in) :: dirps
class(tdsops_t), intent(in) :: tdsops

! Check if direction matches for both in/out fields and dirps
if (dirps%dir /= du%dir .or. u%dir /= du%dir) then
error stop 'DIR mismatch between fields and dirps in tds_solve.'
! Check if direction matches for both in/out fields
if (u%dir /= du%dir) then
error stop 'DIR mismatch between fields in tds_solve.'
end if

call tds_solve_dist(self, du, u, dirps, tdsops)
call tds_solve_dist(self, du, u, tdsops)

end subroutine tds_solve_omp

subroutine tds_solve_dist(self, du, u, dirps, tdsops)
subroutine tds_solve_dist(self, du, u, tdsops)
implicit none

class(omp_backend_t) :: self
class(field_t), intent(inout) :: du
class(field_t), intent(in) :: u
type(dirps_t), intent(in) :: dirps
class(tdsops_t), intent(in) :: tdsops
integer :: n_halo, n_groups, dir

Expand Down

0 comments on commit 30fb35e

Please sign in to comment.