-
Notifications
You must be signed in to change notification settings - Fork 0
/
CudaRandF.f90
55 lines (42 loc) · 1.36 KB
/
CudaRandF.f90
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module CudaRandF
use, intrinsic :: iso_c_binding
use cudafor
implicit none
private
type CudaRand_generator
private
type(C_ptr) :: object = c_null_ptr
end type CudaRand_generator
interface
function C_CudaRand__setRandom(buff,seed) result(this) bind(C,name="CudaRand__setRandom")
import
type(C_ptr),value :: this
integer(C_int),value :: buff,seed
end function C_CudaRand__setRandom
function C_CudaRand__getRandom(pCR,n) result(this) bind(C,name="CudaRand__getRandom")
import
type(C_ptr),value :: pCR
type(C_devptr) :: this
integer, value :: n
end function C_CudaRand__getRandom
end interface
interface setRandom
module procedure CudaRand__setRandom
end interface setRandom
interface getRandom
module procedure CudaRand__getRandom
end interface getRandom
public :: CudaRand_generator, setRandom, getRandom
contains
subroutine CudaRand__setRandom(this,buff,seed)
type(CudaRand_generator) :: this
integer :: buff,seed
this%object = C_CudaRand__setRandom(buff,seed)
end subroutine CudaRand__setRandom
subroutine CudaRand__getRandom(x,this,n)
type(CudaRand_generator) :: this
type(C_devptr) :: x
integer :: n
x = C_CudaRand__getRandom(this%object,n)
end subroutine CudaRand__getRandom
end module CudaRandF