36 use,
intrinsic :: iso_c_binding
79 bind(c, name =
'hipMalloc')
80 use,
intrinsic :: iso_c_binding
83 integer(c_size_t),
value :: s
87 bind(c, name =
'hipFree')
88 use,
intrinsic :: iso_c_binding
90 type(c_ptr),
value :: ptr_d
93 integer(c_int) function hipmemcpy(ptr_dst, ptr_src, s, dir) &
94 bind(c, name =
'hipMemcpy')
95 use,
intrinsic :: iso_c_binding
97 type(c_ptr),
value :: ptr_dst, ptr_src
98 integer(c_size_t),
value :: s
99 integer(c_int),
value :: dir
103 bind(c, name =
'hipMemcpyAsync')
104 use,
intrinsic :: iso_c_binding
106 type(c_ptr),
value :: ptr_dst, ptr_src, stream
107 integer(c_size_t),
value :: s
108 integer(c_int),
value :: dir
112 bind(c, name =
'hipMemsetAsync')
113 use,
intrinsic :: iso_c_binding
115 type(c_ptr),
value :: ptr, stream
116 integer(c_int),
value :: v
117 integer(c_size_t),
value :: s
121 bind(c, name =
'hipDeviceSynchronize')
122 use,
intrinsic :: iso_c_binding
127 bind(c, name =
'hipDeviceReset')
128 use,
intrinsic :: iso_c_binding
133 bind(c, name =
'hip_buffer_free_all')
137 bind(c, name =
'hipDeviceGetName')
138 use,
intrinsic :: iso_c_binding
140 type(c_ptr),
value :: name
141 integer(c_int),
value :: len
142 integer(c_int),
value ::
device
146 bind(c, name =
'hipGetDeviceCount')
147 use,
intrinsic :: iso_c_binding
149 integer(c_int) :: amount
153 bind(c, name =
'hipStreamCreate')
154 use,
intrinsic :: iso_c_binding
156 type(c_ptr) :: stream
160 bind(c, name =
'hipStreamCreateWithFlags')
161 use,
intrinsic :: iso_c_binding
163 type(c_ptr) :: stream
164 integer(c_int),
value :: flags
168 bind(c, name =
'hipStreamCreateWithPriority')
169 use,
intrinsic :: iso_c_binding
171 type(c_ptr) :: stream
172 integer(c_int),
value :: flags, prio
176 bind(c, name =
'hipStreamDestroy')
177 use,
intrinsic :: iso_c_binding
179 type(c_ptr),
value :: steam
183 bind(c, name =
'hipStreamSynchronize')
184 use,
intrinsic :: iso_c_binding
186 type(c_ptr),
value :: stream
190 bind(c, name =
'hipStreamWaitEvent')
191 use,
intrinsic :: iso_c_binding
193 type(c_ptr),
value :: stream, event
194 integer(c_int),
value :: flags
199 bind(c, name =
'hipDeviceGetStreamPriorityRange')
200 use,
intrinsic :: iso_c_binding
202 integer(c_int) :: low_prio, high_prio
206 bind(c, name =
'hipEventCreate')
207 use,
intrinsic :: iso_c_binding
213 bind(c, name =
'hipEventDestroy')
214 use,
intrinsic :: iso_c_binding
216 type(c_ptr),
value :: event
220 bind(c, name =
'hipEventCreateWithFlags')
221 use,
intrinsic :: iso_c_binding
224 integer(c_int),
value :: flags
228 bind(c, name =
'hipEventRecord')
229 use,
intrinsic :: iso_c_binding
231 type(c_ptr),
value :: event, stream
235 bind(c, name =
'hipEventSynchronize')
236 use,
intrinsic :: iso_c_binding
238 type(c_ptr),
value :: event
244 subroutine hip_init(glb_cmd_queue, aux_cmd_queue, &
245 STRM_HIGH_PRIO, STRM_LOW_PRIO)
246 type(c_ptr),
intent(inout) :: glb_cmd_queue
247 type(c_ptr),
intent(inout) :: aux_cmd_queue
248 integer,
intent(inout) :: STRM_HIGH_PRIO
249 integer,
intent(inout) :: STRM_LOW_PRIO
253 call neko_error(
'Error retrieving stream priority range')
268 type(c_ptr),
intent(inout) :: glb_cmd_queue
269 type(c_ptr),
intent(inout) :: aux_cmd_queue
276 call neko_error(
'Error destroying main stream')
280 call neko_error(
'Error destroying aux stream')
297 character(len=*),
intent(inout) :: name
298 character(kind=c_char, len=1024),
target :: c_name
305 end_pos = scan(c_name, c_null_char)
306 if (end_pos .ge. 2)
then
307 name(1:end_pos-1) = c_name(1:end_pos-1)
314 type(c_ptr) :: hip_count_ptr
318 call neko_error(
'Failed to query device count')
Device abstraction, common interface for various accelerators.
subroutine hip_device_name(name)
@ hipmemcpydevicetodevice
subroutine hip_init(glb_cmd_queue, aux_cmd_queue, strm_high_prio, strm_low_prio)
subroutine hip_finalize(glb_cmd_queue, aux_cmd_queue)
@ hiperrormapbufferobjectfailed
@ hiperrorinvaliddevicepointer
@ hiperrorpeeraccessnotenabled
@ hiperrorinvalidkernelfile
@ hiperrorpeeraccessalreadyenabled
@ hiperrorinvalidresourcehandle
@ hiperrorhostmemorynotregistered
@ hiperrormemoryallocation
@ hiperrorlaunchoutofresources
@ hiperrorinvalidmemcpydirection
@ hiperrorinitializationerror
@ hiperrorhostmemoryalreadyregistered
integer function hip_device_count()
Return the number of available HIP devices.