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
93 integer(c_int) function hipmemcpy(ptr_dst, ptr_src, s, 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 =
'hipDeviceSynchronize')
113 use,
intrinsic :: iso_c_binding
118 bind(c, name =
'hipDeviceGetName')
119 use,
intrinsic :: iso_c_binding
121 type(c_ptr),
value :: name
122 integer(c_int),
value :: len
123 integer(c_int),
value ::
device
127 bind(c, name =
'hipGetDeviceCount')
128 use,
intrinsic :: iso_c_binding
130 integer(c_int) :: amount
134 bind(c, name =
'hipStreamCreate')
135 use,
intrinsic :: iso_c_binding
137 type(c_ptr) :: stream
141 bind(c, name =
'hipStreamCreateWithFlags')
142 use,
intrinsic :: iso_c_binding
144 type(c_ptr) :: stream
145 integer(c_int),
value :: flags
149 bind(c, name =
'hipStreamCreateWithPriority')
150 use,
intrinsic :: iso_c_binding
152 type(c_ptr) :: stream
153 integer(c_int),
value :: flags, prio
157 bind(c, name =
'hipStreamDestroy')
158 use,
intrinsic :: iso_c_binding
160 type(c_ptr),
value :: steam
164 bind(c, name =
'hipStreamSynchronize')
165 use,
intrinsic :: iso_c_binding
167 type(c_ptr),
value :: stream
171 bind(c, name =
'hipStreamWaitEvent')
172 use,
intrinsic :: iso_c_binding
174 type(c_ptr),
value :: stream, event
175 integer(c_int),
value :: flags
180 bind(c, name =
'hipDeviceGetStreamPriorityRange')
181 use,
intrinsic :: iso_c_binding
183 integer(c_int) :: low_prio, high_prio
187 bind(c, name =
'hipEventCreate')
188 use,
intrinsic :: iso_c_binding
194 bind(c, name =
'hipEventDestroy')
195 use,
intrinsic :: iso_c_binding
197 type(c_ptr),
value :: event
201 bind(c, name =
'hipEventCreateWithFlags')
202 use,
intrinsic :: iso_c_binding
205 integer(c_int),
value :: flags
209 bind(c, name =
'hipEventRecord')
210 use,
intrinsic :: iso_c_binding
212 type(c_ptr),
value :: event, stream
216 bind(c, name =
'hipEventSynchronize')
217 use,
intrinsic :: iso_c_binding
219 type(c_ptr),
value :: event
225 subroutine hip_init(glb_cmd_queue, aux_cmd_queue, &
226 STRM_HIGH_PRIO, STRM_LOW_PRIO)
227 type(c_ptr),
intent(inout) :: glb_cmd_queue
228 type(c_ptr),
intent(inout) :: aux_cmd_queue
229 integer,
intent(inout) :: STRM_HIGH_PRIO
230 integer,
intent(inout) :: STRM_LOW_PRIO
234 call neko_error(
'Error retrieving stream priority range')
249 type(c_ptr),
intent(inout) :: glb_cmd_queue
250 type(c_ptr),
intent(inout) :: aux_cmd_queue
253 call neko_error(
'Error destroying main stream')
257 call neko_error(
'Error destroying aux stream')
262 character(len=*),
intent(inout) :: name
263 character(kind=c_char, len=1024),
target :: c_name
270 end_pos = scan(c_name, c_null_char)
271 if (end_pos .ge. 2)
then
272 name(1:end_pos-1) = c_name(1:end_pos-1)
279 type(c_ptr) :: hip_count_ptr
283 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.