dtfft_interface_nvrtc Module

nvRTC Interfaces.

nvRTC is loaded at runtime via dynamic loading due to explicit cuda_driver linking by cmake.


Uses

  • module~~dtfft_interface_nvrtc~~UsesGraph module~dtfft_interface_nvrtc dtfft_interface_nvrtc iso_c_binding iso_c_binding module~dtfft_interface_nvrtc->iso_c_binding iso_fortran_env iso_fortran_env module~dtfft_interface_nvrtc->iso_fortran_env module~dtfft_errors dtfft_errors module~dtfft_interface_nvrtc->module~dtfft_errors module~dtfft_utils dtfft_utils module~dtfft_interface_nvrtc->module~dtfft_utils module~dtfft_errors->iso_fortran_env module~dtfft_utils->iso_c_binding module~dtfft_utils->iso_fortran_env module~dtfft_utils->module~dtfft_errors module~dtfft_parameters dtfft_parameters module~dtfft_utils->module~dtfft_parameters mpi_f08 mpi_f08 module~dtfft_utils->mpi_f08 module~dtfft_parameters->iso_c_binding module~dtfft_parameters->iso_fortran_env module~dtfft_parameters->mpi_f08

Used by

  • module~~dtfft_interface_nvrtc~~UsedByGraph module~dtfft_interface_nvrtc dtfft_interface_nvrtc module~dtfft_nvrtc_module dtfft_nvrtc_module module~dtfft_nvrtc_module->module~dtfft_interface_nvrtc module~dtfft_transpose_plan dtfft_transpose_plan module~dtfft_transpose_plan->module~dtfft_interface_nvrtc module~dtfft_kernel_device dtfft_kernel_device module~dtfft_transpose_plan->module~dtfft_kernel_device module~dtfft_transpose_handle_generic dtfft_transpose_handle_generic module~dtfft_transpose_plan->module~dtfft_transpose_handle_generic module~dtfft_nvrtc_module_cache dtfft_nvrtc_module_cache module~dtfft_nvrtc_module_cache->module~dtfft_nvrtc_module module~dtfft_plan dtfft_plan module~dtfft_plan->module~dtfft_transpose_plan module~dtfft dtfft module~dtfft->module~dtfft_plan module~dtfft_api dtfft_api module~dtfft_api->module~dtfft_plan module~dtfft_kernel_device->module~dtfft_nvrtc_module_cache module~dtfft_transpose_handle_generic->module~dtfft_kernel_device

Variables

Type Visibility Attributes Name Initial
procedure(nvrtcCreateProgram_interface), public, pointer :: nvrtcCreateProgram

Fortran pointer to the nvrtcCreateProgram function

procedure(nvrtcDestroyProgram_interface), public, pointer :: nvrtcDestroyProgram

Fortran pointer to the nvrtcDestroyProgram function

procedure(nvrtcCompileProgram_interface), public, pointer :: nvrtcCompileProgram

Fortran pointer to the nvrtcCompileProgram function

procedure(nvrtcGetProgramLogSize_interface), public, pointer :: nvrtcGetProgramLogSize

Fortran pointer to the nvrtcGetProgramLogSize function

procedure(nvrtcGetProgramLog_interface), public, pointer :: nvrtcGetProgramLog

Fortran pointer to the nvrtcGetProgramLog function

procedure(nvrtcGetCUBINSize_interface), public, pointer :: nvrtcGetCUBINSize

Fortran pointer to the nvrtcGetCUBINSize function

procedure(nvrtcGetCUBIN_interface), public, pointer :: nvrtcGetCUBIN

Fortran pointer to the nvrtcGetCUBIN function

procedure(nvrtcGetLoweredName_interface), public, pointer :: nvrtcGetLoweredName

Fortran pointer to the nvrtcGetLoweredName function

procedure(nvrtcAddNameExpression_interface), public, pointer :: nvrtcAddNameExpression

Fortran pointer to the nvrtcAddNameExpression function

integer(kind=int32), private, parameter :: N_FUNCTIONS_TO_LOAD = 10

Number of functions to load from nvrtc library

logical, private, save :: is_loaded = .false.

Flag indicating whether the library is loaded

type(c_ptr), private, save :: libnvrtc

Handle to the loaded library

type(c_funptr), private, save :: nvrtcFunctions(N_FUNCTIONS_TO_LOAD)

Array of pointers to the nvRTC functions

procedure(nvrtcGetErrorString_interface), private, pointer :: nvrtcGetErrorString_c

Fortran pointer to the nvrtcGetErrorString function


Abstract Interfaces

abstract interface

  • private function nvrtcGetErrorString_interface(error_code) result(string)

    Helper function that returns a string describing the given nvrtcResult code For unrecognized enumeration values, it returns “NVRTC_ERROR unknown”

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=c_int), value :: error_code

    CUDA Runtime Compilation API result code.

    Return Value type(c_ptr)

    Pointer to C string

abstract interface

  • private function nvrtcCreateProgram_interface(prog, src, name, numHeaders, headers, includeNames) result(nvrtcResult)

    Creates an instance of nvrtcProgram with the given input parameters, and sets the output parameter prog with it.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram) :: prog

    CUDA Runtime Compilation program.

    character(len=c_char) :: src(*)

    CUDA program source.

    character(len=c_char) :: name(*)

    CUDA program name.

    integer(kind=c_int), value :: numHeaders

    Number of headers used. Must be greater than or equal to 0.

    type(c_ptr), value :: headers

    Sources of the headers

    type(c_ptr), value :: includeNames

    Name of each header by which they can be included in the CUDA program source

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcDestroyProgram_interface(prog) result(nvrtcResult)

    Destroys the given program.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram) :: prog

    CUDA Runtime Compilation program.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcCompileProgram_interface(prog, numOptions, options) result(nvrtcResult)

    Compiles the given program.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    integer(kind=c_int), value :: numOptions

    Number of compiler options passed.

    type(c_ptr) :: options(*)

    Compiler options in the form of C string array

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcGetProgramLogSize_interface(prog, logSizeRet) result(nvrtcResult)

    Sets the value of logSizeRet with the size of the log generated by the previous compilation of prog. The log is a null-terminated string.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    integer(kind=c_size_t) :: logSizeRet

    Size of the compilation log.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcGetProgramLog_interface(prog, log) result(nvrtcResult)

    Stores the log generated by the previous compilation of prog in the memory pointed by log

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    type(c_ptr), value :: log

    Compilation log.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcGetCUBINSize_interface(prog, cubinSizeRet) result(nvrtcResult)

    Sets the value of cubinSizeRet with the size of the cubin generated by the previous compilation of prog.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    integer(kind=c_size_t) :: cubinSizeRet

    Size of the generated cubin.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcGetCUBIN_interface(prog, cubin) result(nvrtcResult)

    Stores the cubin generated by the previous compilation of prog in the memory pointed by cubin.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    type(c_ptr), value :: cubin

    Compiled and assembled result.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcGetLoweredName_interface(prog, name_expression, lowered_name) result(nvrtcResult)

    Extracts the lowered (mangled) name for a global function or device/constant variable, and updates *lowered_name to point to it.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    character(len=c_char) :: name_expression(*)

    Name expression.

    type(c_ptr) :: lowered_name

    Mangled name.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.

abstract interface

  • private function nvrtcAddNameExpression_interface(prog, name_expression) result(nvrtcResult)

    Notes the given name expression denoting the address of a global function or device/constant variable.

    Arguments

    Type IntentOptional Attributes Name
    type(nvrtcProgram), value :: prog

    CUDA Runtime Compilation program.

    character(len=c_char) :: name_expression(*)

    Name expression.

    Return Value integer(kind=c_int)

    The enumerated type nvrtcResult defines API call result codes.


Derived Types

type, public, bind(C) ::  nvrtcProgram

nvrtcProgram is the unit of compilation, and an opaque handle for a program.

Components

Type Visibility Attributes Name Initial
type(c_ptr), public :: cptr

Actual pointer


Functions

public function nvrtcGetErrorString(error_code) result(string)

Helper function that returns a string describing the given nvrtcResult code For unrecognized enumeration values, it returns “NVRTC_ERROR unknown”

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in) :: error_code

CUDA Runtime Compilation API result code.

Return Value character(len=:), allocatable

Result string

public function load_nvrtc() result(error_code)

Dynamically loads nvRTC library and its functions

Arguments

None

Return Value integer(kind=int32)

Error code