30 use iso_c_binding,
only: c_null_ptr, c_size_t
31 use,
intrinsic :: iso_fortran_env
92 integer,
public,
parameter :: &
93 ACCEL_MEM_READ_ONLY = 0, &
100 type(c_ptr) :: cuda_context
108#if defined(HAVE_CUDA)
109 type(c_ptr) :: cuda_device
117 type(accel_context_t) :: context
118 type(accel_device_t) :: device
119 type(c_ptr) :: cublas_handle
120 type(c_ptr) :: cuda_stream
121 type(c_ptr) :: program_map
122 integer :: max_block_size
123 integer(int64) :: shared_memory_size
124 integer(int64) :: global_memory_size
126 logical :: allow_CPU_only
129 integer(int64) :: initialize_buffers
130 character(len=32) :: debug_flag
131 integer(int64) :: max_block_dim(3)
132 integer(int64) :: max_grid_dim(3)
138 integer(c_size_t) :: size = 0
141 logical :: allocated = .false.
147 type(c_ptr) :: cuda_kernel
148 type(c_ptr) :: arguments
150 logical :: initialized = .false.
151 type(accel_kernel_t),
pointer :: next
153 character(len=128) :: kernel_name
156 type(accel_t),
public :: accel
159 type(accel_mem_t),
public,
save :: zM_0_buffer, zM_1_buffer
160 type(accel_mem_t),
public,
save :: dM_0_buffer, dM_1_buffer
163 type(accel_kernel_t),
public,
target,
save :: kernel_vpsi
164 type(accel_kernel_t),
public,
target,
save :: kernel_vpsi_complex
165 type(accel_kernel_t),
public,
target,
save :: kernel_vpsi_spinors
166 type(accel_kernel_t),
public,
target,
save :: kernel_vpsi_spinors_complex
167 type(accel_kernel_t),
public,
target,
save :: kernel_daxpy
168 type(accel_kernel_t),
public,
target,
save :: kernel_zaxpy
169 type(accel_kernel_t),
public,
target,
save :: kernel_copy
170 type(accel_kernel_t),
public,
target,
save :: kernel_copy_complex_to_real
171 type(accel_kernel_t),
public,
target,
save :: kernel_copy_real_to_complex
172 type(accel_kernel_t),
public,
target,
save :: dpack
173 type(accel_kernel_t),
public,
target,
save :: zpack
174 type(accel_kernel_t),
public,
target,
save :: dunpack
175 type(accel_kernel_t),
public,
target,
save :: zunpack
176 type(accel_kernel_t),
public,
target,
save :: kernel_ghost_reorder
177 type(accel_kernel_t),
public,
target,
save :: kernel_density_real
178 type(accel_kernel_t),
public,
target,
save :: kernel_density_complex
179 type(accel_kernel_t),
public,
target,
save :: kernel_density_spinors
180 type(accel_kernel_t),
public,
target,
save :: kernel_phase
181 type(accel_kernel_t),
public,
target,
save :: kernel_phase_spiral
182 type(accel_kernel_t),
public,
target,
save :: dkernel_dot_matrix
183 type(accel_kernel_t),
public,
target,
save :: zkernel_dot_matrix
184 type(accel_kernel_t),
public,
target,
save :: zkernel_dot_matrix_spinors
185 type(accel_kernel_t),
public,
target,
save :: dkernel_batch_axpy
186 type(accel_kernel_t),
public,
target,
save :: zkernel_batch_axpy
192 type(accel_kernel_t),
public,
target,
save :: zzmul_batch
300 integer :: buffer_alloc_count
301 integer(int64) :: allocated_mem
302 type(accel_kernel_t),
pointer :: head
303 type(alloc_cache_t) :: memcache
309 enabled = accel%enabled
319 allow = accel%allow_CPU_only
328 type(mpi_grp_t),
intent(inout) :: base_grp
329 type(namespace_t),
intent(in) :: namespace
331 logical :: disable, default, run_benchmark
336 character(len=256) :: sys_name
342 buffer_alloc_count = 0
360 accel%enabled = .not. disable
363 if (accel%enabled)
then
364 message(1) =
'Octopus was compiled without Cuda support.'
392 if (idevice < 0)
then
400 if (idevice<0) idevice = 0
401 call cuda_init(accel%context%cuda_context, accel%device%cuda_device, accel%cuda_stream, &
402 idevice, base_grp%rank)
405 write(
message(1),
'(A,I5,A,I5,2A)')
"Rank ", base_grp%rank,
" uses device number ", idevice, &
406 " on ", trim(sys_name)
410 call cublas_init(accel%cublas_handle, accel%cuda_stream)
421 accel%max_block_dim(1) = int(dim, int64)
423 accel%max_block_dim(2) = int(dim, int64)
425 accel%max_block_dim(3) = int(dim, int64)
427 accel%max_grid_dim(1) = int(dim, int64)
429 accel%max_grid_dim(2) = int(dim, int64)
431 accel%max_grid_dim(3) = int(dim, int64)
437 call alloc_cache_init(memcache, nint(0.25_real64*accel%global_memory_size, int64))
443 accel%debug_flag =
"-g"
444#elif defined(HAVE_CUDA)
445 accel%debug_flag =
"-lineinfo"
507 call parse_variable(namespace,
'AccelBenchmark', .false., run_benchmark)
511 if (run_benchmark)
then
532 call parse_variable(namespace,
'GPUAwareMPI', default, accel%cuda_mpi)
533 if (accel%cuda_mpi)
then
535 call messages_write(
"Warning: trying to use GPU-aware MPI, but we have not detected support in the linked MPI library.")
551#if defined (HAVE_ACCEL)
556 call parse_variable(namespace,
'AllowCPUonly', default, accel%allow_CPU_only)
572 call parse_variable(namespace,
'InitializeGPUBuffers', option__initializegpubuffers__no, accel%initialize_buffers)
587 character(kind=c_char) :: cval_str(257)
589 integer :: major, minor
590 character(len=256) :: val_str
599#ifdef __HIP_PLATFORM_AMD__
609#ifdef __HIP_PLATFORM_AMD__
617 cval_str = c_null_char
665 integer(int64) :: hits, misses
666 real(real64) :: volume_hits, volume_misses
682 if (.not. found)
exit
689 call alloc_cache_end(memcache, hits, misses, volume_hits, volume_misses)
700 if (hits + misses > 0)
then
701 call messages_write(hits/real(hits + misses, real64)*100, fmt=
'(f6.1)', align_left = .
true.)
707 if (volume_hits + volume_misses > 0)
then
708 call messages_write(volume_hits/(volume_hits + volume_misses)*100, fmt=
'(f6.1)', align_left = .
true.)
723 call cublas_end(accel%cublas_handle)
724 if (.not. accel%cuda_mpi)
then
725 call cuda_end(accel%context%cuda_context, accel%device%cuda_device)
729 if (buffer_alloc_count /= 0)
then
747 integer(int64),
intent(in) :: n(:)
748 integer(int64),
intent(in) :: blocksizes(:)
749 integer(int64),
intent(out) :: gridsizes(:)
753 dim = ubound(n, dim=1)
754 assert(dim == ubound(blocksizes, dim=1))
755 assert(dim == ubound(gridsizes, dim=1))
758 gridsizes(i) = (n(i) + blocksizes(i) - 1_int64) / blocksizes(i)
759 gridsizes(i) = min(gridsizes(i), accel%max_grid_dim(i))
767 integer,
intent(in) :: n(:)
768 integer,
intent(in) :: blocksizes(:)
769 integer,
intent(out) :: gridsizes(:)
771 integer(int64) :: gridsizes64(size(gridsizes))
775 gridsizes = int(gridsizes64, int32)
782 integer(int64),
intent(in) :: n
783 integer(int64),
intent(in) :: blocksizes
784 integer(int64),
intent(out) :: gridsizes
786 integer(int64) :: temp(1)
797 integer,
intent(in) :: n
798 integer,
intent(in) :: blocksizes
799 integer,
intent(out) :: gridsizes
801 integer(int64) :: temp(1)
805 gridsizes = int(temp(1), int32)
814 integer(int64),
intent(in) :: n
815 integer(int64),
intent(in) :: pack_size
816 integer(int64),
dimension(3),
intent(out) :: gridsizes
817 integer(int64),
dimension(3),
intent(out) :: blocksizes
820 integer(int64) :: bsize, dim2, dim3
821 integer(int64),
dimension(3) :: nn
823 if(
present(kernel))
then
832 nn = (/pack_size, dim2, dim3/)
833 blocksizes = (/pack_size, bsize, 1_int64/)
844 integer,
intent(in) :: n
845 integer,
intent(in) :: pack_size
846 integer,
dimension(3),
intent(out) :: gridsizes
847 integer,
dimension(3),
intent(out) :: blocksizes
850 integer(int64) :: gridsizes64(3), blocksizes64(3)
853 gridsizes64, blocksizes64, kernel=kernel)
855 gridsizes = int(gridsizes64, int32)
856 blocksizes = int(blocksizes64, int32)
862 integer(int64),
intent(in) :: nn
864 integer(int64) :: modnn, bsize
873 modnn = mod(nn, bsize)
874 if (modnn /= 0) psize = psize + bsize - modnn
883 integer(int32),
intent(in) :: nn
893 integer,
intent(in) :: flags
894 type(
type_t),
intent(in) :: type
895 integer,
intent(in) :: size
896 logical,
optional,
intent(in) :: set_zero
897 logical,
optional,
intent(in) :: async
906 integer,
intent(in) :: flags
907 type(
type_t),
intent(in) :: type
908 integer(int64),
intent(in) :: size
909 logical,
optional,
intent(in) :: set_zero
910 logical,
optional,
intent(in) :: async
912 integer(int64) :: fsize
914 integer(int64) :: initialize_buffers
922 this%allocated = .
true.
928 if (.not. found)
then
938 buffer_alloc_count = buffer_alloc_count + 1
939 allocated_mem = allocated_mem + fsize
943 if (
present(set_zero))
then
944 initialize_buffers = merge(option__initializegpubuffers__yes, option__initializegpubuffers__no, set_zero)
946 initialize_buffers = accel%initialize_buffers
948 select case (initialize_buffers)
949 case (option__initializegpubuffers__yes)
951 case (option__initializegpubuffers__nan)
962 logical,
optional,
intent(in) :: async
965 integer(int64) :: fsize
969 if (this%size > 0)
then
985 buffer_alloc_count = buffer_alloc_count - 1
986 allocated_mem = allocated_mem + fsize
993 this%allocated = .false.
1012 buffer_to%mem = buffer_from%mem
1013 buffer_to%size = buffer_from%size
1014 buffer_to%type = buffer_from%type
1015 buffer_to%flags = buffer_from%flags
1016 buffer_to%allocated = buffer_from%allocated
1034 this%mem = c_null_ptr
1038 this%allocated = .false.
1048 integer,
intent(in) :: flags
1049 type(
type_t),
intent(in) :: type
1050 integer,
intent(in) :: required_size
1051 logical,
intent(in) :: set_zero
1052 logical,
optional,
intent(in) :: async
1073 allocated = this%allocated
1092 integer,
intent(in) :: narg
1114 integer(int64),
intent(in) :: gridsizes(:)
1115 integer(int64),
intent(in) :: blocksizes(:)
1116 integer(int64),
optional,
intent(in) :: shared_memory_size
1119 integer(int64) :: gsizes(1:3)
1120 integer(int64) :: bsizes(1:3)
1128 dim = ubound(gridsizes, dim=1)
1130 assert(dim == ubound(blocksizes, dim=1))
1133 if (any(gridsizes == 0))
return
1135 assert(all(blocksizes > 0))
1137 gsizes(1:dim) = gridsizes(1:dim)
1138 bsizes(1:dim) = blocksizes(1:dim)
1142 if (any(bsizes(1:3) > accel%max_block_dim(1:3)))
then
1143 message(1) =
"Maximum dimension of a block too large in kernel "//trim(kernel%kernel_name)
1144 message(2) =
"The following conditions should be fulfilled:"
1145 write(
message(3),
"(A, I8, A, I8)")
"Dim 1: ", bsizes(1),
" <= ", accel%max_block_dim(1)
1146 write(
message(4),
"(A, I8, A, I8)")
"Dim 2: ", bsizes(2),
" <= ", accel%max_block_dim(2)
1147 write(
message(5),
"(A, I8, A, I8)")
"Dim 3: ", bsizes(3),
" <= ", accel%max_block_dim(3)
1148 message(6) =
"This is an internal error, please contact the developers."
1155 message(1) =
"Maximum number of threads per block too large in kernel "//trim(kernel%kernel_name)
1156 message(2) =
"The following condition should be fulfilled:"
1158 message(4) =
"This is an internal error, please contact the developers."
1163 if (any(gsizes(1:3) > accel%max_grid_dim(1:3)))
then
1164 message(1) =
"Maximum dimension of grid too large in kernel "//trim(kernel%kernel_name)
1165 message(2) =
"The following conditions should be fulfilled:"
1166 write(
message(3),
"(A, I8, A, I10)")
"Dim 1: ", gsizes(1),
" <= ", accel%max_grid_dim(1)
1167 write(
message(4),
"(A, I8, A, I10)")
"Dim 2: ", gsizes(2),
" <= ", accel%max_grid_dim(2)
1168 write(
message(5),
"(A, I8, A, I10)")
"Dim 3: ", gsizes(3),
" <= ", accel%max_grid_dim(3)
1169 message(6) =
"This is an internal error, please contact the developers."
1173 if(
present(shared_memory_size))
then
1175 if (shared_memory_size > accel%shared_memory_size)
then
1176 message(1) =
"Shared memory too large in kernel "//trim(kernel%kernel_name)
1177 message(2) =
"The following condition should be fulfilled:"
1178 message(3) =
"Requested shared memory <= Available shared memory"
1179 write(
message(4),
'(a,f12.6,a)')
"Requested shared memory: ", real(shared_memory_size, real64) /1024.0,
" Kb"
1180 write(
message(5),
'(a,f12.6,a)')
"Available shared memory: ", real(accel%shared_memory_size, real64) /1024.0,
" Kb"
1181 message(6) =
"This is an internal error, please contact the developers."
1183 else if (shared_memory_size <= 0)
then
1184 message(1) =
"Invalid shared memory size in kernel "//trim(kernel%kernel_name)
1185 write(
message(2),
'(a,f12.6,a)')
"Shared memory size requested: ", real(shared_memory_size, real64) /1024.0,
" Kb"
1186 message(3) =
"This is an internal error, please contact the developers."
1207 integer,
intent(in) :: gridsizes(:)
1208 integer,
intent(in) :: blocksizes(:)
1209 integer(int64),
optional,
intent(in) :: shared_memory_size
1211 call accel_kernel_run_8(kernel, int(gridsizes, int64), int(blocksizes, int64), shared_memory_size)
1218 max_block_size = accel%max_block_size
1227 integer :: max_block_size
1233 call cuda_kernel_max_threads_per_block(kernel%cuda_kernel, max_block_size)
1234 if (debug%info .and. max_block_size /=
accel%max_block_size)
then
1235 write(message(1),
"(A, I5, A)")
"A kernel can use only less threads per block (", max_block_size,
")", &
1236 "than available on the device (",
accel%max_block_size,
")"
1237 call messages_info(1)
1245 block_size = min(block_size, max_block_size)
1253 subroutine accel_copy_buffer(dest, src, type, nval, offset_dest, offset_src, async)
1256 type(type_t),
intent(in) :: type
1257 integer(int64),
intent(in) :: nval
1258 integer(int64),
optional,
intent(in) :: offset_dest
1259 integer(int64),
optional,
intent(in) :: offset_src
1260 logical,
optional,
intent(in) :: async
1262 integer(int64) :: type_size, offset_dest_, offset_src_
1265 call profiling_in(
"ACCEL_COPY_BUFFER")
1268 call profiling_out(
"ACCEL_COPY_BUFFER")
1274 type_size = types_get_size(type)
1276 offset_dest_ = 0_int64
1277 if (
present(offset_dest)) offset_dest_ = offset_dest*type_size
1278 offset_src_ = 0_int64
1279 if (
present(offset_src)) offset_src_ = offset_src*type_size
1281 assert(offset_dest_ + nval*type_size <= int(dest%size, int64)*types_get_size(dest%type))
1282 assert(offset_src_ + nval*type_size <= int(src%size, int64)*types_get_size(src%type))
1284 call cuda_memcpy_dtod(dest%mem, src%mem, nval*type_size, offset_dest_, offset_src_)
1286 if (.not. optional_default(async, .false.))
call accel_finish()
1288 call profiling_out(
"ACCEL_COPY_BUFFER")
1296 type(type_t),
intent(in) :: type
1297 integer(int8),
intent(in) :: val
1298 integer(int64),
intent(in) :: nval
1299 integer(int64),
optional,
intent(in) :: offset
1300 logical,
optional,
intent(in) :: async
1302 integer(int64) :: nval_, offset_, type_size
1312 if (
present(offset))
then
1314 if(offset > buffer%size)
then
1320 type_size = types_get_size(type)
1322 nval_ = nval*type_size
1325 if (
present(offset)) offset_ = offset*type_size
1327 call cuda_mem_set_async(buffer%mem, val, nval_, offset_)
1328 if(.not. optional_default(async, .false.))
call accel_finish()
1337 type(type_t),
intent(in) :: type
1338 integer(int64),
intent(in) :: nval
1339 integer(int64),
optional,
intent(in) :: offset
1340 logical,
optional,
intent(in) :: async
1353 type(type_t),
intent(in) :: type
1354 integer(int32),
intent(in) :: nval
1355 integer(int32),
optional,
intent(in) :: offset
1356 logical,
optional,
intent(in) :: async
1360 if (
present(offset))
then
1373 integer,
parameter :: times = 10
1375 real(real64) :: time, stime
1376 real(real64) :: read_bw, write_bw
1378 real(real64),
allocatable :: data(:)
1380 call messages_new_line()
1381 call messages_write(
'Info: Benchmarking the bandwidth between main memory and device memory')
1382 call messages_new_line()
1383 call messages_info()
1385 call messages_write(
' Buffer size Read bw Write bw')
1386 call messages_new_line()
1387 call messages_write(
' [MiB] [MiB/s] [MiB/s]')
1388 call messages_info()
1392 safe_allocate(
data(1:size))
1395 stime = loct_clock()
1400 time = (loct_clock() - stime)/real(times, real64)
1402 write_bw = real(
size, real64) *8.0_real64/time
1404 stime = loct_clock()
1410 time = (loct_clock() - stime)/real(times, real64)
1411 read_bw = real(
size, real64) *8.0_real64/time
1413 call messages_write(size*8.0_real64/1024.0_real64**2)
1414 call messages_write(write_bw/1024.0_real64**2, fmt =
'(f10.1)')
1415 call messages_write(read_bw/1024.0_real64**2, fmt =
'(f10.1)')
1416 call messages_info()
1420 safe_deallocate_a(data)
1422 size = int(size*2.0)
1424 if (
size > 50000000)
exit
1436 call cuda_program_map_init(
accel%program_map)
1516 call accel_program_add(
'exchange_local.cu',
'exchange_accumulate_batch<double>')
1517 call accel_program_add(
'exchange_local.cu',
'exchange_accumulate_return_batch<double>')
1519 call accel_program_add(
'exchange_local.cu',
'exchange_accumulate_batch<double2>')
1520 call accel_program_add(
'exchange_local.cu',
'exchange_accumulate_return_batch<double2>')
1521 call accel_program_add(
'exchange_local.cu',
'exchange_codensity_batch<double2>')
1598 call accel_program_add(
'projector.cu',
'projector_bra_scatter_complex<double2>')
1609 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_bra<double>')
1610 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_bra_phase<double>')
1611 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_ket<double>')
1612 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_ket_phase<double>')
1614 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_bra<double2>')
1615 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_bra_phase<double2>')
1617 call accel_program_add(
'projector_commutator.cu',
'projector_commutator_ket_phase<double2>')
1623 call accel_program_add(
'symmetrize_batch.cu',
'symmetrizer_apply_single_batch<double>')
1624 call accel_program_add(
'symmetrize_batch.cu',
'symmetrizer_apply_single_batch<double2>')
1647 character(len=*),
intent(in) :: file_name
1648 character(len=*),
intent(in) :: name
1652 call cuda_program_register(
accel%program_map, string_f_to_c(trim(file_name)), &
1653 string_f_to_c(trim(name)))
1666 if (.not.
associated(
head))
exit
1667 next_head =>
head%next
1673 call cuda_program_map_end(
accel%program_map)
1688 character(len=*),
intent(in) :: file_name
1689 character(len=*),
intent(in) :: kernel_name
1690 character(len=*),
optional,
intent(in) :: flags
1693 character(len=1000) :: all_flags
1698 call profiling_in(
"ACCEL_COMPILE", exclude = .
true.)
1701 all_flags =
'-I'//trim(conf%share)//
'/kernels/'//
" "//trim(
accel%debug_flag)
1703 if (
present(flags))
then
1704 all_flags = trim(all_flags)//
' '//trim(flags)
1707 call cuda_program_build(
accel%program_map,
accel%device%cuda_device, &
1708 string_f_to_c(trim(file_name)), string_f_to_c(trim(all_flags)))
1710 call cuda_program_get_kernel(this%cuda_kernel,
accel%program_map, &
1711 string_f_to_c(trim(file_name)), string_f_to_c(trim(all_flags)), &
1712 string_f_to_c(trim(kernel_name)))
1713 call cuda_alloc_arg_array(this%arguments)
1716 this%initialized = .
true.
1717 this%kernel_name = trim(kernel_name)
1719 call profiling_out(
"ACCEL_COMPILE")
1732 call cuda_free_arg_array(this%arguments)
1733 call cuda_release_kernel(this%cuda_kernel)
1737 this%initialized = .false.
1746 character(len=*),
intent(in) :: file_name
1747 character(len=*),
intent(in) :: kernel_name
1748 character(len=*),
optional,
intent(in) :: flags
1752 if (.not. this%initialized)
then
1765 size =
accel%global_memory_size
1773 size =
accel%shared_memory_size
1779 integer,
intent(in) :: dim
1784 if (dim == 1)
size = 2**30
1791 integer,
intent(in) :: stream_number
1797 call cuda_set_stream(
accel%cuda_stream, stream_number)
1798 call cublas_set_stream(
accel%cublas_handle,
accel%cuda_stream)
1808 integer,
intent(inout) :: stream_number
1814 call cuda_get_stream(stream_number)
1828 call cuda_synchronize_all_streams()
1836 type(c_ptr),
intent(in) :: buffer
1837 integer(int64),
intent(in) :: offset
1838 type(c_ptr) :: buffer_offset
1842 call cuda_get_pointer_with_offset(buffer, offset, buffer_offset)
1845 buffer_offset = buffer
1851 type(c_ptr),
intent(in) :: buffer
1852 integer(int64),
intent(in) :: offset
1853 type(c_ptr) :: buffer_offset
1857 call cuda_get_pointer_with_offset(buffer, 2_int64*offset, buffer_offset)
1860 buffer_offset = buffer
1866 type(c_ptr),
intent(in) :: buffer
1870 call cuda_clean_pointer(buffer)
1879 integer(int64),
intent(in) :: size
1880 integer(int64),
intent(out) :: grid_size
1881 integer(int64),
intent(out) :: thread_block_size
1884#ifdef __HIP_PLATFORM_AMD__
1887 thread_block_size =
size
1890 thread_block_size =
accel%warp_size
1897#include "accel_inc.F90"
1900#include "complex.F90"
1901#include "accel_inc.F90"
1904#include "integer.F90"
1905#include "accel_inc.F90"
1908#include "integer8.F90"
1909#include "accel_inc.F90"
subroutine accel_grid_size_i4(n, blocksizes, gridsizes)
Computes the grid size for a given problem size and block size (32-bit version).
subroutine laccel_get_device_pointer_3l(host_pointer, device_pointer, dimensions)
subroutine zaccel_get_device_pointer_2l(host_pointer, device_pointer, dimensions)
subroutine, public accel_clean_pointer(buffer)
subroutine accel_kernel_global_end()
subroutine zaccel_write_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine, public accel_get_unfolded_size(size, grid_size, thread_block_size)
Get unfolded size: some kernels (e.g. projectors) unfold the array across warps as an optimization....
subroutine laccel_read_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine laccel_read_buffer_3(this, n1, n2, n3, data, offset, async)
type(accel_kernel_t), target, save, public dzmul_batch
subroutine iaccel_write_buffer_2(this, n1, n2, data, offset, async)
pure logical function, public accel_allow_cpu_only()
subroutine daccel_get_device_pointer_1(host_pointer, device_pointer, dimensions)
subroutine zaccel_read_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine daccel_read_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine zaccel_get_device_pointer_1(host_pointer, device_pointer, dimensions)
subroutine laccel_read_buffer_4(this, n1, n2, n3, n4, data, offset, async)
type(accel_kernel_t), target, save, public dkernel_batch_dotp
subroutine zaccel_create_blas_alpha_beta_buffer(this, data, async)
subroutine daccel_write_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine laccel_write_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine daccel_write_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine laccel_get_device_pointer_1(host_pointer, device_pointer, dimensions)
subroutine zaccel_read_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine zaccel_read_buffer_0(this, n1, data, offset, async)
integer function, public accel_kernel_block_size(kernel)
subroutine zaccel_write_buffer_single(this, data, async)
subroutine daccel_read_buffer_2(this, n1, n2, data, offset, async)
subroutine iaccel_get_device_pointer_3l(host_pointer, device_pointer, dimensions)
subroutine zaccel_read_buffer_2(this, n1, n2, data, offset, async)
subroutine laccel_get_device_pointer_2(host_pointer, device_pointer, dimensions)
subroutine iaccel_write_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine zaccel_write_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine accel_grid_size_array_i8(n, blocksizes, gridsizes)
Computes the grid size for a given problem size and block size (64-bit version).
subroutine laccel_write_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine zaccel_read_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine iaccel_write_buffer_1(this, n1, data, offset, async)
subroutine zaccel_release_blas_alpha_beta_buffer(this, data, async)
subroutine laccel_write_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine, public accel_free_buffer(this, async)
subroutine daccel_write_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine iaccel_write_buffer_0_int32(this, n1, data, offset, async)
subroutine, public accel_kernel_start_call(this, file_name, kernel_name, flags)
subroutine iaccel_write_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine zaccel_write_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine iaccel_release_blas_alpha_beta_buffer(this, data, async)
subroutine iaccel_read_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine zaccel_write_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine, public accel_get_stream(stream_number)
subroutine accel_create_buffer_4(this, flags, type, size, set_zero, async)
subroutine zaccel_read_buffer_1_int32(this, n1, data, offset, async)
subroutine iaccel_write_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
integer(int64) pure function, public accel_global_memory_size()
subroutine daccel_read_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine laccel_write_buffer_1(this, n1, data, offset, async)
type(accel_kernel_t), target, save, public zkernel_ax_function_py
subroutine daccel_read_buffer_1(this, n1, data, offset, async)
subroutine daccel_write_buffer_2(this, n1, n2, data, offset, async)
subroutine zaccel_set_kernel_arg_data(kernel, narg, data)
subroutine daccel_get_device_pointer_3l(host_pointer, device_pointer, dimensions)
subroutine iaccel_read_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine daccel_get_device_pointer_2l(host_pointer, device_pointer, dimensions)
integer(int64) function accel_padded_size_i8(nn)
subroutine accel_check_bandwidth()
subroutine iaccel_write_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine daccel_read_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine laccel_read_buffer_0(this, n1, data, offset, async)
subroutine daccel_write_buffer_0(this, n1, data, offset, async)
subroutine iaccel_create_blas_alpha_beta_buffer(this, data, async)
subroutine zaccel_read_buffer_0_int32(this, n1, data, offset, async)
subroutine iaccel_get_device_pointer_1l(host_pointer, device_pointer, dimensions)
subroutine, public accel_finish()
subroutine laccel_write_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine accel_kernel_global_init()
subroutine zaccel_read_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine daccel_read_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine accel_kernel_run_4(kernel, gridsizes, blocksizes, shared_memory_size)
Run a kernel with 4-byte integer sizes.
subroutine zaccel_write_buffer_1(this, n1, data, offset, async)
subroutine iaccel_get_device_pointer_1(host_pointer, device_pointer, dimensions)
subroutine laccel_read_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine, public accel_copy_buffer(dest, src, type, nval, offset_dest, offset_src, async)
Copy nval elements of the given type between two device buffers.
subroutine accel_grid_size_extend_dim_i4(n, pack_size, gridsizes, blocksizes, kernel)
Helper function to compute the grid for the kernels that relies on the batch size (pack_size) and the...
subroutine laccel_create_blas_alpha_beta_buffer(this, data, async)
subroutine, public accel_ensure_buffer_size(buffer, flags, type, required_size, set_zero, async)
subroutine accel_set_buffer_to(buffer, type, val, nval, offset, async)
subroutine, public accel_move_buffer(buffer_from, buffer_to)
Move the buffer memory from the first buffer to the second.
subroutine, public accel_detach_buffer(this)
Clear a buffer handle without freeing device memory.
subroutine laccel_set_kernel_arg_data(kernel, narg, data)
subroutine iaccel_write_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine daccel_write_buffer_1(this, n1, data, offset, async)
subroutine daccel_read_buffer_0_int32(this, n1, data, offset, async)
subroutine zaccel_read_buffer_1(this, n1, data, offset, async)
subroutine iaccel_write_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine daccel_read_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine laccel_write_buffer_single(this, data, async)
subroutine laccel_read_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine daccel_get_device_pointer_2(host_pointer, device_pointer, dimensions)
subroutine accel_kernel_run_8(kernel, gridsizes, blocksizes, shared_memory_size)
Run a kernel with 8-byte integer sizes.
subroutine iaccel_read_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine zaccel_write_buffer_0_int32(this, n1, data, offset, async)
subroutine zaccel_write_buffer_1_int32(this, n1, data, offset, async)
subroutine accel_set_buffer_to_zero_i8(buffer, type, nval, offset, async)
subroutine zaccel_get_device_pointer_1l(host_pointer, device_pointer, dimensions)
logical pure function, public accel_buffer_is_allocated(this)
integer, parameter, public accel_mem_read_write
subroutine daccel_create_blas_alpha_beta_buffer(this, data, async)
subroutine accel_kernel_end(this)
type(accel_kernel_t), target, save, public dkernel_ax_function_py
subroutine laccel_write_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine zaccel_write_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine zaccel_get_device_pointer_2(host_pointer, device_pointer, dimensions)
subroutine daccel_write_buffer_3(this, n1, n2, n3, data, offset, async)
subroutine laccel_read_buffer_2_int32(this, n1, n2, data, offset, async)
type(c_ptr) function, public daccel_get_pointer_with_offset(buffer, offset)
subroutine iaccel_write_buffer_single(this, data, async)
subroutine iaccel_get_device_pointer_2(host_pointer, device_pointer, dimensions)
integer pure function, public accel_max_size_per_dim(dim)
subroutine zaccel_read_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine iaccel_read_buffer_0(this, n1, data, offset, async)
subroutine daccel_read_buffer_0(this, n1, data, offset, async)
subroutine iaccel_read_buffer_1_int32(this, n1, data, offset, async)
subroutine accel_grid_size_array_i4(n, blocksizes, gridsizes)
Computes the grid size for a given problem size and block size (32-bit version).
subroutine iaccel_read_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine laccel_write_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine laccel_write_buffer_0_int32(this, n1, data, offset, async)
subroutine zaccel_write_buffer_2(this, n1, n2, data, offset, async)
subroutine laccel_read_buffer_0_int32(this, n1, data, offset, async)
subroutine laccel_get_device_pointer_2l(host_pointer, device_pointer, dimensions)
subroutine iaccel_get_device_pointer_3(host_pointer, device_pointer, dimensions)
subroutine zaccel_write_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine zaccel_write_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine daccel_set_kernel_arg_data(kernel, narg, data)
subroutine iaccel_read_buffer_1(this, n1, data, offset, async)
subroutine accel_grid_size_extend_dim_i8(n, pack_size, gridsizes, blocksizes, kernel)
Helper function to compute the grid for the kernels that relies on the batch size (pack_size) and the...
subroutine, public accel_kernel_build(this, file_name, kernel_name, flags)
Compile the program that contains a given kernel.
subroutine, public accel_init(base_grp, namespace)
subroutine, public accel_end(namespace)
subroutine laccel_write_buffer_0(this, n1, data, offset, async)
subroutine daccel_write_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine zaccel_read_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine, public accel_synchronize_all_streams()
subroutine, public accel_set_stream(stream_number)
subroutine laccel_read_buffer_2(this, n1, n2, data, offset, async)
subroutine daccel_release_blas_alpha_beta_buffer(this, data, async)
subroutine iaccel_read_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine iaccel_read_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine laccel_get_device_pointer_1l(host_pointer, device_pointer, dimensions)
subroutine iaccel_read_buffer_0_int32(this, n1, data, offset, async)
subroutine accel_grid_size_i8(n, blocksizes, gridsizes)
Computes the grid size for a given problem size and block size (64-bit version).
subroutine iaccel_write_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
integer(int32) function accel_padded_size_i4(nn)
subroutine accel_set_buffer_to_zero_i4(buffer, type, nval, offset, async)
subroutine daccel_write_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
type(accel_kernel_t), target, save, public zkernel_batch_dotp
subroutine laccel_write_buffer_1_int32(this, n1, data, offset, async)
subroutine iaccel_get_device_pointer_2l(host_pointer, device_pointer, dimensions)
subroutine iaccel_write_buffer_2_int32(this, n1, n2, data, offset, async)
pure logical function, public accel_is_enabled()
subroutine zaccel_read_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine daccel_write_buffer_0_int32(this, n1, data, offset, async)
subroutine iaccel_write_buffer_4(this, n1, n2, n3, n4, data, offset, async)
subroutine daccel_write_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine iaccel_write_buffer_1_int32(this, n1, data, offset, async)
integer, parameter, public accel_mem_write_only
subroutine zaccel_write_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine daccel_read_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine laccel_write_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine laccel_read_buffer_1_int32(this, n1, data, offset, async)
subroutine daccel_read_buffer_1_int32(this, n1, data, offset, async)
subroutine laccel_read_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine daccel_write_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine daccel_get_device_pointer_1l(host_pointer, device_pointer, dimensions)
subroutine laccel_release_blas_alpha_beta_buffer(this, data, async)
subroutine iaccel_read_buffer_2(this, n1, n2, data, offset, async)
subroutine laccel_write_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine laccel_write_buffer_2(this, n1, n2, data, offset, async)
subroutine daccel_write_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine laccel_write_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine zaccel_get_device_pointer_3(host_pointer, device_pointer, dimensions)
type(c_ptr) function, public zaccel_get_pointer_with_offset(buffer, offset)
subroutine iaccel_read_buffer_6_int32(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine laccel_read_buffer_3_int32(this, n1, n2, n3, data, offset, async)
subroutine daccel_write_buffer_single(this, data, async)
subroutine daccel_write_buffer_1_int32(this, n1, data, offset, async)
subroutine zaccel_write_buffer_0(this, n1, data, offset, async)
type(accel_t), public accel
subroutine laccel_get_device_pointer_3(host_pointer, device_pointer, dimensions)
subroutine iaccel_read_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
integer(int64) pure function, public accel_shared_memory_size()
integer pure function, public accel_max_block_size()
subroutine iaccel_set_kernel_arg_data(kernel, narg, data)
subroutine daccel_read_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine iaccel_read_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine iaccel_write_buffer_0(this, n1, data, offset, async)
subroutine zaccel_get_device_pointer_3l(host_pointer, device_pointer, dimensions)
subroutine accel_create_buffer_8(this, flags, type, size, set_zero, async)
subroutine laccel_read_buffer_1(this, n1, data, offset, async)
subroutine daccel_read_buffer_5_int32(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine daccel_read_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine accel_program_add(file_name, name)
Register a kernel for later retrieval.
subroutine accel_set_kernel_arg_buffer(kernel, narg, buffer)
subroutine accel_kernel_list()
The kernels each source provides.
subroutine laccel_read_buffer_5(this, n1, n2, n3, n4, n5, data, offset, async)
subroutine zaccel_read_buffer_2_int32(this, n1, n2, data, offset, async)
subroutine zaccel_write_buffer_6(this, n1, n2, n3, n4, n5, n6, data, offset, async)
subroutine daccel_get_device_pointer_3(host_pointer, device_pointer, dimensions)
type(accel_kernel_t), pointer head
subroutine zaccel_read_buffer_4_int32(this, n1, n2, n3, n4, data, offset, async)
subroutine, public alloc_cache_put(alloc_cache, size, loc, put)
subroutine, public alloc_cache_get(alloc_cache, size, found, loc)
integer(int64), parameter, public alloc_cache_any_size
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_z1
real(real64), parameter, public m_one
System information (time, memory, sysname)
subroutine string_c_to_f(c_string, f_string)
convert a C string to a Fortran string
subroutine, public loct_sysname(name)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
character(len=512), private msg
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine, public messages_obsolete_variable(namespace, name, rep)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
type(type_t), parameter, public type_cmplx
integer pure function, public types_get_size(this)
type(type_t), parameter, public type_float
type(type_t), parameter, public type_none
This module defines the unit system, used for input and output.
type(unit_t), public unit_gigabytes
For larger amounts of data (natural code units are bytes)
type(unit_t), public unit_megabytes
For large amounts of data (natural code units are bytes)
type(unit_t), public unit_kilobytes
For small amounts of data (natural code units are bytes)