kernel_code Derived Type

type, private :: kernel_code

Class to build CUDA kernel code


Components

Type Visibility Attributes Name Initial
character(len=:), private, allocatable :: raw

String that holds CUDA code


Type-Bound Procedures

procedure, public, pass(self) :: to_cstr

Converts Fortran CUDA code to C pointer

  • private subroutine to_cstr(self, c_code)

    Converts Fortran CUDA code to C pointer

    Arguments

    Type IntentOptional Attributes Name
    class(kernel_code), intent(in) :: self

    Kernel code

    character(len=c_char), intent(out), allocatable :: c_code(:)

    C pointer to code

procedure, public, pass(self) :: add_line

Adds new line to CUDA code

  • private subroutine add_line(self, line)

    Adds new line to CUDA code

    Arguments

    Type IntentOptional Attributes Name
    class(kernel_code), intent(inout) :: self

    Kernel code

    character(len=*), intent(in) :: line

    Line to add

procedure, public, pass(self) :: destroy => destroy_code

Frees all memory

  • private subroutine destroy_code(self)

    Frees all memory

    Arguments

    Type IntentOptional Attributes Name
    class(kernel_code), intent(inout) :: self

    Kernel code