44 use,
intrinsic :: iso_c_binding
138#if defined(HAVE_HIP) || defined(HAVE_CUDA) || \
139 defined(have_opencl) || defined(have_metal)
157 call neko_error(
'Only one device is supported per MPI rank')
163#if defined(HAVE_HIP) || defined(HAVE_CUDA) || \
164 defined(have_opencl) || defined(have_metal)
182 character(len=*),
intent(inout) :: name
191 call metal_device_name(name)
212 type(c_ptr),
intent(inout) :: x_d
213 integer(c_size_t) :: s
223 call neko_error(
'Memory allocation on device failed')
227 call neko_error(
'Memory allocation on device failed')
232 call neko_error(
'Memory allocation on device failed')
235 if (metalalloc(x_d, s) .ne. metalsuccess)
then
236 call neko_error(
'Memory allocation on device failed')
243 type(c_ptr),
intent(inout) :: x_d
248 call neko_error(
'Memory deallocation on device failed')
252 call neko_error(
'Memory deallocation on device failed')
256 call neko_error(
'Memory deallocation on device failed')
259 if (metalfree(x_d) .ne. metalsuccess)
then
260 call neko_error(
'Memory deallocation on device failed')
268 type(c_ptr),
intent(inout) :: x_d
269 integer(c_int),
target,
value :: v
270 integer(c_size_t),
intent(in) :: s
271 logical,
optional :: sync
272 type(c_ptr),
optional :: strm
273 type(c_ptr) :: stream
274 logical :: sync_device
276 if (
present(sync))
then
279 sync_device = .false.
282 if (
present(strm))
then
300 s, 0, c_null_ptr, c_null_ptr) .ne.
cl_success)
then
304 if (metalmemset(x_d, v, s) .ne. metalsuccess)
then
309 if (sync_device)
then
317 integer,
intent(in) :: n
318 class(*),
intent(inout),
target :: x(:)
319 type(c_ptr),
intent(inout) :: x_d
320 integer,
intent(in),
value :: dir
322 type(c_ptr),
optional :: strm
323 type(c_ptr) :: ptr_h, copy_stream
324 integer(c_size_t) :: s
326 if (
present(strm))
then
334 s = n * int(4, c_size_t)
336 type is (
integer(i8))
337 s = n * int(8, c_size_t)
340 s = n * int(4, c_size_t)
342 type is (double precision)
343 s = n * int(8, c_size_t)
355 integer,
intent(in) :: n
356 class(*),
intent(inout),
target :: x(:,:)
357 type(c_ptr),
intent(inout) :: x_d
358 integer,
intent(in),
value :: dir
360 type(c_ptr),
optional :: strm
361 type(c_ptr) :: ptr_h, copy_stream
362 integer(c_size_t) :: s
364 if (
present(strm))
then
372 s = n * int(4, c_size_t)
374 type is (
integer(i8))
375 s = n * int(8, c_size_t)
378 s = n * int(4, c_size_t)
380 type is (double precision)
381 s = n * int(8, c_size_t)
393 integer,
intent(in) :: n
394 class(*),
intent(inout),
target :: x(:,:,:)
395 type(c_ptr),
intent(inout) :: x_d
396 integer,
intent(in),
value :: dir
398 type(c_ptr),
optional :: strm
399 type(c_ptr) :: ptr_h, copy_stream
400 integer(c_size_t) :: s
402 if (
present(strm))
then
410 s = n * int(4, c_size_t)
412 type is (
integer(i8))
413 s = n * int(8, c_size_t)
416 s = n * int(4, c_size_t)
418 type is (double precision)
419 s = n * int(8, c_size_t)
431 integer,
intent(in) :: n
432 class(*),
intent(inout),
target :: x(:,:,:,:)
433 type(c_ptr),
intent(inout) :: x_d
434 integer,
intent(in),
value :: dir
436 type(c_ptr),
optional :: strm
437 type(c_ptr) :: ptr_h, copy_stream
438 integer(c_size_t) :: s
440 if (
present(strm))
then
448 s = n * int(4, c_size_t)
450 type is (
integer(i8))
451 s = n * int(8, c_size_t)
454 s = n * int(4, c_size_t)
456 type is (double precision)
457 s = n * int(8, c_size_t)
471 type(c_ptr),
intent(inout) :: dst
472 type(c_ptr),
intent(inout) :: src
473 integer(c_size_t),
intent(in) :: s
474 integer,
intent(in),
value :: dir
475 logical,
optional :: sync
476 type(c_ptr),
optional :: strm
477 type(c_ptr) :: copy_stream
478 logical :: sync_device
480 if (
present(sync))
then
483 sync_device = .false.
486 if (
present(strm))
then
500 type(c_ptr),
intent(inout) :: ptr_h
501 type(c_ptr),
intent(inout) :: x_d
502 integer(c_size_t),
intent(in) :: s
503 integer,
intent(in),
value :: dir
504 logical,
intent(in) :: sync_device
505 type(c_ptr),
intent(inout) :: stream
508 if (sync_device)
then
521 if (.not. c_associated(x_d, ptr_h))
then
524 call neko_error(
'Device memcpy async (host-to-device) failed')
528 if (.not. c_associated(ptr_h, x_d))
then
531 call neko_error(
'Device memcpy async (device-to-host) failed')
535 if (.not. c_associated(ptr_h, x_d))
then
538 call neko_error(
'Device memcpy async (device-to-device) failed')
542 call neko_error(
'Device memcpy failed (invalid direction')
544 if (sync_device)
then
551 call neko_error(
'Device memcpy async (host-to-device) failed')
556 call neko_error(
'Device memcpy async (device-to-host) failed')
561 call neko_error(
'Device memcpy async (device-to-device) failed')
564 call neko_error(
'Device memcpy failed (invalid direction')
566 if (sync_device)
then
570 if (sync_device)
then
573 ptr_h, 0, c_null_ptr, c_null_ptr) &
575 call neko_error(
'Device memcpy (host-to-device) failed')
579 0, c_null_ptr, c_null_ptr) &
581 call neko_error(
'Device memcpy (device-to-host) failed')
585 0, c_null_ptr, c_null_ptr) &
587 call neko_error(
'Device memcpy (device-to-device) failed')
590 call neko_error(
'Device memcpy failed (invalid direction')
595 ptr_h, 0, c_null_ptr, c_null_ptr) &
597 call neko_error(
'Device memcpy (host-to-device) failed')
601 0, c_null_ptr, c_null_ptr) &
603 call neko_error(
'Device memcpy (device-to-host) failed')
607 0, c_null_ptr, c_null_ptr) &
609 call neko_error(
'Device memcpy (device-to-device) failed')
612 call neko_error(
'Device memcpy failed (invalid direction')
619 if (metalmemcpyhtod(x_d, ptr_h, s) .ne. metalsuccess)
then
620 call neko_error(
'Device memcpy (host-to-device) failed')
623 if (metalmemcpydtoh(ptr_h, x_d, s) .ne. metalsuccess)
then
624 call neko_error(
'Device memcpy (device-to-host) failed')
627 if (metalmemcpydtod(ptr_h, x_d, s) .ne. metalsuccess)
then
628 call neko_error(
'Device memcpy (device-to-device) failed')
631 call neko_error(
'Device memcpy failed (invalid direction')
638 class(*),
intent(inout),
target :: x(:)
639 type(c_ptr),
intent(inout) :: x_d
640 integer,
intent(in),
optional :: n
641 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
650 if (n_ .eq. 0)
return
651 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
652 ' to a null device pointer for a non-empty array')
656 htbl_ptr_h%ptr = c_loc(x)
657 type is (
integer(i8))
658 htbl_ptr_h%ptr = c_loc(x)
660 htbl_ptr_h%ptr = c_loc(x)
661 type is (double precision)
662 htbl_ptr_h%ptr = c_loc(x)
675 class(*),
intent(inout),
target :: x(:,:)
676 type(c_ptr),
intent(inout) :: x_d
677 integer,
intent(in),
optional :: n
678 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
687 if (n_ .eq. 0)
return
688 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
689 ' to a null device pointer for a non-empty array')
693 htbl_ptr_h%ptr = c_loc(x)
694 type is (
integer(i8))
695 htbl_ptr_h%ptr = c_loc(x)
697 htbl_ptr_h%ptr = c_loc(x)
698 type is (double precision)
699 htbl_ptr_h%ptr = c_loc(x)
712 class(*),
intent(inout),
target :: x(:,:,:)
713 type(c_ptr),
intent(inout) :: x_d
714 integer,
intent(in),
optional :: n
715 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
724 if (n_ .eq. 0)
return
725 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
726 ' to a null device pointer for a non-empty array')
729 htbl_ptr_h%ptr = c_loc(x)
730 type is (
integer(i8))
731 htbl_ptr_h%ptr = c_loc(x)
733 htbl_ptr_h%ptr = c_loc(x)
734 type is (double precision)
735 htbl_ptr_h%ptr = c_loc(x)
748 class(*),
intent(inout),
target :: x(:,:,:,:)
749 type(c_ptr),
intent(inout) :: x_d
750 integer,
intent(in),
optional :: n
751 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
760 if (n_ .eq. 0)
return
761 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
762 ' to a null device pointer for a non-empty array')
766 htbl_ptr_h%ptr = c_loc(x)
767 type is (
integer(i8))
768 htbl_ptr_h%ptr = c_loc(x)
770 htbl_ptr_h%ptr = c_loc(x)
771 type is (double precision)
772 htbl_ptr_h%ptr = c_loc(x)
785 class(*),
intent(inout),
target :: x(:)
786 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
790 htbl_ptr_h%ptr = c_loc(x)
791 type is (
integer(i8))
792 htbl_ptr_h%ptr = c_loc(x)
794 htbl_ptr_h%ptr = c_loc(x)
795 type is (double precision)
796 htbl_ptr_h%ptr = c_loc(x)
809 class(*),
intent(inout),
target :: x(:,:)
810 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
814 htbl_ptr_h%ptr = c_loc(x)
815 type is (
integer(i8))
816 htbl_ptr_h%ptr = c_loc(x)
818 htbl_ptr_h%ptr = c_loc(x)
819 type is (double precision)
820 htbl_ptr_h%ptr = c_loc(x)
833 class(*),
intent(inout),
target :: x(:,:,:)
834 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
838 htbl_ptr_h%ptr = c_loc(x)
839 type is (
integer(i8))
840 htbl_ptr_h%ptr = c_loc(x)
842 htbl_ptr_h%ptr = c_loc(x)
843 type is (double precision)
844 htbl_ptr_h%ptr = c_loc(x)
857 class(*),
intent(inout),
target :: x(:,:,:,:)
858 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
862 htbl_ptr_h%ptr = c_loc(x)
863 type is (
integer(i8))
864 htbl_ptr_h%ptr = c_loc(x)
866 htbl_ptr_h%ptr = c_loc(x)
867 type is (double precision)
868 htbl_ptr_h%ptr = c_loc(x)
884 type(c_ptr),
intent(in) :: ptr_h
885 type(c_ptr),
intent(inout) :: x_d
886 integer(c_size_t),
intent(in) :: s
895 if (metalmap(x_d, ptr_h, s) .ne. metalsuccess)
then
896 call neko_error(
'Memory map on device failed')
906 call neko_error(
'Memory map on device failed')
916 integer,
intent(in) :: n
917 class(*),
intent(inout),
target :: x(:)
918 type(c_ptr),
intent(inout) :: x_d
920 integer(c_size_t) :: s
922 if (c_associated(x_d))
then
923 call neko_error(
'Device pointer already associated')
928 s = n * int(4, c_size_t)
930 type is (
integer(i8))
931 s = n * int(8, c_size_t)
934 s = n * int(4, c_size_t)
936 type is (double precision)
937 s = n * int(8, c_size_t)
950 integer,
intent(in) :: n
951 class(*),
intent(inout),
target :: x(:,:)
952 type(c_ptr),
intent(inout) :: x_d
954 integer(c_size_t) :: s
956 if (c_associated(x_d))
then
957 call neko_error(
'Device pointer already associated')
962 s = n * int(4, c_size_t)
964 type is (
integer(i8))
965 s = n * int(8, c_size_t)
968 s = n * int(4, c_size_t)
970 type is (double precision)
971 s = n * int(8, c_size_t)
984 integer,
intent(in) :: n
985 class(*),
intent(inout),
target :: x(:,:,:)
986 type(c_ptr),
intent(inout) :: x_d
988 integer(c_size_t) :: s
990 if (c_associated(x_d))
then
991 call neko_error(
'Device pointer already associated')
996 s = n * int(4, c_size_t)
998 type is (
integer(i8))
999 s = n * int(8, c_size_t)
1002 s = n * int(4, c_size_t)
1004 type is (double precision)
1005 s = n * int(8, c_size_t)
1018 integer,
intent(in) :: n
1019 class(*),
intent(inout),
target :: x(:,:,:,:)
1020 type(c_ptr),
intent(inout) :: x_d
1021 type(c_ptr) :: ptr_h
1022 integer(c_size_t) :: s
1024 if (c_associated(x_d))
then
1025 call neko_error(
'Device pointer already associated')
1030 s = n * int(4, c_size_t)
1032 type is (
integer(i8))
1033 s = n * int(8, c_size_t)
1036 s = n * int(4, c_size_t)
1038 type is (double precision)
1039 s = n * int(8, c_size_t)
1052 class(*),
intent(inout),
target :: x(:)
1053 type(c_ptr),
intent(inout) :: x_d
1061 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1076 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1077 (.not. c_associated(dev, x_d)))
then
1078 call neko_error(
'Inconsistent host/device mapping state in ' // &
1089 class(*),
intent(inout),
target :: x(:,:)
1090 type(c_ptr),
intent(inout) :: x_d
1098 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1113 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1114 (.not. c_associated(dev, x_d)))
then
1115 call neko_error(
'Inconsistent host/device mapping state in ' // &
1126 class(*),
intent(inout),
target :: x(:,:,:)
1127 type(c_ptr),
intent(inout) :: x_d
1135 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1150 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1151 (.not. c_associated(dev, x_d)))
then
1152 call neko_error(
'Inconsistent host/device mapping state in ' // &
1163 class(*),
intent(inout),
target :: x(:,:,:,:)
1164 type(c_ptr),
intent(inout) :: x_d
1172 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1187 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1188 (.not. c_associated(dev, x_d)))
then
1189 call neko_error(
'Inconsistent host/device mapping state in ' // &
1200 class(*),
intent(inout),
target :: x(:)
1201 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1206 htbl_ptr_h%ptr = c_loc(x)
1207 type is (
integer(
i8))
1208 htbl_ptr_h%ptr = c_loc(x)
1210 htbl_ptr_h%ptr = c_loc(x)
1211 type is (double precision)
1212 htbl_ptr_h%ptr = c_loc(x)
1227 class(*),
intent(inout),
target :: x(:,:)
1228 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1233 htbl_ptr_h%ptr = c_loc(x)
1234 type is (
integer(
i8))
1235 htbl_ptr_h%ptr = c_loc(x)
1237 htbl_ptr_h%ptr = c_loc(x)
1238 type is (double precision)
1239 htbl_ptr_h%ptr = c_loc(x)
1254 class(*),
intent(inout),
target :: x(:,:,:)
1255 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1260 htbl_ptr_h%ptr = c_loc(x)
1261 type is (
integer(
i8))
1262 htbl_ptr_h%ptr = c_loc(x)
1264 htbl_ptr_h%ptr = c_loc(x)
1265 type is (double precision)
1266 htbl_ptr_h%ptr = c_loc(x)
1281 class(*),
intent(inout),
target :: x(:,:,:,:)
1282 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1287 htbl_ptr_h%ptr = c_loc(x)
1288 type is (
integer(
i8))
1289 htbl_ptr_h%ptr = c_loc(x)
1291 htbl_ptr_h%ptr = c_loc(x)
1292 type is (double precision)
1293 htbl_ptr_h%ptr = c_loc(x)
1308 class(*),
intent(in),
target :: x(:)
1309 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1316 htbl_ptr_h%ptr = c_loc(x)
1317 type is (
integer(
i8))
1318 htbl_ptr_h%ptr = c_loc(x)
1320 htbl_ptr_h%ptr = c_loc(x)
1321 type is (double precision)
1322 htbl_ptr_h%ptr = c_loc(x)
1330 call neko_error(
'Array not associated with device')
1336 class(*),
intent(in),
target :: x(:,:)
1337 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1344 htbl_ptr_h%ptr = c_loc(x)
1345 type is (
integer(
i8))
1346 htbl_ptr_h%ptr = c_loc(x)
1348 htbl_ptr_h%ptr = c_loc(x)
1349 type is (double precision)
1350 htbl_ptr_h%ptr = c_loc(x)
1358 call neko_error(
'Array not associated with device')
1364 class(*),
intent(in),
target :: x(:,:,:)
1365 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1372 htbl_ptr_h%ptr = c_loc(x)
1373 type is (
integer(
i8))
1374 htbl_ptr_h%ptr = c_loc(x)
1376 htbl_ptr_h%ptr = c_loc(x)
1377 type is (double precision)
1378 htbl_ptr_h%ptr = c_loc(x)
1386 call neko_error(
'Array not associated with device')
1392 class(*),
intent(in),
target :: x(:,:,:,:)
1393 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1400 htbl_ptr_h%ptr = c_loc(x)
1401 type is (
integer(
i8))
1402 htbl_ptr_h%ptr = c_loc(x)
1404 htbl_ptr_h%ptr = c_loc(x)
1405 type is (double precision)
1406 htbl_ptr_h%ptr = c_loc(x)
1414 call neko_error(
'Array not associated with device')
1433 if (metaldevicesynchronize() .ne. metalsuccess)
then
1441 type(c_ptr),
intent(in) :: stream
1455 if (metalstreamsynchronize(stream) .ne. metalsuccess)
then
1463 type(c_ptr),
intent(inout) :: stream
1464 integer,
optional :: flags
1467 if (
present(flags))
then
1469 call neko_error(
'Error during stream create (w. flags)')
1473 call neko_error(
'Error during stream create')
1477 if (
present(flags))
then
1479 call neko_error(
'Error during stream create (w. flags)')
1483 call neko_error(
'Error during stream create')
1489 call neko_error(
'Error during stream create')
1492 if (metalstreamcreate(stream) .ne. metalsuccess)
then
1493 call neko_error(
'Error during stream create')
1500 type(c_ptr),
intent(inout) :: stream
1501 integer,
intent(in) :: flags, prio
1504 call neko_error(
'Error during stream create (w. priority)')
1508 call neko_error(
'Error during stream create (w. priority)')
1514 if (metalstreamcreate(stream) .ne. metalsuccess)
then
1515 call neko_error(
'Error during stream create (w. priority)')
1522 type(c_ptr),
intent(inout) :: stream
1525 call neko_error(
'Error during stream destroy')
1529 call neko_error(
'Error during stream destroy')
1533 call neko_error(
'Error during stream destroy')
1536 if (metalstreamdestroy(stream) .ne. metalsuccess)
then
1537 call neko_error(
'Error during stream destroy')
1544 type(c_ptr),
intent(in) :: stream
1545 type(c_ptr),
target,
intent(in) :: event
1563 if (metalstreamwaitevent(stream, event) .ne. metalsuccess)
then
1589 type(c_ptr),
intent(inout) :: event
1590 integer,
optional :: flags
1593 if (
present(flags))
then
1595 call neko_error(
'Error during event create (w. flags)')
1603 if (
present(flags))
then
1605 call neko_error(
'Error during event create (w. flags)')
1615 if (metaleventcreate(event) .ne. metalsuccess)
then
1623 type(c_ptr),
intent(inout) :: event
1626 call neko_error(
'Error during event destroy')
1630 call neko_error(
'Error during event destroy')
1635 if (metaleventdestroy(event) .ne. metalsuccess)
then
1636 call neko_error(
'Error during event destroy')
1644 type(c_ptr),
target,
intent(in) :: event
1645 type(c_ptr),
intent(in) :: stream
1659 if (metaleventrecord(event, stream) .ne. metalsuccess)
then
1667 type(c_ptr),
target,
intent(in) :: event
1677 if (c_associated(event))
then
1683 if (c_associated(event))
then
1684 if (metaleventsynchronize(event) .ne. metalsuccess)
then
Associate a Fortran array to a (allocated) device pointer.
Check if a Fortran array is assoicated with a device pointer.
Deassociate a Fortran array from a device pointer.
Return the device pointer for an associated Fortran array.
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
Synchronize a device or stream.
Unmap a Fortran array from a device (deassociate and free)
Map host memory to the device (zero-copy on unified memory architectures, e.g. MI300A,...
Free a device pointer obtained from hipMap (no-op for pointers aliasing host memory)
Copy between device/host pointers via the mapping layer (kernel-based copy under zero-copy,...
Memset on a device pointer obtained from hipMap (host-side memset for pointers aliasing host memory)
subroutine cuda_device_name(name)
subroutine cuda_finalize(glb_cmd_queue, aux_cmd_queue)
@ cudamemcpydevicetodevice
integer function cuda_device_count()
Return the number of avaialble CUDA devices.
subroutine cuda_init(glb_cmd_queue, aux_cmd_queue, strm_high_prio, strm_low_prio)
Device abstraction, common interface for various accelerators.
subroutine, public device_event_record(event, stream)
Record a device event.
subroutine device_associate_r4(x, x_d, n)
Associate a Fortran rank 4 array to a (allocated) device pointer.
subroutine, public device_event_sync(event)
Synchronize an event.
subroutine device_associate_r1(x, x_d, n)
Associate a Fortran rank 1 array to a (allocated) device pointer.
subroutine, public device_finalize
integer, parameter, public device_to_device
type(c_ptr) function device_get_ptr_r4(x)
Return the device pointer for an associated Fortran rank 4 array.
type(c_ptr) function device_get_ptr_r1(x)
Return the device pointer for an associated Fortran rank 1 array.
integer, public strm_low_prio
Low priority stream setting.
integer, parameter, public host_to_device
subroutine device_map_r3(x, x_d, n)
Map a Fortran rank 3 array to a device (allocate and associate)
type(c_ptr), bind(C), public prf_cmd_queue
Profiling command queue.
type(htable_cptr_t) device_addrtbl
Table of host to device address mappings.
logical function device_associated_r3(x)
Check if a Fortran rank 3 array is assoicated with a device pointer.
subroutine device_unmap_r4(x, x_d)
Unmap a Fortran rank 4 array from a device (deassociate and free)
subroutine, public device_profiler_stop()
Stop device profiling.
subroutine device_deassociate_r3(x)
Deassociate a Fortran rank 3 array from a device pointer.
subroutine, public device_sync_stream(stream)
Synchronize a device stream.
type(c_ptr) function device_get_ptr_r3(x)
Return the device pointer for an associated Fortran rank 3 array.
subroutine device_unmap_r2(x, x_d)
Unmap a Fortran rank 2 array from a device (deassociate and free)
subroutine, public device_profiler_start()
Start device profiling.
subroutine device_map_r2(x, x_d, n)
Map a Fortran rank 2 array to a device (allocate and associate)
subroutine device_memcpy_r2(x, x_d, n, dir, sync, strm)
Copy data between host and device (rank 2 arrays)
subroutine device_map_r4(x, x_d, n)
Map a Fortran rank 4 array to a device (allocate and associate)
subroutine, public device_free(x_d)
Deallocate memory on the device.
integer, parameter, public device_to_host
subroutine device_memcpy_cptr(dst, src, s, dir, sync, strm)
Copy data between host and device (or device and device) (c-pointers)
subroutine device_memcpy_common(ptr_h, x_d, s, dir, sync_device, stream)
Copy data between host and device.
subroutine, public device_event_destroy(event)
Destroy a device event.
subroutine, public device_alloc(x_d, s)
Allocate memory on the device.
subroutine device_associate_r2(x, x_d, n)
Associate a Fortran rank 2 array to a (allocated) device pointer.
subroutine, public device_stream_create_with_priority(stream, flags, prio)
Create a device stream/command queue with priority.
subroutine, public device_stream_create(stream, flags)
Create a device stream/command queue.
subroutine device_deassociate_r4(x)
Deassociate a Fortran rank 4 array from a device pointer.
subroutine device_sync_device()
Synchronize the device.
subroutine device_memcpy_r4(x, x_d, n, dir, sync, strm)
Copy data between host and device (rank 4 arrays)
subroutine, public device_stream_wait_event(stream, event, flags)
Synchronize a device stream with an event.
subroutine device_map_r1(x, x_d, n)
Map a Fortran rank 1 array to a device (allocate and associate)
subroutine device_associate_r3(x, x_d, n)
Associate a Fortran rank 3 array to a (allocated) device pointer.
subroutine device_unmap_r1(x, x_d)
Unmap a Fortran rank 1 array from a device (deassociate and free)
subroutine device_memcpy_r1(x, x_d, n, dir, sync, strm)
Copy data between host and device (rank 1 arrays)
type(c_ptr), bind(C), public glb_cmd_queue
Global command queue.
subroutine, public device_event_create(event, flags)
Create a device event queue.
integer function, public device_count()
Return the number of available devices.
subroutine, public device_name(name)
logical function device_associated_r4(x)
Check if a Fortran rank 4 array is assoicated with a device pointer.
logical function device_associated_r2(x)
Check if a Fortran rank 2 array is assoicated with a device pointer.
integer, public strm_high_prio
High priority stream setting.
type(c_ptr), bind(C), public aux_cmd_queue
Aux command queue.
subroutine device_map_common(ptr_h, x_d, s)
Allocate device memory backing a mapped host array.
type(c_ptr) function device_get_ptr_r2(x)
Return the device pointer for an associated Fortran rank 2 array.
subroutine device_unmap_r3(x, x_d)
Unmap a Fortran rank 3 array from a device (deassociate and free)
subroutine device_deassociate_r1(x)
Deassociate a Fortran rank 1 array from a device pointer.
type(c_ptr), bind(C), public glb_cmd_event
Event for the global command queue.
subroutine device_deassociate_r2(x)
Deassociate a Fortran rank 2 array from a device pointer.
subroutine, public device_init
logical function device_associated_r1(x)
Check if a Fortran rank 1 array is assoicated with a device pointer.
subroutine, public device_memset(x_d, v, s, sync, strm)
Set memory on the device to a value.
subroutine device_memcpy_r3(x, x_d, n, dir, sync, strm)
Copy data between host and device (rank 3 arrays)
subroutine, public device_stream_destroy(stream)
Destroy a device stream/command queue.
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)
integer function hip_device_count()
Return the number of available HIP devices.
Implements a hash table ADT.
integer, parameter neko_bcknd_device
integer, parameter, public i8
Fortran OpenCL interface.
subroutine opencl_device_name(name)
subroutine opencl_finalize(glb_cmd_queue, aux_cmd_queue, prf_cmd_queue)
integer function opencl_device_count()
Return the number of OpenCL devices.
subroutine opencl_init(glb_cmd_queue, aux_cmd_queue, prf_cmd_queue)
OpenCL JIT program library.
subroutine, public opencl_prgm_lib_release
C pointer based hash table.