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 =
'hipDeviceGetName')
128 use,
intrinsic :: iso_c_binding
130 type(c_ptr),
value :: name
131 integer(c_int),
value :: len
132 integer(c_int),
value ::
device
136 bind(c, name =
'hipGetDeviceCount')
137 use,
intrinsic :: iso_c_binding
139 integer(c_int) :: amount
143 bind(c, name =
'hipStreamCreate')
144 use,
intrinsic :: iso_c_binding
146 type(c_ptr) :: stream
150 bind(c, name =
'hipStreamCreateWithFlags')
151 use,
intrinsic :: iso_c_binding
153 type(c_ptr) :: stream
154 integer(c_int),
value :: flags
158 bind(c, name =
'hipStreamCreateWithPriority')
159 use,
intrinsic :: iso_c_binding
161 type(c_ptr) :: stream
162 integer(c_int),
value :: flags, prio
166 bind(c, name =
'hipStreamDestroy')
167 use,
intrinsic :: iso_c_binding
169 type(c_ptr),
value :: steam
173 bind(c, name =
'hipStreamSynchronize')
174 use,
intrinsic :: iso_c_binding
176 type(c_ptr),
value :: stream
180 bind(c, name =
'hipStreamWaitEvent')
181 use,
intrinsic :: iso_c_binding
183 type(c_ptr),
value :: stream, event
184 integer(c_int),
value :: flags
189 bind(c, name =
'hipDeviceGetStreamPriorityRange')
190 use,
intrinsic :: iso_c_binding
192 integer(c_int) :: low_prio, high_prio
196 bind(c, name =
'hipEventCreate')
197 use,
intrinsic :: iso_c_binding
203 bind(c, name =
'hipEventDestroy')
204 use,
intrinsic :: iso_c_binding
206 type(c_ptr),
value :: event
210 bind(c, name =
'hipEventCreateWithFlags')
211 use,
intrinsic :: iso_c_binding
214 integer(c_int),
value :: flags
218 bind(c, name =
'hipEventRecord')
219 use,
intrinsic :: iso_c_binding
221 type(c_ptr),
value :: event, stream
225 bind(c, name =
'hipEventSynchronize')
226 use,
intrinsic :: iso_c_binding
228 type(c_ptr),
value :: event
234 subroutine hip_init(glb_cmd_queue, aux_cmd_queue, &
235 STRM_HIGH_PRIO, STRM_LOW_PRIO)
236 type(c_ptr),
intent(inout) :: glb_cmd_queue
237 type(c_ptr),
intent(inout) :: aux_cmd_queue
238 integer,
intent(inout) :: STRM_HIGH_PRIO
239 integer,
intent(inout) :: STRM_LOW_PRIO
243 call neko_error(
'Error retrieving stream priority range')
258 type(c_ptr),
intent(inout) :: glb_cmd_queue
259 type(c_ptr),
intent(inout) :: aux_cmd_queue
262 call neko_error(
'Error destroying main stream')
266 call neko_error(
'Error destroying aux stream')
271 character(len=*),
intent(inout) :: name
272 character(kind=c_char, len=1024),
target :: c_name
279 end_pos = scan(c_name, c_null_char)
280 if (end_pos .ge. 2)
then
281 name(1:end_pos-1) = c_name(1:end_pos-1)
288 type(c_ptr) :: hip_count_ptr
292 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.