36 use,
intrinsic :: iso_c_binding
42 type(c_ptr),
bind(c) :: glb_cmd_queue = c_null_ptr
91 bind(c, name =
'hipMalloc')
92 use,
intrinsic :: iso_c_binding
95 integer(c_size_t),
value :: s
99 bind(c, name =
'hipFree')
100 use,
intrinsic :: iso_c_binding
102 type(c_ptr),
value :: ptr_d
105 integer(c_int) function hipmemcpy(ptr_dst, ptr_src, s, dir) &
106 bind(c, name =
'hipMemcpy')
107 use,
intrinsic :: iso_c_binding
109 type(c_ptr),
value :: ptr_dst, ptr_src
110 integer(c_size_t),
value :: s
111 integer(c_int),
value :: dir
115 bind(c, name =
'hipMemcpyAsync')
116 use,
intrinsic :: iso_c_binding
118 type(c_ptr),
value :: ptr_dst, ptr_src, stream
119 integer(c_size_t),
value :: s
120 integer(c_int),
value :: dir
124 bind(c, name =
'hipDeviceSynchronize')
125 use,
intrinsic :: iso_c_binding
130 bind(c, name =
'hipDeviceGetName')
131 use,
intrinsic :: iso_c_binding
133 type(c_ptr),
value :: name
134 integer(c_int),
value :: len
135 integer(c_int),
value ::
device
139 bind(c, name =
'hipGetDeviceCount')
140 use,
intrinsic :: iso_c_binding
142 integer(c_int) :: amount
146 bind(c, name =
'hipStreamCreate')
147 use,
intrinsic :: iso_c_binding
149 type(c_ptr) :: stream
153 bind(c, name =
'hipStreamCreateWithFlags')
154 use,
intrinsic :: iso_c_binding
156 type(c_ptr) :: stream
157 integer(c_int),
value :: flags
161 bind(c, name =
'hipStreamCreateWithPriority')
162 use,
intrinsic :: iso_c_binding
164 type(c_ptr) :: stream
165 integer(c_int),
value :: flags, prio
169 bind(c, name =
'hipStreamDestroy')
170 use,
intrinsic :: iso_c_binding
172 type(c_ptr),
value :: steam
176 bind(c, name =
'hipStreamSynchronize')
177 use,
intrinsic :: iso_c_binding
179 type(c_ptr),
value :: stream
183 bind(c, name =
'hipStreamWaitEvent')
184 use,
intrinsic :: iso_c_binding
186 type(c_ptr),
value :: stream, event
187 integer(c_int),
value :: flags
192 bind(c, name =
'hipDeviceGetStreamPriorityRange')
193 use,
intrinsic :: iso_c_binding
195 integer(c_int) :: low_prio, high_prio
199 bind(c, name =
'hipEventCreate')
200 use,
intrinsic :: iso_c_binding
206 bind(c, name =
'hipEventDestroy')
207 use,
intrinsic :: iso_c_binding
209 type(c_ptr),
value :: event
213 bind(c, name =
'hipEventCreateWithFlags')
214 use,
intrinsic :: iso_c_binding
217 integer(c_int),
value :: flags
221 bind(c, name =
'hipEventRecord')
222 use,
intrinsic :: iso_c_binding
224 type(c_ptr),
value :: event, stream
228 bind(c, name =
'hipEventSynchronize')
229 use,
intrinsic :: iso_c_binding
231 type(c_ptr),
value :: event
241 call neko_error(
'Error retrieving stream priority range')
257 call neko_error(
'Error destroying main stream')
261 call neko_error(
'Error destroying aux stream')
266 character(len=*),
intent(inout) :: name
267 character(kind=c_char, len=1024),
target :: c_name
274 end_pos = scan(c_name, c_null_char)
275 if (end_pos .ge. 2)
then
276 name(1:end_pos-1) = c_name(1:end_pos-1)
283 type(c_ptr) :: hip_count_ptr
287 call neko_error(
'Failed to query device count')
Device abstraction, common interface for various accelerators.
type(c_ptr), bind(C) aux_cmd_queue
Aux HIP command queue.
integer strm_low_prio
Low priority stream setting.
subroutine hip_device_name(name)
@ hipmemcpydevicetodevice
integer strm_high_prio
High priority stream setting.
@ hiperrormapbufferobjectfailed
@ hiperrorinvaliddevicepointer
@ hiperrorpeeraccessnotenabled
@ hiperrorinvalidkernelfile
@ hiperrorpeeraccessalreadyenabled
@ hiperrorinvalidresourcehandle
@ hiperrorhostmemorynotregistered
@ hiperrormemoryallocation
@ hiperrorlaunchoutofresources
@ hiperrorinvalidmemcpydirection
@ hiperrorinitializationerror
@ hiperrorhostmemoryalreadyregistered
integer function hip_device_count()
Return the number of available HIP devices.