-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrocrand_m.f90
230 lines (208 loc) · 9.67 KB
/
rocrand_m.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
!! Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
!!
!! Permission is hereby granted, free of charge, to any person obtaining a copy
!! of this software and associated documentation files (the "Software"), to deal
!! in the Software without restriction, including without limitation the rights
!! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
!! copies of the Software, and to permit persons to whom the Software is
!! furnished to do so, subject to the following conditions:
!!
!! The above copyright notice and this permission notice shall be included in
!! all copies or substantial portions of the Software.
!!
!! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
!! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
!! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
!! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
!! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
!! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
!! THE SOFTWARE.
module rocrand_m
use hipfor
integer, public :: ROCRAND_RNG_PSEUDO_DEFAULT = 400
integer, public :: ROCRAND_RNG_PSEUDO_XORWOW = 401
integer, public :: ROCRAND_RNG_PSEUDO_MRG32K3A = 402
integer, public :: ROCRAND_RNG_PSEUDO_MTGP32 = 403
integer, public :: ROCRAND_RNG_PSEUDO_PHILOX4_32_10 = 404
integer, public :: ROCRAND_RNG_QUASI_DEFAULT = 500
integer, public :: ROCRAND_RNG_QUASI_SOBOL32 = 501
integer, public :: ROCRAND_STATUS_SUCCESS = 0
integer, public :: ROCRAND_STATUS_VERSION_MISMATCH = 100
integer, public :: ROCRAND_STATUS_NOT_CREATED = 101
integer, public :: ROCRAND_STATUS_ALLOCATION_FAILED = 102
integer, public :: ROCRAND_STATUS_TYPE_ERROR = 103
integer, public :: ROCRAND_STATUS_OUT_OF_RANGE = 104
integer, public :: ROCRAND_STATUS_LENGTH_NOT_MULTIPLE = 105
integer, public :: ROCRAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106
integer, public :: ROCRAND_STATUS_LAUNCH_FAILURE = 107
integer, public :: ROCRAND_STATUS_INTERNAL_ERROR = 108
interface
function rocrand_create_generator(generator, rng_type) &
bind(C, name="rocrand_create_generator")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_create_generator
integer(c_size_t) :: generator
integer(c_int), value :: rng_type
end function
function rocrand_destroy_generator(generator) &
bind(C, name="rocrand_destroy_generator")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_destroy_generator
integer(c_size_t), value :: generator
end function
function rocrand_generate(generator, output_data, n) &
bind(C, name="rocrand_generate")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
end function
function rocrand_generate_uniform(generator, output_data, n) &
bind(C, name="rocrand_generate_uniform")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_uniform
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
end function
function rocrand_generate_uniform_double(generator, output_data, n) &
bind(C, name="rocrand_generate_uniform_double")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_uniform_double
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
end function
function rocrand_generate_normal(generator, output_data, n, mean, &
stddev) bind(C, name="rocrand_generate_normal")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_normal
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
real(c_float), value :: mean
real(c_float), value :: stddev
end function
function rocrand_generate_normal_double(generator, output_data, n, &
mean, stddev) bind(C, name="rocrand_generate_normal_double")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_normal_double
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
real(c_double), value :: mean
real(c_double), value :: stddev
end function
function rocrand_generate_log_normal(generator, output_data, n, mean, &
stddev) bind(C, name="rocrand_generate_log_normal")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_log_normal
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
real(c_float), value :: mean
real(c_float), value :: stddev
end function
function rocrand_generate_log_normal_double(generator, output_data, n, &
mean, stddev) bind(C, name="rocrand_generate_log_normal_double")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_log_normal_double
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
real(c_double), value :: mean
real(c_double), value :: stddev
end function
function rocrand_generate_poisson(generator, output_data, n, lambda) &
bind(C, name="rocrand_generate_poisson")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_generate_poisson
integer(c_size_t), value :: generator
type(c_ptr), value :: output_data
integer(c_size_t), value :: n
real(c_double), value :: lambda
end function
function rocrand_initialize_generator(generator) &
bind(C, name="rocrand_initialize_generator")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_initialize_generator
integer(c_size_t), value :: generator
end function
function rocrand_set_stream(generator, stream) &
bind(C, name="rocrand_set_stream")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_set_stream
integer(c_size_t), value :: generator
integer(c_size_t), value :: stream
end function
function rocrand_set_seed(generator, seed) &
bind(C, name="rocrand_set_seed")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_set_seed
integer(c_size_t), value :: generator
integer(kind =8), value :: seed
end function
function rocrand_set_offset(generator, offset) &
bind(C, name="rocrand_set_offset")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_set_offset
integer(c_size_t), value :: generator
integer(kind =8), value :: offset
end function
function rocrand_set_quasi_random_generator_dimensions(generator, &
dimensions) bind(C, name="rocrand_set_quasi_random_generator_dimensions")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_set_quasi_random_generator_dimensions
integer(c_size_t), value :: generator
integer(c_int), value :: dimensions
end function
function rocrand_get_version(version) &
bind(C, name="rocrand_get_version")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_get_version
integer(c_int) :: version
end function
function rocrand_create_poisson_distribution(lambda, &
discrete_distribution) bind(C, name="rocrand_create_poisson_distribution")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_create_poisson_distribution
real(c_double), value :: lambda
integer(c_size_t) :: discrete_distribution
end function
function rocrand_create_discrete_distribution(probabilities, size, offset, &
discrete_distribution) bind(C, name="rocrand_create_discrete_distribution")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_create_discrete_distribution
real(c_double), intent(in) :: probabilities
integer(c_int), value :: size
integer(c_int), value :: offset
integer(c_size_t), value :: discrete_distribution
end function
function rocrand_destroy_discrete_distribution(discrete_distribution) &
bind(C, name="rocrand_destroy_discrete_distribution")
use iso_c_binding
implicit none
integer(c_int) :: rocrand_destroy_discrete_distribution
integer(c_size_t), value :: discrete_distribution
end function
end interface
end module rocrand_m