CUDA Driver Interfaces
CUDA Driver is loaded at runtime via dynamic loading.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
procedure(cuModuleLoadData_interface), | public, | pointer | :: | cuModuleLoadData |
Fortran pointer to the cuModuleLoadData function |
||
procedure(cuModuleUnload_interface), | public, | pointer | :: | cuModuleUnload |
Fortran pointer to the cuModuleUnload function |
||
procedure(cuModuleGetFunction_interface), | public, | pointer | :: | cuModuleGetFunction |
Fortran pointer to the cuModuleGetFunction function |
||
logical, | private, | save | :: | is_loaded | = | .false. |
Flag indicating whether the library is loaded |
type(c_ptr), | private, | save | :: | libcuda |
Handle to the loaded library |
||
type(c_funptr), | private, | save | :: | cuFunctions(4) |
Array of pointers to the CUDA functions |
||
procedure(cuLaunchKernel_interface), | private, | pointer | :: | cuLaunchKernel_ |
Fortran pointer to the cuLaunchKernel function |
Load a module’s data with options.
Takes a pointer image and loads the corresponding module module into the current context. The image may be a cubin or fatbin as output by nvcc, or a NULL-terminated PTX, either as output by nvcc or hand-written.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(CUmodule) | :: | mod |
Returned module |
|||
character(len=c_char) | :: | image(*) |
Module data to load |
Driver result code
Unloads a module.
Unloads a module hmod
from the current context.
Attempting to unload a module which was obtained from the Library Management API
such as cuLibraryGetModule
will return CUDA_ERROR_NOT_PERMITTED
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(CUmodule), | value | :: | hmod |
Module to unload |
Driver result code
Returns a function handle.
Returns in hfunc
the handle of the function of name name located in module hmod.
If no function of that name exists, cuModuleGetFunction
returns CUDA_ERROR_NOT_FOUND
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(CUfunction) | :: | hfunc |
Returns a function handle. |
|||
type(CUmodule), | value | :: | hmod |
Module to retrieve function from |
||
character(len=c_char) | :: | name(*) |
Name of function to retrieve |
Driver result code
Launches a CUDA function CUfunction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(CUfunction), | value | :: | func |
CUDA function to launch |
||
integer(kind=c_int), | value | :: | gridDimX |
Grid dimensions in X |
||
integer(kind=c_int), | value | :: | gridDimY |
Grid dimensions in Y |
||
integer(kind=c_int), | value | :: | gridDimZ |
Grid dimensions in Z |
||
integer(kind=c_int), | value | :: | blockDimX |
Block dimensions in X |
||
integer(kind=c_int), | value | :: | blockDimY |
Block dimensions in Y |
||
integer(kind=c_int), | value | :: | blockDimZ |
Block dimensions in Z |
||
integer(kind=c_int), | value | :: | sharedMemBytes |
Dynamic shared memory size |
||
type(dtfft_stream_t), | value | :: | stream |
Stream identifier |
||
type(c_ptr) | :: | kernelParams(*) |
Array of pointers to kernel parameters |
|||
type(c_ptr) | :: | extra |
Dynamic shared-memory size per thread block in bytes |
Driver result code
Dimension specification type
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=c_int), | public | :: | x | ||||
integer(kind=c_int), | public | :: | y | ||||
integer(kind=c_int), | public | :: | z |
Arguments passed to nvrtc-compiled kernels
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=c_int), | public | :: | n_ints | = | 0 |
Number of integers provided |
|
integer(kind=c_int), | public | :: | ints(5) |
Integer array |
|||
integer(kind=c_int), | public | :: | n_ptrs | = | 0 |
Number of pointers provided |
|
type(c_ptr), | public | :: | ptrs(3) |
Pointer array |
CUDA module
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(c_ptr), | public | :: | ptr |
Actual pointer |
CUDA function
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(c_ptr), | public | :: | ptr |
Actual pointer |
Loads the CUDA Driver library and needed symbols
Error code
Launches a CUDA kernel
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(CUfunction), | intent(in) | :: | func |
Function CUfunction or Kernel CUkernel to launch |
||
type(c_ptr), | intent(in), | target | :: | in |
Input pointer |
|
type(c_ptr), | intent(in), | target | :: | out |
Output pointer |
|
type(dim3), | intent(in) | :: | blocks |
Grid in blocks |
||
type(dim3), | intent(in) | :: | threads |
Thread block |
||
type(dtfft_stream_t), | intent(in) | :: | stream |
Stream identifier |
||
type(kernelArgs), | intent(in), | target | :: | kernelParams |
Input parameters of kernel |
Driver result code