36 use,
intrinsic :: iso_c_binding
73 bind(c, name =
'cudaMalloc')
74 use,
intrinsic :: iso_c_binding
77 integer(c_size_t),
value :: s
83 bind(c, name =
'cudaFree')
84 use,
intrinsic :: iso_c_binding
86 type(c_ptr),
value :: ptr_d
91 integer(c_int) function cudamemcpy(ptr_dst, ptr_src, s, dir) &
92 bind(c, name =
'cudaMemcpy')
93 use,
intrinsic :: iso_c_binding
95 type(c_ptr),
value :: ptr_dst, ptr_src
96 integer(c_size_t),
value :: s
97 integer(c_int),
value :: dir
103 bind(c, name =
'cudaMemcpyAsync')
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
114 bind(c, name =
'cudaDeviceSynchronize')
115 use,
intrinsic :: iso_c_binding
122 bind(c, name =
'cudaGetDeviceProperties')
123 use,
intrinsic :: iso_c_binding
125 type(c_ptr),
value :: prop
126 integer(c_int),
value ::
device
132 bind(c, name =
'cudaStreamCreate')
133 use,
intrinsic :: iso_c_binding
135 type(c_ptr) :: stream
141 bind(c, name =
'cudaStreamCreateWithFlags')
142 use,
intrinsic :: iso_c_binding
144 type(c_ptr) :: stream
145 integer(c_int),
value :: flags
151 bind(c, name =
'cudaStreamCreateWithPriority')
152 use,
intrinsic :: iso_c_binding
154 type(c_ptr) :: stream
155 integer(c_int),
value :: flags, prio
161 bind(c, name =
'cudaStreamDestroy')
162 use,
intrinsic :: iso_c_binding
164 type(c_ptr),
value :: steam
170 bind(c, name =
'cudaStreamSynchronize')
171 use,
intrinsic :: iso_c_binding
173 type(c_ptr),
value :: stream
179 bind(c, name =
'cudaStreamWaitEvent')
180 use,
intrinsic :: iso_c_binding
182 type(c_ptr),
value :: stream, event
183 integer(c_int),
value :: flags
189 (low_prio, high_prio) &
190 bind(c, name =
'cudaDeviceGetStreamPriorityRange')
191 use,
intrinsic :: iso_c_binding
193 integer(c_int) :: low_prio, high_prio
199 bind(c, name =
'cudaProfilerStart')
200 use,
intrinsic :: iso_c_binding
207 bind(c, name =
'cudaProfilerStop')
208 use,
intrinsic :: iso_c_binding
215 bind(c, name =
'cudaEventCreate')
216 use,
intrinsic :: iso_c_binding
224 bind(c, name =
'cudaEventDestroy')
225 use,
intrinsic :: iso_c_binding
227 type(c_ptr),
value :: event
233 bind(c, name =
'cudaEventCreateWithFlags')
234 use,
intrinsic :: iso_c_binding
237 integer(c_int),
value :: flags
243 bind(c, name =
'cudaEventRecord')
244 use,
intrinsic :: iso_c_binding
246 type(c_ptr),
value :: event, stream
252 bind(c, name =
'cudaEventSynchronize')
253 use,
intrinsic :: iso_c_binding
255 type(c_ptr),
value :: event
261 bind(c, name =
'cudaGetDeviceCount')
262 use,
intrinsic :: iso_c_binding
264 integer(c_int) :: device_count
270 bind(c, name =
'cudaGetDevice')
271 use,
intrinsic :: iso_c_binding
279 bind(c, name =
'cudaSetDevice')
280 use,
intrinsic :: iso_c_binding
282 integer(c_int),
value ::
device
289 integer(c_int) :: device_id
290 integer :: nthrds = 1
299 if (nthrds .gt. 1)
then
313 call neko_error(
'Error retrieving stream priority range')
329 call neko_error(
'Error destroying main stream')
333 call neko_error(
'Error destroying aux stream')
338 character(len=*),
intent(inout) :: name
339 character(kind=c_char, len=8192),
target :: prop
355 end_pos = scan(prop(1:256), c_null_char)
356 if (end_pos .ge. 2)
then
357 name(1:end_pos-1) = prop(1:end_pos-1)
363 integer(c_int) :: num_devices
366 call neko_error(
'Error retrieving device count')
subroutine cuda_device_name(name)
type(c_ptr), bind(C) aux_cmd_queue
Aux HIP command queue.
@ cudamemcpydevicetodevice
integer function cuda_device_count()
Return the number of avaialble CUDA devices.
@ cudaerrorinitializationerror
@ cudaerrormemoryallocation
type(c_ptr), bind(C) glb_cmd_queue
Global HIP command queue.
integer strm_low_prio
Low priority stream setting.
integer strm_high_prio
High priority stream setting.
Device abstraction, common interface for various accelerators.