Skip to content

Commit 04883e0

Browse files
committed
refactor: Rename trans/transpose -> reorder.
1 parent 270bf4b commit 04883e0

File tree

7 files changed

+55
-55
lines changed

7 files changed

+55
-55
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(CUDASRC
1717
cuda/allocator.f90
1818
cuda/exec_dist.f90
1919
cuda/kernels_dist.f90
20-
cuda/kernels_trans.f90
20+
cuda/kernels_reorder.f90
2121
cuda/sendrecv.f90
2222
cuda/tdsops.f90
2323
)

src/backend.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module m_base_backend
2929
procedure(transeq_ders), deferred :: transeq_y
3030
procedure(transeq_ders), deferred :: transeq_z
3131
procedure(tds_solve), deferred :: tds_solve
32-
procedure(trans_d2d), deferred :: trans_d2d
32+
procedure(reorder), deferred :: reorder
3333
procedure(sum9into3), deferred :: sum_yzintox
3434
procedure(vecadd), deferred :: vecadd
3535
procedure(get_fields), deferred :: get_fields
@@ -78,8 +78,8 @@ end subroutine tds_solve
7878
end interface
7979

8080
abstract interface
81-
subroutine trans_d2d(self, u_, u, direction)
82-
!! transposer subroutines are straightforward, they rearrange
81+
subroutine reorder(self, u_, u, direction)
82+
!! reorder subroutines are straightforward, they rearrange
8383
!! data into our specialist data structure so that regardless
8484
!! of the direction tridiagonal systems are solved efficiently
8585
!! and fast.
@@ -91,7 +91,7 @@ subroutine trans_d2d(self, u_, u, direction)
9191
class(field_t), intent(inout) :: u_
9292
class(field_t), intent(in) :: u
9393
integer, intent(in) :: direction
94-
end subroutine trans_d2d
94+
end subroutine reorder
9595
end interface
9696

9797
abstract interface

src/common.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module m_common
44
integer, parameter :: dp=kind(0.0d0)
55
real(dp), parameter :: pi = 4*atan(1.0_dp)
66

7-
integer, parameter :: TRP_X2Y = 12, TRP_X2Z = 13, TRP_Y2X = 21, &
8-
TRP_Y2Z = 23, TRP_Z2Y = 32
7+
integer, parameter :: RDR_X2Y = 12, RDR_X2Z = 13, RDR_Y2X = 21, &
8+
RDR_Y2Z = 23, RDR_Z2Y = 32
99

1010
type :: globs_t
1111
integer :: nx, ny, nz

src/cuda/backend.f90

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module m_cuda_backend
33

44
use m_allocator, only: allocator_t, field_t
55
use m_base_backend, only: base_backend_t
6-
use m_common, only: dp, globs_t, TRP_X2Y, TRP_X2Z, TRP_Y2X, TRP_Y2Z, TRP_Z2Y
6+
use m_common, only: dp, globs_t, RDR_X2Y, RDR_X2Z, RDR_Y2X, RDR_Y2Z, RDR_Z2Y
77
use m_tdsops, only: dirps_t, tdsops_t
88

99
use m_cuda_allocator, only: cuda_allocator_t, cuda_field_t
@@ -12,8 +12,8 @@ module m_cuda_backend
1212
use m_cuda_sendrecv, only: sendrecv_fields, sendrecv_3fields
1313
use m_cuda_tdsops, only: cuda_tdsops_t
1414
use m_cuda_kernels_dist, only: transeq_3fused_dist, transeq_3fused_subs
15-
use m_cuda_kernels_trans, only: trans_x2y_k, trans_x2z_k, trans_y2x_k, &
16-
trans_y2z_k, trans_z2y_k
15+
use m_cuda_kernels_reorder, only: reorder_x2y, reorder_x2z, reorder_y2x, &
16+
reorder_y2z, reorder_z2y
1717

1818
implicit none
1919

@@ -34,7 +34,7 @@ module m_cuda_backend
3434
procedure :: transeq_y => transeq_y_cuda
3535
procedure :: transeq_z => transeq_z_cuda
3636
procedure :: tds_solve => tds_solve_cuda
37-
procedure :: trans_d2d => trans_d2d_cuda
37+
procedure :: reorder => reorder_cuda
3838
procedure :: sum_yzintox => sum_yzintox_cuda
3939
procedure :: vecadd => vecadd_cuda
4040
procedure :: set_fields => set_fields_cuda
@@ -417,7 +417,7 @@ subroutine tds_solve_dist(self, du, u, dirps, tdsops, blocks, threads)
417417

418418
end subroutine tds_solve_dist
419419

420-
subroutine trans_d2d_cuda(self, u_o, u_i, direction)
420+
subroutine reorder_cuda(self, u_o, u_i, direction)
421421
implicit none
422422

423423
class(cuda_backend_t) :: self
@@ -432,35 +432,35 @@ subroutine trans_d2d_cuda(self, u_o, u_i, direction)
432432
select type(u_i); type is (cuda_field_t); u_i_d => u_i%data_d; end select
433433

434434
select case (direction)
435-
case (TRP_X2Y) ! x2y
435+
case (RDR_X2Y) ! x2y
436436
blocks = dim3(self%nx_loc/SZ, self%nz_loc, self%ny_loc/SZ)
437437
threads = dim3(SZ, SZ, 1)
438-
call trans_x2y_k<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
439-
case (TRP_X2Z) ! x2z
438+
call reorder_x2y<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
439+
case (RDR_X2Z) ! x2z
440440
blocks = dim3(self%nx_loc, self%ny_loc/SZ, 1)
441441
threads = dim3(SZ, 1, 1)
442-
call trans_x2z_k<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
443-
case (TRP_Y2X) ! y2x
442+
call reorder_x2z<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
443+
case (RDR_Y2X) ! y2x
444444
blocks = dim3(self%nx_loc/SZ, self%ny_loc/SZ, self%nz_loc)
445445
threads = dim3(SZ, SZ, 1)
446-
call trans_y2x_k<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
447-
case (TRP_Y2Z) ! y2z
446+
call reorder_y2x<<<blocks, threads>>>(u_o_d, u_i_d, self%nz_loc)
447+
case (RDR_Y2Z) ! y2z
448448
blocks = dim3(self%nx_loc/SZ, self%ny_loc/SZ, self%nz_loc)
449449
threads = dim3(SZ, SZ, 1)
450-
call trans_y2z_k<<<blocks, threads>>>(u_o_d, u_i_d, &
450+
call reorder_y2z<<<blocks, threads>>>(u_o_d, u_i_d, &
451451
self%nx_loc, self%nz_loc)
452-
case (TRP_Z2Y) ! z2y
452+
case (RDR_Z2Y) ! z2y
453453
blocks = dim3(self%nx_loc/SZ, self%ny_loc/SZ, self%nz_loc)
454454
threads = dim3(SZ, SZ, 1)
455455

456-
call trans_z2y_k<<<blocks, threads>>>(u_o_d, u_i_d, &
456+
call reorder_z2y<<<blocks, threads>>>(u_o_d, u_i_d, &
457457
self%nx_loc, self%nz_loc)
458458
case default
459459
print *, 'Transpose direction is undefined.'
460460
stop
461461
end select
462462

463-
end subroutine trans_d2d_cuda
463+
end subroutine reorder_cuda
464464

465465
subroutine sum_yzintox_cuda(self, du, dv, dw, &
466466
du_y, dv_y, dw_y, du_z, dv_z, dw_z)
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
module m_cuda_kernels_trans
1+
module m_cuda_kernels_reorder
22
use cudafor
33

44
use m_common, only: dp
55
use m_cuda_common, only: SZ
66

77
contains
88

9-
attributes(global) subroutine trans_x2y_k(u_y, u_x, nz)
9+
attributes(global) subroutine reorder_x2y(u_y, u_x, nz)
1010
implicit none
1111

1212
real(dp), device, intent(out), dimension(:, :, :) :: u_y
@@ -27,9 +27,9 @@ attributes(global) subroutine trans_x2y_k(u_y, u_x, nz)
2727
! copy into output array from shared
2828
u_y(i, j + (b_k - 1)*SZ, b_j + (b_i - 1)*nz) = tile(j, i)
2929

30-
end subroutine trans_x2y_k
30+
end subroutine reorder_x2y
3131

32-
attributes(global) subroutine trans_x2z_k(u_z, u_x, nz)
32+
attributes(global) subroutine reorder_x2z(u_z, u_x, nz)
3333
implicit none
3434

3535
real(dp), device, intent(out), dimension(:, :, :) :: u_z
@@ -45,9 +45,9 @@ attributes(global) subroutine trans_x2z_k(u_z, u_x, nz)
4545
u_z(i, j, b_i + (b_j - 1)*nx) = u_x(i, b_i, j + (b_j - 1)*nz)
4646
end do
4747

48-
end subroutine trans_x2z_k
48+
end subroutine reorder_x2z
4949

50-
attributes(global) subroutine trans_y2x_k(u_x, u_y, nz)
50+
attributes(global) subroutine reorder_y2x(u_x, u_y, nz)
5151
implicit none
5252

5353
real(dp), device, intent(out), dimension(:, :, :) :: u_x
@@ -68,9 +68,9 @@ attributes(global) subroutine trans_y2x_k(u_x, u_y, nz)
6868
! copy into output array from shared
6969
u_x(i, (b_i - 1)*SZ + j, (b_j - 1)*nz + b_k) = tile(j, i)
7070

71-
end subroutine trans_y2x_k
71+
end subroutine reorder_y2x
7272

73-
attributes(global) subroutine trans_y2z_k(u_z, u_y, nx, nz)
73+
attributes(global) subroutine reorder_y2z(u_z, u_y, nx, nz)
7474
implicit none
7575

7676
real(dp), device, intent(out), dimension(:, :, :) :: u_z
@@ -91,9 +91,9 @@ attributes(global) subroutine trans_y2z_k(u_z, u_y, nx, nz)
9191
! copy into output array from shared
9292
u_z(i, b_k, (b_i - 1)*SZ + j + (b_j - 1)*nx) = tile(j, i)
9393

94-
end subroutine trans_y2z_k
94+
end subroutine reorder_y2z
9595

96-
attributes(global) subroutine trans_z2y_k(u_y, u_z, nx, nz)
96+
attributes(global) subroutine reorder_z2y(u_y, u_z, nx, nz)
9797
implicit none
9898

9999
real(dp), device, intent(out), dimension(:, :, :) :: u_y
@@ -114,6 +114,6 @@ attributes(global) subroutine trans_z2y_k(u_y, u_z, nx, nz)
114114
! copy into output array from shared
115115
u_y(i, (b_j - 1)*SZ + j, (b_i - 1)*nz + b_k) = tile(j, i)
116116

117-
end subroutine trans_z2y_k
117+
end subroutine reorder_z2y
118118

119-
end module m_cuda_kernels_trans
119+
end module m_cuda_kernels_reorder

src/omp/backend.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module m_omp_backend
2424
procedure :: transeq_y => transeq_y_omp
2525
procedure :: transeq_z => transeq_z_omp
2626
procedure :: tds_solve => tds_solve_omp
27-
procedure :: trans_d2d => trans_d2d_omp
27+
procedure :: reorder => reorder_omp
2828
procedure :: sum_yzintox => sum_yzintox_omp
2929
procedure :: vecadd => vecadd_omp
3030
procedure :: set_fields => set_fields_omp
@@ -160,15 +160,15 @@ subroutine tds_solve_omp(self, du, u, dirps, tdsops)
160160

161161
end subroutine tds_solve_omp
162162

163-
subroutine trans_d2d_omp(self, u_, u, direction)
163+
subroutine reorder_omp(self, u_, u, direction)
164164
implicit none
165165

166166
class(omp_backend_t) :: self
167167
class(field_t), intent(inout) :: u_
168168
class(field_t), intent(in) :: u
169169
integer, intent(in) :: direction
170170

171-
end subroutine trans_d2d_omp
171+
end subroutine reorder_omp
172172

173173
subroutine sum_yzintox_omp(self, du, dv, dw, &
174174
du_y, dv_y, dw_y, du_z, dv_z, dw_z)

src/solver.f90

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module m_solver
22
use m_allocator, only: allocator_t, field_t
33
use m_base_backend, only: base_backend_t
4-
use m_common, only: dp, globs_t, TRP_X2Y, TRP_X2Z, TRP_Y2X, TRP_Y2Z, TRP_Z2Y
4+
use m_common, only: dp, globs_t, RDR_X2Y, RDR_X2Z, RDR_Y2X, RDR_Y2Z, RDR_Z2Y
55
use m_tdsops, only: tdsops_t, dirps_t
66
use m_time_integrator, only: time_intg_t
77

@@ -185,9 +185,9 @@ subroutine transeq(self, du, dv, dw, u, v, w)
185185
dw_y => self%backend%allocator%get_block()
186186

187187
! reorder data from x orientation to y orientation
188-
call self%backend%trans_d2d(u_y, u, TRP_X2Y)
189-
call self%backend%trans_d2d(v_y, v, TRP_X2Y)
190-
call self%backend%trans_d2d(w_y, w, TRP_X2Y)
188+
call self%backend%reorder(u_y, u, RDR_X2Y)
189+
call self%backend%reorder(v_y, v, RDR_X2Y)
190+
call self%backend%reorder(w_y, w, RDR_X2Y)
191191

192192
! similar to the x direction, obtain derivatives in y.
193193
call self%backend%transeq_y(du_y, dv_y, dw_y, u_y, v_y, w_y, self%ydirps)
@@ -209,9 +209,9 @@ subroutine transeq(self, du, dv, dw, u, v, w)
209209
dw_z => self%backend%allocator%get_block()
210210

211211
! reorder from x to z
212-
call self%backend%trans_d2d(u_z, u, TRP_X2Z)
213-
call self%backend%trans_d2d(v_z, v, TRP_X2Z)
214-
call self%backend%trans_d2d(w_z, w, TRP_X2Z)
212+
call self%backend%reorder(u_z, u, RDR_X2Z)
213+
call self%backend%reorder(v_z, v, RDR_X2Z)
214+
call self%backend%reorder(w_z, w, RDR_X2Z)
215215

216216
! get the derivatives in z
217217
call self%backend%transeq_z(du_z, dv_z, dw_z, u_z, v_z, w_z, self%zdirps)
@@ -267,9 +267,9 @@ subroutine divergence(self, div_u, u, v, w)
267267
w_y => self%backend%allocator%get_block()
268268

269269
! reorder data from x orientation to y orientation
270-
call self%backend%trans_d2d(u_y, du_x, TRP_X2Y)
271-
call self%backend%trans_d2d(v_y, dv_x, TRP_X2Y)
272-
call self%backend%trans_d2d(w_y, dw_x, TRP_X2Y)
270+
call self%backend%reorder(u_y, du_x, RDR_X2Y)
271+
call self%backend%reorder(v_y, dv_x, RDR_X2Y)
272+
call self%backend%reorder(w_y, dw_x, RDR_X2Y)
273273

274274
call self%backend%allocator%release_block(du_x)
275275
call self%backend%allocator%release_block(dv_x)
@@ -303,8 +303,8 @@ subroutine divergence(self, div_u, u, v, w)
303303
call self%backend%vecadd(1._dp, dw_y, 1._dp, dv_y)
304304

305305
! reorder from y to z
306-
call self%backend%trans_d2d(u_z, du_y, TRP_Y2Z)
307-
call self%backend%trans_d2d(w_z, dw_y, TRP_Y2Z)
306+
call self%backend%reorder(u_z, du_y, RDR_Y2Z)
307+
call self%backend%reorder(w_z, dw_y, RDR_Y2Z)
308308

309309
! release all the unnecessary blocks.
310310
call self%backend%allocator%release_block(du_y)
@@ -358,8 +358,8 @@ subroutine gradient(self, dpdx, dpdy, dpdz, pressure)
358358
dpdz_sxy_y => self%backend%allocator%get_block()
359359

360360
! reorder data from z orientation to y orientation
361-
call self%backend%trans_d2d(p_sxy_y, p_sxy_z, TRP_Z2Y)
362-
call self%backend%trans_d2d(dpdz_sxy_y, dpdz_sxy_z, TRP_Z2Y)
361+
call self%backend%reorder(p_sxy_y, p_sxy_z, RDR_Z2Y)
362+
call self%backend%reorder(dpdz_sxy_y, dpdz_sxy_z, RDR_Z2Y)
363363

364364
call self%backend%allocator%release_block(p_sxy_z)
365365
call self%backend%allocator%release_block(dpdz_sxy_z)
@@ -386,9 +386,9 @@ subroutine gradient(self, dpdx, dpdy, dpdz, pressure)
386386
dpdz_sx_x => self%backend%allocator%get_block()
387387

388388
! reorder from y to x
389-
call self%backend%trans_d2d(p_sx_x, p_sx_y, TRP_Y2X)
390-
call self%backend%trans_d2d(dpdy_sx_x, dpdy_sx_y, TRP_Y2X)
391-
call self%backend%trans_d2d(dpdz_sx_x, dpdz_sx_y, TRP_Y2X)
389+
call self%backend%reorder(p_sx_x, p_sx_y, RDR_Y2X)
390+
call self%backend%reorder(dpdy_sx_x, dpdy_sx_y, RDR_Y2X)
391+
call self%backend%reorder(dpdz_sx_x, dpdz_sx_y, RDR_Y2X)
392392

393393
! release all the y directional fields.
394394
call self%backend%allocator%release_block(p_sx_y)

0 commit comments

Comments
 (0)