44 use,
intrinsic :: iso_c_binding
139#if defined(HAVE_HIP) || defined(HAVE_CUDA) || \
140 defined(have_opencl) || defined(have_metal)
158 call neko_error(
'Only one device is supported per MPI rank')
164#if defined(HAVE_HIP) || defined(HAVE_CUDA) || \
165 defined(have_opencl) || defined(have_metal)
183 character(len=*),
intent(inout) :: name
192 call metal_device_name(name)
250 type(c_ptr),
intent(inout) :: x_d
251 integer(c_size_t) :: s
261 call neko_error(
'Memory allocation on device failed')
265 call neko_error(
'Memory allocation on device failed')
270 call neko_error(
'Memory allocation on device failed')
273 if (metalalloc(x_d, s) .ne. metalsuccess)
then
274 call neko_error(
'Memory allocation on device failed')
281 type(c_ptr),
intent(inout) :: x_d
286 call neko_error(
'Memory deallocation on device failed')
290 call neko_error(
'Memory deallocation on device failed')
294 call neko_error(
'Memory deallocation on device failed')
297 if (metalfree(x_d) .ne. metalsuccess)
then
298 call neko_error(
'Memory deallocation on device failed')
306 type(c_ptr),
intent(inout) :: x_d
307 integer(c_int),
target,
value :: v
308 integer(c_size_t),
intent(in) :: s
309 logical,
optional :: sync
310 type(c_ptr),
optional :: strm
311 type(c_ptr) :: stream
312 logical :: sync_device
314 if (
present(sync))
then
317 sync_device = .false.
320 if (
present(strm))
then
338 s, 0, c_null_ptr, c_null_ptr) .ne.
cl_success)
then
342 if (metalmemset(x_d, v, s) .ne. metalsuccess)
then
347 if (sync_device)
then
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)
469 integer,
intent(in) :: n
470 class(*),
intent(inout),
target :: x(:,:,:,:)
471 type(c_ptr),
intent(inout) :: x_d
472 integer,
intent(in),
value :: dir
474 type(c_ptr),
optional :: strm
475 type(c_ptr) :: ptr_h, copy_stream
476 integer(c_size_t) :: s
478 if (
present(strm))
then
486 s = n * int(4, c_size_t)
488 type is (
integer(i8))
489 s = n * int(8, c_size_t)
492 s = n * int(4, c_size_t)
494 type is (double precision)
495 s = n * int(8, c_size_t)
509 type(c_ptr),
intent(inout) :: dst
510 type(c_ptr),
intent(inout) :: src
511 integer(c_size_t),
intent(in) :: s
512 integer,
intent(in),
value :: dir
513 logical,
optional :: sync
514 type(c_ptr),
optional :: strm
515 type(c_ptr) :: copy_stream
516 logical :: sync_device
518 if (
present(sync))
then
521 sync_device = .false.
524 if (
present(strm))
then
538 type(c_ptr),
intent(inout) :: ptr_h
539 type(c_ptr),
intent(inout) :: x_d
540 integer(c_size_t),
intent(in) :: s
541 integer,
intent(in),
value :: dir
542 logical,
intent(in) :: sync_device
543 type(c_ptr),
intent(inout) :: stream
546 if (sync_device)
then
559 if (.not. c_associated(x_d, ptr_h))
then
562 call neko_error(
'Device memcpy async (host-to-device) failed')
566 if (.not. c_associated(ptr_h, x_d))
then
569 call neko_error(
'Device memcpy async (device-to-host) failed')
573 if (.not. c_associated(ptr_h, x_d))
then
576 call neko_error(
'Device memcpy async (device-to-device) failed')
580 call neko_error(
'Device memcpy failed (invalid direction')
582 if (sync_device)
then
589 call neko_error(
'Device memcpy async (host-to-device) failed')
594 call neko_error(
'Device memcpy async (device-to-host) failed')
599 call neko_error(
'Device memcpy async (device-to-device) failed')
602 call neko_error(
'Device memcpy failed (invalid direction')
604 if (sync_device)
then
608 if (sync_device)
then
611 ptr_h, 0, c_null_ptr, c_null_ptr) &
613 call neko_error(
'Device memcpy (host-to-device) failed')
617 0, c_null_ptr, c_null_ptr) &
619 call neko_error(
'Device memcpy (device-to-host) failed')
623 0, c_null_ptr, c_null_ptr) &
625 call neko_error(
'Device memcpy (device-to-device) failed')
628 call neko_error(
'Device memcpy failed (invalid direction')
633 ptr_h, 0, c_null_ptr, c_null_ptr) &
635 call neko_error(
'Device memcpy (host-to-device) failed')
639 0, c_null_ptr, c_null_ptr) &
641 call neko_error(
'Device memcpy (device-to-host) failed')
645 0, c_null_ptr, c_null_ptr) &
647 call neko_error(
'Device memcpy (device-to-device) failed')
650 call neko_error(
'Device memcpy failed (invalid direction')
657 if (metalmemcpyhtod(x_d, ptr_h, s) .ne. metalsuccess)
then
658 call neko_error(
'Device memcpy (host-to-device) failed')
661 if (metalmemcpydtoh(ptr_h, x_d, s) .ne. metalsuccess)
then
662 call neko_error(
'Device memcpy (device-to-host) failed')
665 if (metalmemcpydtod(ptr_h, x_d, s) .ne. metalsuccess)
then
666 call neko_error(
'Device memcpy (device-to-device) failed')
669 call neko_error(
'Device memcpy failed (invalid direction')
676 class(*),
intent(inout),
target :: x(:)
677 type(c_ptr),
intent(inout) :: x_d
678 integer,
intent(in),
optional :: n
679 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
688 if (n_ .eq. 0)
return
689 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
690 ' to a null device pointer for a non-empty array')
694 htbl_ptr_h%ptr = c_loc(x)
695 type is (
integer(i8))
696 htbl_ptr_h%ptr = c_loc(x)
698 htbl_ptr_h%ptr = c_loc(x)
699 type is (double precision)
700 htbl_ptr_h%ptr = c_loc(x)
713 class(*),
intent(inout),
target :: x(:,:)
714 type(c_ptr),
intent(inout) :: x_d
715 integer,
intent(in),
optional :: n
716 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
725 if (n_ .eq. 0)
return
726 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
727 ' to a null device pointer for a non-empty array')
731 htbl_ptr_h%ptr = c_loc(x)
732 type is (
integer(i8))
733 htbl_ptr_h%ptr = c_loc(x)
735 htbl_ptr_h%ptr = c_loc(x)
736 type is (double precision)
737 htbl_ptr_h%ptr = c_loc(x)
750 class(*),
intent(inout),
target :: x(:,:,:)
751 type(c_ptr),
intent(inout) :: x_d
752 integer,
intent(in),
optional :: n
753 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
762 if (n_ .eq. 0)
return
763 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
764 ' to a null device pointer for a non-empty array')
767 htbl_ptr_h%ptr = c_loc(x)
768 type is (
integer(i8))
769 htbl_ptr_h%ptr = c_loc(x)
771 htbl_ptr_h%ptr = c_loc(x)
772 type is (double precision)
773 htbl_ptr_h%ptr = c_loc(x)
786 class(*),
intent(inout),
target :: x(:,:,:,:)
787 type(c_ptr),
intent(inout) :: x_d
788 integer,
intent(in),
optional :: n
789 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
798 if (n_ .eq. 0)
return
799 if (.not. c_associated(x_d))
call neko_error(
'Attempting to associate' // &
800 ' to a null device pointer for a non-empty array')
804 htbl_ptr_h%ptr = c_loc(x)
805 type is (
integer(i8))
806 htbl_ptr_h%ptr = c_loc(x)
808 htbl_ptr_h%ptr = c_loc(x)
809 type is (double precision)
810 htbl_ptr_h%ptr = c_loc(x)
823 class(*),
intent(inout),
target :: x(:)
824 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
828 htbl_ptr_h%ptr = c_loc(x)
829 type is (
integer(i8))
830 htbl_ptr_h%ptr = c_loc(x)
832 htbl_ptr_h%ptr = c_loc(x)
833 type is (double precision)
834 htbl_ptr_h%ptr = c_loc(x)
847 class(*),
intent(inout),
target :: x(:,:)
848 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
852 htbl_ptr_h%ptr = c_loc(x)
853 type is (
integer(i8))
854 htbl_ptr_h%ptr = c_loc(x)
856 htbl_ptr_h%ptr = c_loc(x)
857 type is (double precision)
858 htbl_ptr_h%ptr = c_loc(x)
871 class(*),
intent(inout),
target :: x(:,:,:)
872 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
876 htbl_ptr_h%ptr = c_loc(x)
877 type is (
integer(i8))
878 htbl_ptr_h%ptr = c_loc(x)
880 htbl_ptr_h%ptr = c_loc(x)
881 type is (double precision)
882 htbl_ptr_h%ptr = c_loc(x)
895 class(*),
intent(inout),
target :: x(:,:,:,:)
896 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
900 htbl_ptr_h%ptr = c_loc(x)
901 type is (
integer(i8))
902 htbl_ptr_h%ptr = c_loc(x)
904 htbl_ptr_h%ptr = c_loc(x)
905 type is (double precision)
906 htbl_ptr_h%ptr = c_loc(x)
922 type(c_ptr),
intent(in) :: ptr_h
923 type(c_ptr),
intent(inout) :: x_d
924 integer(c_size_t),
intent(in) :: s
933 if (metalmap(x_d, ptr_h, s) .ne. metalsuccess)
then
934 call neko_error(
'Memory map on device failed')
944 call neko_error(
'Memory map on device failed')
954 integer,
intent(in) :: n
955 class(*),
intent(inout),
target :: x(:)
956 type(c_ptr),
intent(inout) :: x_d
958 integer(c_size_t) :: s
960 if (c_associated(x_d))
then
961 call neko_error(
'Device pointer already associated')
966 s = n * int(4, c_size_t)
968 type is (
integer(i8))
969 s = n * int(8, c_size_t)
972 s = n * int(4, c_size_t)
974 type is (double precision)
975 s = n * int(8, c_size_t)
988 integer,
intent(in) :: n
989 class(*),
intent(inout),
target :: x(:,:)
990 type(c_ptr),
intent(inout) :: x_d
992 integer(c_size_t) :: s
994 if (c_associated(x_d))
then
995 call neko_error(
'Device pointer already associated')
1000 s = n * int(4, c_size_t)
1002 type is (
integer(i8))
1003 s = n * int(8, c_size_t)
1006 s = n * int(4, c_size_t)
1008 type is (double precision)
1009 s = n * int(8, c_size_t)
1022 integer,
intent(in) :: n
1023 class(*),
intent(inout),
target :: x(:,:,:)
1024 type(c_ptr),
intent(inout) :: x_d
1025 type(c_ptr) :: ptr_h
1026 integer(c_size_t) :: s
1028 if (c_associated(x_d))
then
1029 call neko_error(
'Device pointer already associated')
1034 s = n * int(4, c_size_t)
1036 type is (
integer(i8))
1037 s = n * int(8, c_size_t)
1040 s = n * int(4, c_size_t)
1042 type is (double precision)
1043 s = n * int(8, c_size_t)
1056 integer,
intent(in) :: n
1057 class(*),
intent(inout),
target :: x(:,:,:,:)
1058 type(c_ptr),
intent(inout) :: x_d
1059 type(c_ptr) :: ptr_h
1060 integer(c_size_t) :: s
1062 if (c_associated(x_d))
then
1063 call neko_error(
'Device pointer already associated')
1068 s = n * int(4, c_size_t)
1070 type is (
integer(i8))
1071 s = n * int(8, c_size_t)
1074 s = n * int(4, c_size_t)
1076 type is (double precision)
1077 s = n * int(8, c_size_t)
1090 class(*),
intent(inout),
target :: x(:)
1091 type(c_ptr),
intent(inout) :: x_d
1099 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1114 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1115 (.not. c_associated(dev, x_d)))
then
1116 call neko_error(
'Inconsistent host/device mapping state in ' // &
1127 class(*),
intent(inout),
target :: x(:,:)
1128 type(c_ptr),
intent(inout) :: x_d
1136 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1151 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1152 (.not. c_associated(dev, x_d)))
then
1153 call neko_error(
'Inconsistent host/device mapping state in ' // &
1164 class(*),
intent(inout),
target :: x(:,:,:)
1165 type(c_ptr),
intent(inout) :: x_d
1173 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1188 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1189 (.not. c_associated(dev, x_d)))
then
1190 call neko_error(
'Inconsistent host/device mapping state in ' // &
1201 class(*),
intent(inout),
target :: x(:,:,:,:)
1202 type(c_ptr),
intent(inout) :: x_d
1210 if ((.not. mapped) .and. (.not. c_associated(x_d)))
then
1225 if ((.not. mapped) .or. (.not. c_associated(x_d)) .or. &
1226 (.not. c_associated(dev, x_d)))
then
1227 call neko_error(
'Inconsistent host/device mapping state in ' // &
1238 class(*),
intent(inout),
target :: x(:)
1239 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1244 htbl_ptr_h%ptr = c_loc(x)
1245 type is (
integer(
i8))
1246 htbl_ptr_h%ptr = c_loc(x)
1248 htbl_ptr_h%ptr = c_loc(x)
1249 type is (double precision)
1250 htbl_ptr_h%ptr = c_loc(x)
1265 class(*),
intent(inout),
target :: x(:,:)
1266 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1271 htbl_ptr_h%ptr = c_loc(x)
1272 type is (
integer(
i8))
1273 htbl_ptr_h%ptr = c_loc(x)
1275 htbl_ptr_h%ptr = c_loc(x)
1276 type is (double precision)
1277 htbl_ptr_h%ptr = c_loc(x)
1292 class(*),
intent(inout),
target :: x(:,:,:)
1293 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1298 htbl_ptr_h%ptr = c_loc(x)
1299 type is (
integer(
i8))
1300 htbl_ptr_h%ptr = c_loc(x)
1302 htbl_ptr_h%ptr = c_loc(x)
1303 type is (double precision)
1304 htbl_ptr_h%ptr = c_loc(x)
1319 class(*),
intent(inout),
target :: x(:,:,:,:)
1320 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1325 htbl_ptr_h%ptr = c_loc(x)
1326 type is (
integer(
i8))
1327 htbl_ptr_h%ptr = c_loc(x)
1329 htbl_ptr_h%ptr = c_loc(x)
1330 type is (double precision)
1331 htbl_ptr_h%ptr = c_loc(x)
1346 class(*),
intent(in),
target :: x(:)
1347 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1354 htbl_ptr_h%ptr = c_loc(x)
1355 type is (
integer(
i8))
1356 htbl_ptr_h%ptr = c_loc(x)
1358 htbl_ptr_h%ptr = c_loc(x)
1359 type is (double precision)
1360 htbl_ptr_h%ptr = c_loc(x)
1368 call neko_error(
'Array not associated with device')
1374 class(*),
intent(in),
target :: x(:,:)
1375 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1382 htbl_ptr_h%ptr = c_loc(x)
1383 type is (
integer(
i8))
1384 htbl_ptr_h%ptr = c_loc(x)
1386 htbl_ptr_h%ptr = c_loc(x)
1387 type is (double precision)
1388 htbl_ptr_h%ptr = c_loc(x)
1396 call neko_error(
'Array not associated with device')
1402 class(*),
intent(in),
target :: x(:,:,:)
1403 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1410 htbl_ptr_h%ptr = c_loc(x)
1411 type is (
integer(
i8))
1412 htbl_ptr_h%ptr = c_loc(x)
1414 htbl_ptr_h%ptr = c_loc(x)
1415 type is (double precision)
1416 htbl_ptr_h%ptr = c_loc(x)
1424 call neko_error(
'Array not associated with device')
1430 class(*),
intent(in),
target :: x(:,:,:,:)
1431 type(
h_cptr_t) :: htbl_ptr_h, htbl_ptr_d
1438 htbl_ptr_h%ptr = c_loc(x)
1439 type is (
integer(
i8))
1440 htbl_ptr_h%ptr = c_loc(x)
1442 htbl_ptr_h%ptr = c_loc(x)
1443 type is (double precision)
1444 htbl_ptr_h%ptr = c_loc(x)
1452 call neko_error(
'Array not associated with device')
1471 if (metaldevicesynchronize() .ne. metalsuccess)
then
1479 type(c_ptr),
intent(in) :: stream
1493 if (metalstreamsynchronize(stream) .ne. metalsuccess)
then
1501 type(c_ptr),
intent(inout) :: stream
1502 integer,
optional :: flags
1505 if (
present(flags))
then
1507 call neko_error(
'Error during stream create (w. flags)')
1511 call neko_error(
'Error during stream create')
1515 if (
present(flags))
then
1517 call neko_error(
'Error during stream create (w. flags)')
1521 call neko_error(
'Error during stream create')
1527 call neko_error(
'Error during stream create')
1530 if (metalstreamcreate(stream) .ne. metalsuccess)
then
1531 call neko_error(
'Error during stream create')
1538 type(c_ptr),
intent(inout) :: stream
1539 integer,
intent(in) :: flags, prio
1542 call neko_error(
'Error during stream create (w. priority)')
1546 call neko_error(
'Error during stream create (w. priority)')
1552 if (metalstreamcreate(stream) .ne. metalsuccess)
then
1553 call neko_error(
'Error during stream create (w. priority)')
1560 type(c_ptr),
intent(inout) :: stream
1563 call neko_error(
'Error during stream destroy')
1567 call neko_error(
'Error during stream destroy')
1571 call neko_error(
'Error during stream destroy')
1574 if (metalstreamdestroy(stream) .ne. metalsuccess)
then
1575 call neko_error(
'Error during stream destroy')
1582 type(c_ptr),
intent(in) :: stream
1583 type(c_ptr),
target,
intent(in) :: event
1601 if (metalstreamwaitevent(stream, event) .ne. metalsuccess)
then
1627 type(c_ptr),
intent(inout) :: event
1628 integer,
optional :: flags
1631 if (
present(flags))
then
1633 call neko_error(
'Error during event create (w. flags)')
1641 if (
present(flags))
then
1643 call neko_error(
'Error during event create (w. flags)')
1653 if (metaleventcreate(event) .ne. metalsuccess)
then
1661 type(c_ptr),
intent(inout) :: event
1664 call neko_error(
'Error during event destroy')
1668 call neko_error(
'Error during event destroy')
1673 if (metaleventdestroy(event) .ne. metalsuccess)
then
1674 call neko_error(
'Error during event destroy')
1682 type(c_ptr),
target,
intent(in) :: event
1683 type(c_ptr),
intent(in) :: stream
1697 if (metaleventrecord(event, stream) .ne. metalsuccess)
then
1705 type(c_ptr),
target,
intent(in) :: event
1715 if (c_associated(event))
then
1721 if (c_associated(event))
then
1722 if (metaleventsynchronize(event) .ne. metalsuccess)
then
Number of streaming multiprocessors of the current device (0 if unknown), see device/cuda/props....
Total memory of the current device in bytes (0 if unknown), see device/cuda/props....
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)
Number of compute units of the current device (0 if unknown), see device/hip/props....
Total memory of the current device in bytes (0 if unknown), see device/hip/props.hip.
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.
integer function, public device_mp_count()
Return the number of multiprocessors (SMs on NVIDIA, CUs on AMD, compute units on OpenCL,...
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.
integer(kind=i8) function, public device_total_mem()
Return the total memory of the current device in bytes, or 0 if the backend cannot tell.
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)
integer function opencl_device_mp_count()
Return the number of compute units of the current device (CL_DEVICE_MAX_COMPUTE_UNITS),...
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)
integer(kind=i8) function opencl_device_total_mem()
Return the global memory size of the current device in bytes (CL_DEVICE_GLOBAL_MEM_SIZE),...
OpenCL JIT program library.
subroutine, public opencl_prgm_lib_release
C pointer based hash table.