-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcufKernel.cuf
33 lines (25 loc) · 1.05 KB
/
cufKernel.cuf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
program incrementTest
implicit none
integer, parameter :: n = 1024*1024
integer :: a(n), i, b
integer, device :: a_d(n)
integer, parameter :: tPB = 256
a = 1
b = 3
a_d = a
! A thread block of tPB threads is used when launching the kernel. The * specified for the first execution configuration
! parameter leaves the compiler free to calculate the number of thread blocks to launch in order to carry out the
! operation in the loop. The execution configuration could have been specified as <<<*,*>>>, in which case the
! compiler would choose the thread block size as well as the number of thread blocks to launch.
!------------------------------------------------------------------------------------------------------------------------
!$cuf kernel do <<<*,tPB>>>
do i = 1, n
a_d(i) = a_d(i) + b
enddo
a = a_d
if (any(a /= 4)) then
write(*,*) '**** Program Failed ****'
else
write(*,*) 'Program Passed'
endif
end program incrementTest