@@ -147,52 +147,7 @@ contains
147147 odata(x,y+j) = tile(threadIdx%y+j, threadIdx%x)
148148 end do
149149 end subroutine transposeNoBankConflicts
150-
151- ! Diagonal reordering
152- !
153- ! This version should be used on cards of compute capability 1.3
154- ! to avoid partition camping. It essentially reschedules the
155- ! order in which blocks are executed so requests for global
156- ! memory access by active blocks are spread evenly amongst
157- ! partitions
158-
159- attributes(global) subroutine transposeDiagonal(odata, idata)
160- implicit none
161- real, intent(out) :: odata(ny,nx)
162- real, intent(in) :: idata(nx,ny)
163- real, shared :: tile(TILE_DIM+1, TILE_DIM)
164- integer :: x, y, j
165- integer :: blockIdx_x, blockIdx_y
166-
167- if (nx==ny) then
168- blockIdx_y = blockIdx%x
169- blockIdx_x = mod(blockIdx%x+blockIdx%y-2,gridDim%x)+1
170- else
171- x = blockIdx%x + gridDim%x*(blockIdx%y-1)
172- blockIdx_y = mod(x-1,gridDim%y)+1
173- blockIdx_x = mod((x-1)/gridDim%y+blockIdx_y-1,gridDim%x)+1
174- endif
175-
176- x = (blockIdx_x-1) * TILE_DIM + threadIdx%x
177- y = (blockIdx_y-1) * TILE_DIM + threadIdx%y
178-
179- do j = 0, TILE_DIM-1, BLOCK_ROWS
180- tile(threadIdx%x, threadIdx%y+j) = idata(x,y+j)
181- end do
182-
183- call syncthreads()
184-
185- x = (blockIdx_y-1) * TILE_DIM + threadIdx%x
186- y = (blockIdx_x-1) * TILE_DIM + threadIdx%y
187-
188- do j = 0, TILE_DIM-1, BLOCK_ROWS
189- odata(x,y+j) = tile(threadIdx%y+j, threadIdx%x)
190- end do
191- end subroutine transposeDiagonal
192-
193- end module kernels_m
194-
195-
150+ end module
196151
197152program transposes
198153 use cudafor
@@ -344,24 +299,6 @@ program transposes
344299 h_tdata = d_tdata
345300 call postprocess(gold, h_tdata, time)
346301
347- ! ----------------
348- ! transposeDigonal
349- ! ----------------
350-
351- write(*,'(a25)', advance='NO') 'diagonal transpose'
352- d_tdata = -1.0
353- ! warmup
354- call transposeDiagonal<<<dimGrid, dimBlock>>>(d_tdata, d_idata)
355- istat = cudaEventRecord(startEvent, 0)
356- do i=1, NUM_REPS
357- call transposeDiagonal<<<dimGrid, dimBlock>>>(d_tdata, d_idata)
358- end do
359- istat = cudaEventRecord(stopEvent, 0)
360- istat = cudaEventSynchronize(stopEvent)
361- istat = cudaEventElapsedTime(time, startEvent, stopEvent)
362- h_tdata = d_tdata
363- call postprocess(gold, h_tdata, time)
364-
365302 ! cleanup
366303 istat = cudaEventDestroy(startEvent)
367304 istat = cudaEventDestroy(stopEvent)
0 commit comments